sass-lint: "Root level" `!global` flag throws "Please check validity of the block" error
Starting to use sass-lint for the first time & hitting an error.
Here’s my system stats
sass-lint
: 1.3.0
gulp-sass-lint
: 1.0.1
gulp
: 3.9.0
npm
: 2.11.2
OS X 10.11 El Capitan
Get this error message when I run in it:
/repo_path/node_modules/gulp-sass-lint/node_modules/sass-lint/lib/groot.js:21
throw new Error('Parsing error' + fileInfo + ': ' + e.message);
^
Error: Parsing error at web/wp-content/themes/nursingorg-theme/assets/src/scss/_settings.scss: Please check validity of the block starting from line #108
at module.exports (/repo_path/node_modules/gulp-sass-lint/node_modules/sass-lint/lib/groot.js:21:11)
at Function.sassLint.lintText (/repo_path/node_modules/gulp-sass-lint/node_modules/sass-lint/index.js:36:13)
at DestroyableTransform._transform (/repo_path/node_modules/gulp-sass-lint/index.js:32:27)
at DestroyableTransform.Transform._read (/repo_path/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (/repo_path/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
at doWrite (/repo_path/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
at writeOrBuffer (/repo_path/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)
at DestroyableTransform.Writable.write (/repo_path/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:239:11)
at write (/repo_path/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
Here’s the Sass source in that block starting from line #108
in _settings.scss
:
$lap: new-breakpoint(min-width $lap-start $lap-cols)!global;
And here’s my Gulp task running this process:
var sassLint = require('gulp-sass-lint');
gulp.task('lint:sass', function() {
gulp.src(_src_dir + '/scss/**/*.scss')
.pipe( $.sassLint() )
.pipe( $.sassLint.format() )
.pipe( $.sassLint.failOnError() );
});
Finally, here’s sass-lint.yml in case that’s helpful:
#########################
## Sample Sass Lint File
#########################
# Linter Options
options:
# Don't merge default rules
merge-default-rules: false
# Set the formatter to 'html'
formatter: html
# Output file instead of logging results
# output-file: 'linters/sass-lint.html'
# File Options
files:
include: 'web/wp-contents/themes/*/src/scss/**/*.s+(a|c)ss'
ignore:
- ''
# Rule Configuration
rules:
extends-before-mixins: 2
extends-before-declarations: 2
placeholders-in-extend: 2
mixins-before-declarations:
- 2
-
exclude:
- breakpoint
- mq
no-warn: 1
no-debug: 1
no-ids: 2
no-important: 2
hex-notation:
- 2
-
style: uppercase
indentation:
- 2
-
size: 2
variable-for-property:
- 2
-
properties:
- margin
- content
After I removed all the !global
flags, sass-lint worked wonderfully. Which makes sense: that part of _settings.scss
is using !global
the wrong way. Those vars are already global since they’re not in a block. Someone probably meant !default
. If it’s possible, I’d prefer sass-lint tell us we’re using it wrongly, not error out.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (8 by maintainers)
Very shortly once #495 is complete
@matkovsky This is a “bad” solution for now, but I’ve found that using
unquote("calc(100% - #{$x / 2})")
produces the same output w/o errors. That said, I feel pretty conflicted about writing that kind of confusing/unnecessary Sass in order to get around a (hopefully temporary!) Gonzales AST bug.