francoismassart / eslint-plugin-tailwindcss

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

fix: support tag.div and tag(Component) #302

Closed nihalgonsalves closed 4 months ago

nihalgonsalves commented 9 months ago

fix: support tag.div`` and tag(Component)``

Description

The tagged template support from #41 only supported the very basic tag`...` format, but not formats such as tag.div`...` or tag(Component)`...`. This reads the object and callee of the tag to process those as well.

Libraries such as twc and twin.micro use this pattern.

Fixes #272

Node Support

I used Optional Chaining and the Nullish coalescing operator - these are only supported in Node 14.0.0 and higher, so I bumped the engines field.

Node 12 is EoL for over 2 years, but I can update it to alternative syntax if you like.

Type of change

How Has This Been Tested?

Test cases added. I also added missing template tag tests for all the rules.

Test Configuration:

Checklist:

user753 commented 7 months ago

@nihalgonsalves is there any plan to merge this pr?