Sr. Web UI Engineer
@afebbraro
thismarathonlife.com
"Lint was the name originally given to a particular program that flagged some suspicious and non-portable constructs (likely to be bugs) in C language source code. The term is now applied generically to tools that flag suspicious usage in software written in any computer language."
Stephen C. Johnson
Automation!!!!!
"We automate this process to promote readable and consistent coding styles"
Code is a communication tool between developers
Developer growth - learning by example
note: a node-only sass linter
Atom
Sublime
apm install linter-sass-lint
set up your config
Severity
0 = off
1 = warning
2 = error
# setting the configuration of a rule by setting it to an array
indentation:
- 2 # first item in the array is the severity
- # second item in the array is an object
size: 4 # setting the size option to 4 spaces
Some others: Brackets, IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm
npm install -g sass-lint
npm install sass-lint --save
sass-lint bin/css/app.css -v -q
webpack can only handle JavaScript natively, so we need the css-loader to process CSS files. We also need the style-loader to apply the styles in the CSS file.
npm install sasslint-webpack-plugin
note: sasslint-webpack-plugin has a dependency on sass-lint
var sassLintPlugin = require('sasslint-webpack-plugin');
module.exports = {
plugins: [
new sassLintPlugin()
]
}
// Default settings
module.exports = {
plugins: [
new sassLintPlugin({
configFile: '.sass-lint.yml',
context: ['inherits from webpack'],
ignoreFiles: [],
ignorePlugins: [],
glob: '**/*.s?(a|c)ss',
quiet: false,
failOnWarning: false,
failOnError: false,
testing: false
}),
]
}
afebbraro@afebbrarombp ~/a/sass-lint> webpack
/Users/afebbraro/apps/sass-lint/src/scss/main.scss
2:17 warning Color 'green' should be written in its hexadecimal form #008000 no-color-keywords
2:17 warning Color literals such as 'green' should only be used in variable declarations no-color-literals
✖ 2 problems (0 errors, 2 warnings)
/Users/afebbraro/apps/sass-lint/src/scss/main.scss
2:17 warning Color 'green' should be written in its hexadecimal form #008000 no-color-keywords
2:17 warning Color literals such as 'green' should only be used in variable declarations no-color-literals
✖ 2 problems (0 errors, 2 warnings)
Hash: 0ec1bed1a67220beddca
Version: webpack 1.13.0
Time: 5562ms
Asset Size Chunks Chunk Names
app.bundle.js 1.86 kB 0 [emitted] main
css/app.css 31 bytes 0 [emitted] main
[0] multi main 40 bytes {0} [built]
+ 6 hidden modules
WARNING in /Users/afebbraro/apps/sass-lint/src/scss/main.scss
Child extract-text-webpack-plugin:
+ 2 hidden modules
WARNING in /Users/afebbraro/apps/sass-lint/src/scss/main.scss
amberfebbraro@quickenloans.com