Wildbit-specific config for Stylelint.
Adding Stylelint to the project:
npm install -D stylelint wildbit/stylelint-config-wildbit
- Add following code to your
package.json
:
"stylelint": {
"extends": "stylelint-config-wildbit"
},
"scripts": {
"lint:css": "stylelint --syntax scss ./**/*.scss",
"fix:css": "stylelint --fix ./**/*.scss",
}
Now you can lint your CSS by running npm run lint:css
and fix with npm run fix:css
.
Linting makes more sense when running before committing the code.
To add a pre-commit task:
npm install -D pre-commit lint-staged
- Add
"stylelint-staged": "stylelint-staged"
toscripts
section ofpackage.json
- Add
"pre-commit": [ "stylelint-staged" ]
topackage.json