I'm using Tailwind in a Gatsby.js project. My environment is VSCode, using Prettier code formatter.
How do I get rid of these linting error alerts?
I'm using Tailwind in a Gatsby.js project. My environment is VSCode, using Prettier code formatter.
How do I get rid of these linting error alerts?
.vscode with a file settings.json:.vscode/settings.json:{
"css.validate": false,
"less.validate": false,
"scss.validate": false
}
npm i stylelint-config-standard -D
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,
},
};
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:
ignoreVS 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.
.vscode with a file settings.json:.vscode/settings.json:{
"css.validate": false
}
You get rid of these SASS linting errors when using Tailwind-CSS but you disable CSS validation.
The other answers are thermonuclear. Even Confucius stopped with a canon...
This is the one that did it for me.
To reproduce: Settings -> search for "invalid tailwind directive", update the value for this rule to "ignore". Voila.
Add this one-line fix in VSCode's settings.json
"scss.lint.unknownAtRules": "ignore"
This way you don't have to disable CSS validation.
You have to get a code formatter for VSCode to solve it.
I recommend you to download Beautify available on this link.
If you using VS Code then you can add support for modern and experimental CSS within Visual Studio Code by installing the following plugin to fix the error while using Tailwind CSS directives.
https://marketplace.visualstudio.com/items?itemName=csstools.postcss