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

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

Closed
iscekic opened this issue Jan 15, 2024 · 5 comments
Closed

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

iscekic opened this issue Jan 15, 2024 · 5 comments
Assignees
Labels

Comments

@iscekic
Copy link

iscekic commented Jan 15, 2024

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.

@iscekic iscekic added the bug Something isn't working label Jan 15, 2024
@ryan-dahlia
Copy link

ryan-dahlia commented Jan 15, 2024

+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
Copy link

+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
Copy link

Raithdk commented Jan 23, 2024

+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
Copy link
Owner

@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
Copy link

bbuilds commented Jan 25, 2024

@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

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

No branches or pull requests

6 participants