-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettier stops working when installing the plugin #29
Comments
Its likely due to the new utilities introduced in https://github.com/tailwindlabs/tailwindcss/releases/tag/v2.1.0 |
See tqwewe/tailwind-classes-sorter#4 A fix is to disable module.exports = {
// This "hack" ensures your IDE detects all normal Tailwind classes, while JIT is used when compiling the project.
// All the normal Tailwind classes should show up in code completion. It can't show all the new classes generated by JIT.
mode: process.env.NODE_ENV ? 'jit' : undefined,
}; |
For the Googlers out there:
If you experience this symptom, take the above medicine. mode: process.env.NODE_ENV
? // JIT for `npm run dev`.
'jit'
: // No JIT for IDE class and generation & prettier runs.
undefined, |
This fix doesn't work in a number of scenarios, especially when using eslint with prettier either via cli or vscode extension. The |
I'd recommend switching to https://github.com/francoismassart/eslint-plugin-tailwindcss with To keep IDE code completion working with, I still include the const tailwindConfig = require('./tailwind.config');
tailwindConfig.mode = 'jit';
module.exports = {
// Rest of config is omitted
rules: {
'tailwindcss/classnames-order': 'warn',
'tailwindcss/no-custom-classname': 'warn',
'tailwindcss/no-contradicting-classname': 'error',
}
settings: {
tailwindcss: {
config: tailwindConfig,
whitelist: customTailwindClasses,
},
},
} |
Thanks, I did give that eslint-plugin-tailwindcss a go this morning but it's very slow and I have a post-commit hook to run the linter and it added about 30 seconds to my commit times on a not-yet-huge project so was a no go on anything other than a trivial project. |
Having this same issue. Just disabled jit mode for now as this was in a relatively small and new toy project as well, but obviously down the line it'd be nice to have this plugin and tailwind jit working nicely together. Anything we can do to help? |
Describe the bug
When installing the plugin, Prettier stops working. It had never happened to me before, today I decided to create a NextJS project and when I added prettier next to the plugin, the code formatting stopped working completely.
To Reproduce
Steps to reproduce the behaviour:
prettier-plugin-tailwind
CTRL + S
and format on save doesn't workExpected behaviour
I expect to "format" the code on save, but this doesn't work. I already tested in other projects and works just fine.
Versions:
The text was updated successfully, but these errors were encountered: