bmatcuk / eslint-plugin-postcss-modules

Checks that you are using the classes exported by your css modules using postcss.
MIT License
21 stars 7 forks source link

Ability to mark class as used? #13

Open imathews opened 3 years ago

imathews commented 3 years ago

First off, thank you so much for this library! This is exactly what our team was looking for, and it plays perfectly with our postcss setup.

We are experiencing a few instances of false-positives, where a class is used but it's alerted as unused. Specifically, this happens when utilize the value of a variable to reference a class (e.g., <button className={styles[buttonType]} />)

I wouldn't expect the linter to handle this case, but it would be great to be able to ignore linting errors in these circumstances. The eslint-plugin-css-modules package implements the ability to do this, but it doesn't seem that postcss-modules supports a similar concept to their markAsUsed option.