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

[BUG] tailwindcss/enforces-shorthand reports false positive #307

Closed iscekic closed 8 months ago

iscekic commented 8 months ago

Describe the bug For some combinations of h- and w- classes, a size- equivalent does not exist, yet the rule reports them as invalid.

To Reproduce

  1. Try setting class values to h-screen w-screen

Expected behavior No error reported as size-screen doesn't exist per the docs

Screenshots N/A

Environment (please complete the following information):

Additional context The rule also reports false positives for custom values which don't exist in the tailwind config. Eg, I have 30 and 60 defined for width and height, but not for size - therefore h-30 w-30 can't be replaced by size-30.

ryan-dahlia commented 8 months ago

+1 We are also showing unexpected size-screen warnings in 3.14.0

However, we are also seeing new warnings that seem valid, that were not present in the previous 3.13.0 release.

Warning: Classnames 'h-8, w-8' could be replaced by the 'size-8' shorthand! Tailwind CSS v3.4.0 has the new size property, so these warnings are valid. Still an open question about size-screen

Thank you @francoismassart for this plugin!

elussich-globant commented 8 months ago

+1 We are seeing unexpected size-screen warnings in v3.14.0. Doing a quick search for size-screen in the TailwindCSS repo, it doesn't seem that particular shorthand exists.

Thanks for the plugin!

Raithdk commented 8 months ago

+1 I am also getting an unexpected size-screen shorthand, in V3.14.0, using this example: <div className="h-screen w-screen"> -> <div className="size-screen">

francoismassart commented 8 months ago

@iscekic @Raithdk @elussich-globant @ryan-dahlia @patrikholcak Please use the latest beta until it is published: npm i eslint-plugin-tailwindcss@3.14.1-beta.1 -D

and as always please provide feedback in this issue 👍

bbuilds commented 8 months ago

@iscekic @Raithdk @elussich-globant @ryan-dahlia @patrikholcak Please use the latest beta until it is published: npm i eslint-plugin-tailwindcss@3.14.1-beta.1 -D

and as always please provide feedback in this issue 👍

this seems to fix the same issue I was having as Raithdk