How do you get rid of these SASS linting errors when using Tailwind-CSS?
Solution for both .css and .scss
- At the root level of your project, update or create a dir
.vscode
with a filesettings.json
:
- Add the following to
.vscode/settings.json:
{
"css.validate": false,
"less.validate": false,
"scss.validate": false
}
- Install the vscode-stylelint extension
- install stylelint-config-standard:
npm i stylelint-config-standard -D
- create a
stylelint.config.js
file at the root level and add:
module.exports = {
extends: ['stylelint-config-recommended'],
rules: {
"at-rule-no-unknown": [
true,
{
ignoreAtRules: [
"tailwind",
"apply",
"variants",
"responsive",
"screen",
],
},
],
"declaration-block-trailing-semicolon": null,
"no-descending-specificity": null,
},
};
- restart vsCode
Results:
You get rid of these SASS linting errors when using Tailwind-CSS and keep doing css validation with stylelint.
You can tell VS Code's CSS linter to ignore "Unknown At Rules" (like @tailwind
). This will leave the rest of your CSS validation intact:
- VS Code -> Command Palette -> Workspace Settings -> Search for: CSS Unknown At Rules
- Set to
ignore
VS Code can also whitelist specific CSS properties with CSS > Lint: Valid Properties
, but it doesn't look like whitelisting specific 'at rules' is supported yet.