Repository navigation
fix(extractors): skip style declarations in object literals, for every framework - #219
Merged
Merged
Conversation
…y framework #214 skipped a key starting with `--`. The default `^styles?$` variable pattern reaches the style objects of every framework, not only React's custom properties, so a key is now skipped when it is a style declaration: - a custom property, as one token (`'--x flex'` is still read as classes); - a CSS property name (Solid, Vue, Qwik and Lit's kebab-case keys), from csstype minus the 15 names that are also Tailwind classes, held by a test; - a `-webkit-` / `-moz-` property by prefix, `-ms-` by name (`-ms-4` is a negative margin); - a key whose value is a string, number or template literal (Angular's `'width.px': 240`, lookup maps): a class map's value is a condition. Claude-Session: https://claude.ai/code/session_019vTh6S5A41M1HLkmk3FaM1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Follow-up to #214, which stopped reading
--keys as classes. The default^styles?$variable pattern reaches the style objects of every framework, not only React'sCSSProperties, so the remaining cases still reported:An object key is now skipped when it is a style declaration (
isStyleDeclarationinextractors.ts):/^--\S+$/.'--x flex'is read as classes again.utils/css-properties.ts, csstype's standard + SVG*PropertiesHyphennames plus the-ms-ones, minus the 15 that are also Tailwind classes (flex,grid,border,container,transition, …). A test holds that no name in the list is a class.-webkit-/-moz-by prefix.-ms-only by name, since-ms-4is a negative margin.{ flex: '1 1 0%' },'width.px': 240,{ 'primary-button': 'bg-blue-500' }).Every other key is still a class (
cn({ 'itms-center': isOpen })is still reported).Tests
style-declaration object keysblock intests/rules/no-unknown-classes.test.ts: framework cases (valid) and the token /-ms-4edges (invalid).CSS_PROPERTY_NAMES holds no Tailwind class, against the default fixture.pnpm lint && pnpm format:check && pnpm typecheck && pnpm build && pnpm test: 3522 + 312 passing.Docs
/settings(EN + ES) explains which object keys are read; theUnreleasedCHANGELOG entry from #214 is rewritten to cover the whole change;CLAUDE.mdupdated.Refs #5, #214
🤖 Generated with Claude Code
https://claude.ai/code/session_019vTh6S5A41M1HLkmk3FaM1