We have a series of legacy CSS files, which need linting and minifying, and then a series of new SCSS files, which need linting, rendering into CSS and minifying. While linting the SCSS files, I'm not getting the desired test errors using Gulp with stylelint-scss, and gulp-stylelint (which can use stylelint options). Is my setup correct?
My test SCSS style is
.component {
position: relative;
box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75);
color:$color-red;
&:hover {
box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75);
}
}
I have setup a custom config (named: .scsslintrc) for SCSS as follows
{
"plugins": [
"stylelint-scss"
],
"rules": {
"scss/dollar-variable-colon-space-before": "always",
"scss/dollar-variable-colon-newline-after": "always",
"scss/dollar-variable-pattern": "^foo",
"scss/selector-no-redundant-nesting-selector": true,
}
}
In Gulp, I am using gulp-stylelint
const lintScss = () => {
return gulp.src( path.scss.src )
.pipe( debug({ title: "SCSS File: ", showCount: false }) )
.pipe( stylelint({
configFile: ".scsslintrc",
failAfterError: true,
reportOutputDir: 'reports/lint',
reporters: [
{formatter: 'verbose', console: true}
],
debug: true
}) )
.pipe( gulp.dest( path.scss.dest ))
}
And the results is
Starting 'lintScss'...
[16:52:54] dir /mydir/gulp
[16:52:54] SCSS File: test/scss/scss_test.scss
[16:52:55]
1 source checked
/mydir/gulp/test/scss/scss_test.scss
0 problems found
[16:52:55] Finished 'lintScss' after 229 ms
I'm really expecting to see errors around "color:$color-red;" and "&:hover {" and I'm not seeing them. What am I missing?