A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
- Execute
Extensions: Install Extensions
command from Command Palette. - Type
@sort:installs stylelint
into the search form and install the topmost one.
Read the extension installation guide for more details.
To prevent both the VSCode built-in CSS linter [css]
and this extension [stylelint]
reporting the same CSS errors like in the screenshot, you can disable the built-in ones in User or Workspace setting:
"css.validate": false,
"less.validate": false,
"scss.validate": false
Once you follow the stylelint startup guide by creating a configuration file or edit stylelint.*
VSCode settings, stylelint automatically validates documents with these language identifiers:
- CSS (
css
) - HTML (
html
) - Less (
less
) - Markdown (
markdown
) - Markdown+MathML (
source.markdown.math
) - PostCSS (
postcss
) - Sass (
sass
) - SCSS (
scss
) - Sugarss (
sugarss
) - Vue (
vue
) - Vue-HTML (
vue-html
) - XML (
xml
)
Though it's highly recommended to add a stylelint configuration file to your workspace folder instead, you can also use the following extension settings.
Type: boolean
Default: true
Control whether stylelint is enabled or not.
Type: Object
Default: null
Will be directly passed to configOverrides
option.
Type: Object
Default: null
Will be directly passed to config
option. Note that if you set config
option, this plugin ignores all the stylelint configuration files.
Type: Array<string>
Default: []
Document types that you can use to run stylelint against if you are using CSS inside document types like: javascriptreact
, typescriptreact
.
ISC License © 2018 Shinnosuke Watanabe