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?
Since Tailwind is a PostCSS plugin, there's nothing stopping you from using it with Sass, Less, Stylus, or other preprocessors, just like you can with other PostCSS plugins like Autoprefixer.
Here's how to fix this. Open the settings, search for “unknown”, the first result should be the one you're looking for: CSS > Lint: Unknown At Rules : Change that to ignore : Done!
Tailwind CSS works by scanning all of your HTML files, JavaScript components, and any other templates for class names, generating the corresponding styles and then writing them to a static CSS file. It's fast, flexible, and reliable — with zero-runtime.
You can use both yours and Tailwind. You'll find that some of your styles may change though. The idea of Tailwind is to give you a base level of styling and tools to help you build something unique. So to answer the question, no you don't need to start over.
.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With