From 03e5f0c997b3d6fbca5701594d44afb56b9d8c7a Mon Sep 17 00:00:00 2001 From: Steven Linn Date: Tue, 27 Feb 2024 10:37:50 -0700 Subject: [PATCH] Add linting to CI --- .../custom/uswds_base_subtheme/gulpfile.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/webroot/themes/custom/uswds_base_subtheme/gulpfile.js b/webroot/themes/custom/uswds_base_subtheme/gulpfile.js index 0454a98..502967c 100644 --- a/webroot/themes/custom/uswds_base_subtheme/gulpfile.js +++ b/webroot/themes/custom/uswds_base_subtheme/gulpfile.js @@ -4,6 +4,9 @@ const { src, dest, series, parallel, watch } = require("gulp"); // eslint-disable-next-line import/no-unresolved const uswds = require('@uswds/compile'); +const sassLint = require('gulp-sass-lint'); +const esLint = require('gulp-eslint'); + /** * USWDS version */ @@ -22,6 +25,22 @@ uswds.paths.dist.img = './assets/img'; uswds.paths.dist.js = './assets/js'; uswds.paths.dist.scss = './components'; +function scssLintCi() { + return src(uswds.paths.dist.scss) + .pipe(sassLint()) + .pipe(sassLint.format()) + .pipe(sassLint.failOnError()) +} + + +function jsLintCi() { + return src(uswds.paths.dist.js) + .pipe(esLint()) + .pipe(esLint.format()) + .pipe(esLint.failAfterError()); +} + + /** * Exports * Add as many as you need @@ -31,3 +50,5 @@ exports.init = uswds.init; exports.compile = series(uswds.copyAssets, uswds.compile); exports.watch = uswds.watch; exports.default = exports.compile; + +exports.lintCi = series(scssLintCi, jsLintCi); \ No newline at end of file