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/no-custom-classname marks valid classes as invalid if they are only used once with a prefix #291

Open
DSil opened this issue Nov 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@DSil
Copy link

DSil commented Nov 17, 2023

Describe the bug
The tailwindcss/no-custom-classname marks valid classes as invalid if they are only used once with a prefix.

Example:
Let's say in our config md is a valid height value (16px).

The class h-md should be valid. However, it is not used on the project, so it is not included in the compiled CSS.
But let's say we do have the class first:h-md. This class is included on the build and works fine on the browser. But the linter marks it as invalid.
If I only have h-md and build, it is valid, no error displayed.
If I add both h-md and first:h-md classes and build again, the error is gone, so none of the classes are marked as invalid.
The problem occurs when a valid class does not exist on its own, but exists only prefixed (it can be a screen, custom selector, pseudo-state, etc...).

To Reproduce
Follow the example scenario and constraints on any environment with the linter active.

Expected behavior
There should be no error.

Screenshots
image

We can see that the intellisense understands the rule.

Environment (please complete the following information):

  • OS: macOS
  • Softwares + version used:
    • VSCode 1.84.2
    • npm 9.8.1
    • node 18.18.2
    • tailwindcss 3.3.3
    • eslint-plugin-tailwindcss 3.13.0
@DSil DSil added the bug Something isn't working label Nov 17, 2023
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

1 participant