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] no-custom-classname doesn't work with hyphenated group names #226

Closed
lachieh opened this issue Mar 17, 2023 · 5 comments
Closed

[BUG] no-custom-classname doesn't work with hyphenated group names #226

lachieh opened this issue Mar 17, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@lachieh
Copy link

lachieh commented Mar 17, 2023

Describe the bug
The no-custom-classname hits a false-positive when group names have anything other than [a-zA-Z0-9]

To Reproduce

<element class="group/custom-name">...</element>
  1:16  warning  Classname 'group/custom-name' is not a Tailwind CSS class!  tailwindcss/no-custom-classname

Expected behavior
Should accept anything that is a valid css rule. From my investigation it looks like almost any character except space. Tailwind itself handles these classes correctly:

https://play.tailwindcss.com/pveMxjkzQb
Screenshot 2023-03-17 at 3 35 01 PM

@lachieh lachieh added the bug Something isn't working label Mar 17, 2023
@lachieh
Copy link
Author

lachieh commented Mar 17, 2023

Additional research: tailwind uses postcss-selector-parser to escape the section after the group/ and postcss-selector-parser in turn uses cssesc to do the dirty work. It might be an opportunity to use one of those libraries to validate the name section of the the group/ class name.

@francoismassart
Copy link
Owner

npm i eslint-plugin-tailwindcss@3.10.2 should fix it

@lachieh
Copy link
Author

lachieh commented Apr 3, 2023

Thank you! 🚀

@Binero
Copy link

Binero commented Apr 5, 2023

@francoismassart

It appears not to be fixed. On 3.10.3 it still doesn't recognise bg-opacity/25.

@francoismassart
Copy link
Owner

@Binero
this is normal, it follows the New opacity modifier syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants