til

today i learned

View on GitHub

Write better CSS with eslint-plugin-tailwindcss

eslint-plugin-tailwindcss is an ESLint plugin that enforces best practices and consistency when using Tailwind CSS. It provides several rules that enforce best practices, such as ordering classnames, using shorthand, avoiding contradicting or custom classnames, and more. The plugin also parses the tailwind.config.js file and uses the correct values based on your own settings. To use the plugin, you need to install ESLint and eslint-plugin-tailwindcss, add tailwindcss to the plugins section of your .eslintrc configuration file, and configure the rules you want to use under the rules section. You can use the preset to get reasonable defaults. It works well with the official plugin prettier-plugin-tailwindcss, which formats your classnames according to the Tailwind CSS style guide.