Add the configuration to your repository (for instance in .stylelintrc
or .stylelintrc.json
or the stylelint
parameter in package.json):
{
"extends": "@davidsneighbour/stylelint-config"
}
To change parts of the configuration use the rules
parameter.
{
"extends": "@davidsneighbour/stylelint-config",
"rules": {
"max-nesting-depth": null
}
}
Add scripts to your package.json:
{
"scripts": {
"lint:styles": "stylelint assets/scss/",
"lint:styles:fix": "stylelint assets/scss/ --fix",
"lint:styles:config": "stylelint --print-config index.js"
}
}
Exchange the assets/scss/
with your own styles folder.
Run stylelint and show errors and warnings:
npm run stylelint
Run stylelint and fix automatically fixable issues:
npm run stylelint:fix
Print the current stylelint configuration:
npm run stylelint:config
Configurations | ||
---|---|---|
Build Tools | ||
Babel | Webpack | |
Testing | ||
Cypress | HTML Validate | |
Linters and Formatters | ||
Browserslist | ESLint | PostCSS |
Prettier | Stylelint | |
Project Management | ||
Commitlint | Release | |
Markdown and Writing | ||
Markdownlint | Remark Lint | |
Other Tools | ||
Bootstrap | Tools |