eslint-plugin-better-tailwindcss: Importing css files don't register

I have my styles split up in multiple files, all imported into a single index.css file. This is done for proper code management.

When I set that file as the entrypoint, the linter doesn’t crawl its imports, and the theme isn’t registered. If I set it to my theme file it will detect the Tailwind theme but not my component classes that are defined in a separate file imported in index.css

I enabled detectComponentClasses option.

Thank you for this great library.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Alright, after digging a bit deeper I’ve come to a conclusion.

Supporting import layers like @import './file.css' layer(components) is not trivial. The imported file could still have different layers or other imports into different layers which makes it quite complex.

In the next major version I want to read all classes in all imported css files based from the entryPoint, not just the ones in the @layer components. That way the whole complexity can be avoided and it works like most developers expect it to work. Until then, you need to stick to the @layer components way.

The plugin doesn’t watch for changes in the imported files; only the entrypoint file.

This will be fixed in the next patch release ~later today~ as soon as possible.

3.6.1 crashes when trying to import a CSS file that uses path aliases.

This will also be fixed in the next patch release

Now it is, you can try with v3.6.1 😁

Works amazingly, thank you