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] Wrong sort order for custom screens sizes #337

Open
clementoriol opened this issue May 6, 2024 · 0 comments
Open

[BUG] Wrong sort order for custom screens sizes #337

clementoriol opened this issue May 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@clementoriol
Copy link

Describe the bug
I have the following tailwind config that extends the screens size to add an "xs" screen size :

tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
  ...,
  theme: {
    extend: {
      screens: {
        xs: '480px',
      },
    },
  },
};

This new screen size gets sorted last, eg:

sm:text-3xl md:text-4xl xs:text-2xl

This cause specificity issues and results in the wrong styles being applied in large screens.

To Reproduce
Steps to reproduce the behavior:

  1. Add a new 'xs' screen size of '480px' in the tailwind config
  2. Add a xs:text-2xl sm:text-3xl md:text-4xl somewhere in the project
  3. Run eslint --fix and see the wrong sort order being applied

Expected behavior
The screen-size modifiers should be sorted by size (small -> large) OR the order should be configurable

Environment (please complete the following information):

  • OS: macOS 13.3
  • Softwares + version used:
    • esplint-plugin-tailwindcss 3.15.1
    • tailwindcss 3.4.1
    • VSCode 1.88.1
    • Nodejs 20.9.0
    • pnpm 8.12.0
@clementoriol clementoriol added the bug Something isn't working label May 6, 2024
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