Skip to content

[BUG] size is not always equivalent to h- and w- #315

Closed
@bodograumann

Description

@bodograumann

Describe the bug
While in general it is a good idea to use size- instead of h- and w-, those two definitions are not the same in all situations.
In particular if the selected tokens do not com from the spacing scale, the same names can mean different things.
It could also happen, that the size- utility does not exist at all.

To Reproduce
Steps to reproduce the behavior:

  1. Define the following tailwind settings:
    export default {
        theme: {
            width: {
                dialog: "26rem"
            },
            height: {
                dialog: "30rem"
            }
        }
    };
  2. Use the tokens like this: class="h-dialog w-dialog". This works as intended.
  3. Run eslint autofixes with tailwindcss-plugin installed. This replaces the above with class="size-dialog".
  4. The size-dialog class does not actually exist, because dialog does not exist in the spacing nor in the size scale. In fact the area is not even square.

Expected behavior
Ideally the linting rules would detect, that the two variants are not equivalent and not suggest the replacement.

Environment (please complete the following information):

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions