The stylelint config that we use at Etch
npm i -D stylelint prettier @etchteam/stylelint-config
echo "module.exports = { extends: ['@etchteam/stylelint-config'] };" > stylelint.config.js
Run the following:
npm i -D husky lint-staged
echo "module.exports = { '*.{css,scss}': 'stylelint --fix' };" > lint-staged.config.js
npx husky install
npx husky set .husky/pre-commit "npx --no-install -- lint-staged"
Add the following to your lint-staged config:
'*.{css,scss}': 'stylelint --fix'
Run the following:
mkdir .vscode
echo "{ "editor.formatOnSave": false, "editor.codeActionsOnSave": { "source.fixAll.stylelint": true } }" > .vscode/settings.json
Add the following to .vscode/settings.json
:
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
}