francoismassart/eslint-plugin-tailwindcss

[BUG] tailwindcss/enforces-shorthand reports false positive

iscekic opened this issue ยท 5 comments

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):

  • "eslint-plugin-tailwindcss": "3.14.0"

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.

+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!

+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!

+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">

@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 ๐Ÿ‘

@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