Summary
The no-unused-class-names rule (both @css-modules-kit/stylelint-plugin and @css-modules-kit/eslint-plugin) always treats tokens referenced by animation-name (and the animation shorthand) as "used", regardless of the cmkOptions.animation setting.
The rest of css-modules-kit (ts-plugin, codegen) extracts animation-name references only when animation is enabled. The rule should follow the same setting.
Reproduction
/* a.module.css */
.fade { color: red; }
.button { animation-name: fade; }
// a.tsx (uses styles.button only)
Expected: .fade is reported as unused. With animation: false, animation-name is not treated as a token reference.
Actual: .fade is not reported. findUsedTokenNames in @css-modules-kit/core walks animation-name / animation declarations unconditionally, so fade is counted as used.
Only false negatives (missed reports) occur, and only for users who explicitly set animation: false (the default is true).
Notes on fixing
The linter plugins currently do not read cmkOptions at all, so the fix needs a design decision about how they receive the option:
- Accept it as a rule option (stylelint secondary options / ESLint rule options): idiomatic for linters, but duplicates the tsconfig setting
- Read tsconfig from the plugins: keeps a single source of truth, but brings config discovery and caching concerns into the plugins
🤖 Generated with Claude Code
Summary
The
no-unused-class-namesrule (both@css-modules-kit/stylelint-pluginand@css-modules-kit/eslint-plugin) always treats tokens referenced byanimation-name(and theanimationshorthand) as "used", regardless of thecmkOptions.animationsetting.The rest of css-modules-kit (ts-plugin, codegen) extracts animation-name references only when
animationis enabled. The rule should follow the same setting.Reproduction
// a.tsx (uses styles.button only)Expected:
.fadeis reported as unused. Withanimation: false,animation-nameis not treated as a token reference.Actual:
.fadeis not reported.findUsedTokenNamesin@css-modules-kit/corewalksanimation-name/animationdeclarations unconditionally, sofadeis counted as used.Only false negatives (missed reports) occur, and only for users who explicitly set
animation: false(the default istrue).Notes on fixing
The linter plugins currently do not read
cmkOptionsat all, so the fix needs a design decision about how they receive the option:🤖 Generated with Claude Code