Skip to content
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

Error: Invalid Tailwind CSS classnames order tailwindcss/classnames-order #73

Open
muke5hy opened this issue Mar 25, 2023 · 4 comments
Open

Comments

@muke5hy
Copy link

muke5hy commented Mar 25, 2023

Failed to compile.

01:38:16.130 |  
01:38:16.130 | ./components/card.tsx
01:38:16.130 | 27:14 Error: Invalid Tailwind CSS classnames order tailwindcss/classnames-order
01:38:16.130 |  
01:38:16.130 | ./components/ui/command.tsx
01:38:16.131 | 32:18 Error: Invalid Tailwind CSS classnames order tailwindcss/classnames-order
01:38:16.131 |  
01:38:16.131 | info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
01:38:16.248 | error Command failed with exit code 1.
01:38:16.249 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
01:38:16.279 | Error: Command "yarn run build" exited with 1
01:38:16.553 | BUILD_UTILS_SPAWN_1: Command "yarn run build" exited with 1

@jonathanquaade
Copy link

You can use the eslint-plugin-tailwindcss to automatically fix that classnames order error. @shadcn already has the plugin installed

Just modify the lint script in package.json like this:

"scripts": {
  "lint": "next lint --fix",
},

And then run pnpm run lint. That should fix the classname ordering

@Manubi
Copy link

Manubi commented May 16, 2023

I think the problem is, the eslint plugin doesn't follow the same rules as the tailwindcss vscode extension and the prettier plugin.

@leonardomjq
Copy link

leonardomjq commented Aug 30, 2023

Any solution to this? The problem is indeed as @Manubi commented.

I already have this:

"lint": "next lint",
"lint:fix": "next lint --fix",

@imaprototype
Copy link

You can also add the following line to your package.json

"lint:fix": "next lint --fix"

and then execute

npm run lint:fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants