francoismassart / eslint-plugin-tailwindcss

ESLint plugin for Tailwind CSS usage
https://www.npmjs.com/package/eslint-plugin-tailwindcss
MIT License
1.5k stars 70 forks source link

[Feature request] tailwind-merge, clsx & classnames support #252

Open SanderCokart opened 1 year ago

SanderCokart commented 1 year ago

Is your feature request related to a problem? Please describe. this eslint plguin cannot detect classnames within anything other than the class,className html tag. This means clsx, classnames and tailwind-merge do no enforce the rules.

Describe the solution you'd like At least I would like tailwind-merge to be supported so that classname orders work for tailwind-merge

Describe alternatives you've considered None

Additional context

className={twMerge/twJoin(
   'h-full w-full fill-transparent stroke-white stroke-2 drop-shadow-[#000_0_0_8px] transition-[color]',
   selectedPickupPoint === pickupPoint && 'fill-success'
)}

https://github.com/dcastil/tailwind-merge
bezbac commented 1 year ago

Hey @SanderCokart. There is a configuration option on most of the rules called "callees" (See here) By using it, you should be able to get the rules to work with twMerge or twJoin. I'm using the library with clsx and it works for me.

ariesclark commented 1 year ago

Hey @SanderCokart. There is a configuration option on most of the rules called "callees" (See here) By using it, you should be able to get the rules to work with twMerge or twJoin. I'm using the library with clsx and it works for me.

These functions are commonly used in the ecosystem, maybe consider adding them as defaults?

joaopedrodcf commented 10 months ago

Hey @SanderCokart. There is a configuration option on most of the rules called "callees" (See here) By using it, you should be able to get the rules to work with twMerge or twJoin. I'm using the library with clsx and it works for me.

This was super helpful 🥇

aguirrealvaro commented 9 months ago

Hey @SanderCokart. There is a configuration option on most of the rules called "callees" (See here) By using it, you should be able to get the rules to work with twMerge or twJoin. I'm using the library with clsx and it works for me.

Thanks!

ItsTarik commented 2 weeks ago

That's an issue !

ItsTarik commented 2 weeks ago

@bezbac Thanks problem solved 👍