francoismassart/eslint-plugin-tailwindcss

[BUG] tailwindcss/enforces-shorthand try to shorthand 'inset-y-0' with a whitespace

Senbonzakura1234 opened this issue ยท 3 comments

Describe the bug
The rule try to shorthand 'inset-y-0' with a whitespace before an appending template string variable

To Reproduce
Steps to reproduce the behavior:

try typing this JSX:
<div className={`absolute inset-y-0 left-0 w-1/3 rounded-[inherit] shadow-lg ${className}`} />
got lint warning Classnames '' could be replaced by the 'inset-y-0' shorthand! eslint (tailwindcss/enforces-shorthand)
format the code and it change to:
<div className={`absolute inset-y-0 left-0 w-1/3 rounded-[inherit] shadow-lg${className}`} />

Expected behavior
Expect it not to remove the whitespace, no lint warning
<div className={`absolute inset-y-0 left-0 w-1/3 rounded-[inherit] shadow-lg ${className}`} />

Screenshots
image

Environment (please complete the following information):

  • OS: windows 11
  • Softwares + version used:
    • VSCode 1.85.2
    • pnpm@8.14.1 node@18.18.2 Terminal@1.18.3181.0

eslint config file or live demo
https://github.com/Senbonzakura1234/sophie-dex

๐Ÿ‘‹ @Senbonzakura1234
can you try the latest beta by running

npm i eslint-plugin-tailwindcss@3.14.1-beta.0 -D ?

And then try to reproduce the issue ? I added a test case which runs fine.

Thank you for your feedback

eslint-plugin-tailwindcss@3.14.1-beta.0 -D

Okay so it seems the beta version works

Fixed in 3.14.1