francoismassart / eslint-plugin-tailwindcss

ESLint plugin for Tailwind CSS usage
https://www.npmjs.com/package/eslint-plugin-tailwindcss
MIT License
1.38k stars 65 forks source link

[BUG] enforces-shorthand misbehaves with false-positive on non-redundant `rounded` classes #327

Open Aleuck opened 4 months ago

Aleuck commented 4 months ago

Describe the bug enforces-shorthand rule gets confused with different rounded classes, suggesting fixes that are not equivalent to original code.

To Reproduce Steps to reproduce the behavior:

  1. Create a div with classes rounded-b-xl and rounded-tr-xl (rounded bottom and top-right);
  2. Run eslint with eslint-plugin-tailwindcss with recommended settings;
  3. Get warning

    Classnames 'rounded-tr-xl' could be replaced by the 'rounded-r-xl' shorthand! eslint(tailwindcss/enforces-shorthand)

  4. Run with eslint --fix;
  5. Eslint replaces both classes (rounded-b-xl and rounded-tr-xl) with rounded-r-xl only.

Expected behavior No warning should be shown and no fix should be made as both classes are not redundant.

Environment (please complete the following information):