grunt-contrib-sass-lint
raw JSON → 0.0.4 verified Fri May 01 auth: no javascript deprecated
A Grunt task plugin to run sass-lint on your Sass/SCSS files. Version 0.0.4 is the last release, with no apparent update cadence. It wraps the sass-lint library and provides a config option to specify a lint configuration file. Compared to alternatives like grunt-sass-lint, this plugin is minimal but lacks active maintenance. It requires Node >= 5.3.0 and Grunt.
Common errors
error Warning: Task "sass-lint" not found. Use --force to continue. ↓
cause Grunt plugin not loaded or installed.
fix
Run
npm install grunt-contrib-sass-lint --save-dev and add grunt.loadNpmTasks('grunt-contrib-sass-lint'); to Gruntfile. error Fatal error: Cannot find module 'sass-lint' ↓
cause Missing peer dependency sass-lint.
fix
Run
npm install sass-lint --save-dev (or --save depending on needs). error Config file not found: .sass-lint.yml ↓
cause The default config file does not exist in the current working directory.
fix
Create a
.sass-lint.yml file or set the config option to an existing file path. Warnings
deprecated This package is no longer maintained. sass-lint itself is deprecated in favor of stylelint with sass rules. ↓
fix Migrate to stylelint or another modern Sass linter.
gotcha The `config` option must be a string path to a YAML file. If not provided, it searches for `.sass-lint.yml` in cwd. ↓
fix Ensure config file exists at expected location or pass explicit path.
gotcha The source files must be passed as an array of strings (grunt file glob). No other options are supported. ↓
fix Use grunt.file.src or similar array.
Install
npm install grunt-contrib-sass-lint yarn add grunt-contrib-sass-lint pnpm add grunt-contrib-sass-lint Imports
- grunt wrong
grunt.loadNpmTasks('grunt-contrib-sass-lint')()correctgrunt.loadNpmTasks('grunt-contrib-sass-lint');
Quickstart
// Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
'sass-lint': {
options: {
config: '.sass-lint.yml'
},
target: ['src/**/*.scss']
}
});
grunt.loadNpmTasks('grunt-contrib-sass-lint');
grunt.registerTask('default', ['sass-lint']);
};