isStableClass function ✓ 100.0%
Last updated: 2026-03-05T12:26:14.062Z
Metrics
LOC: 12
Complexity: 7
Params: 1
Coverage: 100.0% (8/8 lines, 0x executed)
Signature
isStableClass(cls: string): : boolean
Summary
Returns true if a CSS class name looks like a stable, semantic class (not generated by CSS Modules, styled-components, emotion, etc.).
Source Code
function isStableClass(cls: string): boolean {
if (cls.length < 2 || cls.length > 50) return false;
// Skip CSS-in-JS and module-generated prefixes
if (/^(_|css-|sc-|emotion-|jss-|makeStyles)/i.test(cls)) return false;
// Skip all-digit strings
if (/^\d+$/.test(cls)) return false;
// Skip hex-like hashes (e.g. a3b2c1f0)
if (/^[a-f0-9]{6,}$/i.test(cls)) return false;
// Skip long alphanumeric blobs without separators (likely generated)
if (/^[a-z0-9]{20,}$/i.test(cls)) return false;
return true;
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| cls | dynamic_call |
No incoming dependencies.