Skip to content

Commit

Permalink
Add linting to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenlafl committed Feb 27, 2024
1 parent f439991 commit 03e5f0c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions webroot/themes/custom/uswds_base_subtheme/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
Expand All @@ -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);

0 comments on commit 03e5f0c

Please sign in to comment.