Skip to content

[Feature request] Autosorter doesn't seem to support prefix (tw:) #427

@rad-eset

Description

@rad-eset

Is your feature request related to a problem? Please describe.
The class autosorter doesn’t seem to work when using the tw: prefix.

{
    "eslint": "^9.38.0",
    "eslint-plugin-tailwindcss": "^4.0.0-beta.0",
    "tailwindcss": "^4.1.14",
    "@tailwindcss/vite": "^4.1.14"
}

Describe the solution you'd like
It would be great if the plugin recognized the Tailwind configuration -- ideally from the Tailwind 4 CSS import file. The modern setup doesn’t rely on tailwind.config.js, so the prefix is often defined directly in CSS using the prefix option (see https://tailwindcss.com/docs/styling-with-utility-classes#using-the-prefix-option).
The autosorter should respect that prefix and correctly sort prefixed classes.

Describe alternatives you've considered

  • Adding config: { prefix: 'tw' } or config: { prefix: 'tw:' } in the new ESLint 9 config.
  • Using the @config Tailwind directive and setting the prefix option in an old style tailwind.config.js.
  • Using standard Tailwind v4 imports like @import "tailwindcss" prefix(tw);.
  • Experimenting with classRegex, config.tags, and other combinations in the ESLint setup.

Additional context
Once the tw: prefix is removed, autosorting works correctly. This suggests the issue is prefix-related.

Not sure if we’re missing a config here, but I couldn’t find anything indicating that. If we are, I’d appreciate any guidance. Thank you! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions