Stylelint config, for idiomatic css rules and auto-sorting with prettier.
- Install
npm i -D stylelint stylelint-config-idiomatic-css
- Create
.stylelintrc.js
in root project folder.
module.exports = {
extends: ['stylelint-config-idiomatic-css'],
}
- Install VSCode plugin
npm i -D stylelint stylelint-config-standard stylelint-config-recommended-scss stylelint-config-idiomatic-css
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-recommended-scss',
'stylelint-config-idiomatic-css',
],
}
Auto-sorting does`t work
npm i -D stylelint stylelint-processor-styled-components stylelint-config-standard stylelint-config-styled-components stylelint-config-idiomatic-css
module.exports = {
processors: ['stylelint-processor-styled-components'],
extends: [
'stylelint-config-standard',
'stylelint-config-styled-components',
'stylelint-config-idiomatic-css',
],
syntax: 'scss',
}
For use it with styled-components
, u need some vscode settings
"stylelint.additionalDocumentSelectors": [
"javascript"
],