eslint-plugin-css-modules icon indicating copy to clipboard operation
eslint-plugin-css-modules copied to clipboard

Why do you support classes only, no IDs?

Open curiousity4ever opened this issue 6 years ago • 4 comments

curiousity4ever avatar Aug 14 '19 20:08 curiousity4ever

Because ids are global, they aren't converted to hashed names like classes.

atfzl avatar Aug 15 '19 06:08 atfzl

@atfzl, IDs on my project are converted to hashed names: image

curiousity4ever avatar Aug 27 '19 00:08 curiousity4ever

I use ids as well in css module to ensure scoped hashed ids sometimes and the linter complains the "class" doesn't exist, but it's an id not a class

image

Cellule avatar Aug 30 '23 18:08 Cellule

As stated in the CSS Modules documentation, only class and animation names used by at-rules like @keyframe should be supported:

A CSS Module is a CSS file in which all class names and animation names are scoped locally by default.

ids are global and does not belong to any specific CSS module, therefore it wouldn't make sense to support unused/undefined id in a plugin made for CSS modules.

yuhsianw avatar Sep 28 '23 21:09 yuhsianw