Repository navigation
fix(eslint-plugin): report missing tokens inside style values - #3996
Merged
segunadebayo merged 10 commits intoOct 15, 2026
Merged
segunadebayo merged 10 commits into
segunadebayo merged 10 commits into
Conversation
no-invalid-token-paths only checked token('โฆ') calls. references written
inside a style string, like '0 0 0 1px {colors.ghost}' or
'calc(token(sizes.ghost) + 2px)', went unreported, and cssgen wrote the
path into the css as an invalid value without a warning.
- add token_references() next to the reference expansion in
pandacss_utility so the scanner and the emitter share one parser
- warn with unknown_token_reference from the usage diagnostics shared by
the build and source inspection, so cssgen reports it with file and line
- expose the references in each style value with exact source spans; the
rule reports there, falls back to the warning for pattern calls, and
extraction-diagnostics skips the code so nothing is reported twice
|
@Adebesin-Cell is attempting to deploy a commit to the Chakra UI Team on Vercel. A member of the Team first needs to authorize it. |
๐ฆ Changeset detectedLatest commit: 5ead574 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
โฆvalues Drop the new ValueTokenRef/references inspection field. References written inside style strings now land in the existing tokenRefs, so no-invalid-token-paths needs no changes. One scanner (token_references) replaces the ad-hoc parser in collect_token_refs.
Drop the separate ValueTokenRefs walker. References inside style strings now come from the value spans StyleEntryCollector already records, and pattern calls and JSX patterns go through that collector with the existing PatternCall syntax. token( no longer matches inside a longer name, so url(/a/mytoken(1).png) is left alone in both the lint and the CSS.
sangwook-dev
added a commit
to sangwook-dev/fe-lab
that referenced
this pull request
Oct 22, 2026
* build(deps): Panda CSS๋ฅผ 2.3.0์ผ๋ก ์ฌ๋ฆฐ๋ค
@pandacss/{dev,preset-base,preset-panda,vite}์ catalogs.lint์ @pandacss/eslint-plugin์
2.1.2์์ 2.3.0์ผ๋ก ํจ๊ป ์ฌ๋ฆฐ๋ค.
- ๋ธ๋ก๊ทธ out/ CSS๋ 2.1.2์ ๊ฐ๋ค(.nextยทout์ ์ง์ด ๊ฐ์ ๋น๋ ๋ ๋ฒ์ ๋น๊ต, ์์ค๋งต ์ด๋ฆ๋ง ๋ค๋ฅด๋ค).
- 2.3.0๋ถํฐ Panda lint์ no-invalid-token-paths๊ฐ ์คํ์ผ ๋ฌธ์์ด ์์ ์๋ ํ ํฐ
(`'1px solid token(colors.orange.500)'`)์ ์ก๋๋ค(chakra-ui/panda#3996). ๋ธ๋ก๊ทธ src/์
๋ฃ์ด ๋ฐํ๋ฅผ ๋ณด๊ณ ์๋ณตํ๋ค. AGENTS.md ยง3์ "์ด๋ ์ชฝ๋ ๋ณด์ง ์๋๋ค"๋ฅผ ๋ฒ์์ ํจ๊ป ๊ณ ์น๋ค โ
check-types๋ ์ฌ์ ํ ๋ชป ๋ณด๊ณ , lint๋ ๋ธ๋ก๊ทธ src/๋ง ๋ณธ๋ค(panda.config.ts์ globalCssยทlab ์ฑ์ ๋ฐ).
* strict(blog-web): Panda lint ์ค์ ์ ๋จ์ธยทํ์ผ ์์ธ ์์ด ํ๋ฌ๊ทธ์ธ์ ํ์
๊ณผ ํ์ ์ ๊ทธ๋๋ก ์ด๋ค
2.3.0์ ๋ค์ด๊ฐ upstream ์์ ๋๋ก 2.1.2์ฉ ์ฐํ๋ฅผ ๊ฑท๋๋ค.
- recommended()๊ฐ ESLint์ defineConfig ํ์
์ ๊ทธ๋๋ก ๋ค์ด๊ฐ๋ค(chakra-ui/panda#3981).
`as unknown as Linter.Config` ๋จ์ธ๊ณผ, ๊ทธ ๋จ์ธ ๋๋ฌธ์ eslint.config.mts๋ง
no-unsafe-type-assertion์ ๋๋ ๋ธ๋ก์ ์ง์ด๋ค. tsc -p tsconfig.json ํต๊ณผ.
- prefer-token์ด ๋ถํฌ๋ช
๋ ์์์ด ํ ํฐ(`paper.50/80`)์ ํ ํฐ์ผ๋ก ๋ณธ๋ค(chakra-ui/panda#3968,
2.2.0). Layout.tsx๋ง allow์ ๋ฃ๋ ๋ธ๋ก์ ์ง์ด๋ค.
lint ์๋ฐ 0 โ 0. ํ๋ก๋ธ(Layout.tsx์ ๋ฃ๊ณ ์๋ณต): `paper.50/80`์ ๋ณด๊ณ ์์, ์๋ ํ ํฐ
`paper.999/80`๊ณผ `[8px]`(radii)๋ prefer-token error โ ํ๋ฌ๊ทธ์ธ์ด ๊ทธ ํ์ผ์ ๋ณด๊ณ ์๋ค.
* perf(blog-web): ๋ธ๋ก๊ทธ CSS๋ ์ฐ์ง ์๋ keyframes๋ฅผ ์ฃ์ง ์๋๋ค
optimize.removeUnusedKeyframes๋ฅผ ์ผ ๋ค. 2.1.2๋ animations ํ ํฐ(`animation: 'pulse'`)์ผ๋ก๋ง
์ฐธ์กฐํ keyframes๊น์ง ์ง์์ ๊บผ ๋์๋๋ฐ, 2.3.0์์ ๊ณ ์ณ์ก๋ค(chakra-ui/panda#3986).
- out/ CSS์ @Keyframes: bounceยทpingยทpulseยทreading-progress-fillยทspin โ
pulseยทreading-progress-fill. ์ผ๊ธฐ ์ ํ CSS diff๋ ๋น ์ง ์ธ ๋ธ๋ก๋ฟ์ด๋ค.
- ์ฒซ ๋ก๋ CSS gzip ์ต๋: 27.2 โ 27.1 KB(/posts/๋ 27.8 KB ๊ทธ๋๋ก). ์์ฐ 30 KB๋ ๊ทธ๋๋ก ๋๋ค โ
์ต๋ 27.8 KB๋ก ๋์จํ ์์ฐ ํํ(80%) ์๋ค.
- removeUnusedTokens๋ ๊ณ์ ๋๋ค. 2.3.0์์ ์ผ ๋ณด๋ฉด code.* ๋ณ์ 18๊ฐ ์ค 15๊ฐ๊ฐ ์ฌ๋ผ์ง๋ค
(codeTheme.ts๊ฐ ๋ฐํ์์ ๊ณ ๋ฅด๋ token.var(role)์ ๋ชป ๋ณธ๋ค).
- test:e2e 83 passed.
* strict(blog-web): ๋ธ๋ก๊ทธ๋ preset-panda์ ๊ทธ๋ฆผ์ ํ ํฐ์ ์ฃ์ง ์๊ณ , ๊ทธ๋ฆผ์ ์ฅ์์ ํ์
์์ ๋งํ๋ค
preset:resolved ํ๋ฌ๊ทธ์ธ์ด preset-panda์ theme.tokens.shadows๋ ๋บ๋ค. ๊ทธ๋ฆผ์ ์ฅ์์ ๊ธ์ง๋ผ
(AGENTS.md ยง9) ์ฐ๋ ๊ณณ์ด 0์ด์๋๋ฐ ๋ณ์ 11๊ฐ๊ฐ ํ ํฐ ๋ ์ด์ด์ ์ค๋ ธ๊ณ `boxShadow: 'md'`๊ฐ
ํ์
์ ํต๊ณผํ๋ค. @blog/preset์ `shadows.markerLeft`๋ ๋จ์ ์นดํ
๊ณ ๋ฆฌ๊ฐ ๋น์ง ์๋๋ค.
- out/ CSS diff๋ --shadows-* ์ ์ 11๊ฐ๋ฟ์ด๋ค. ์ฒซ ๋ก๋ CSS gzip ์ต๋ 27.1 โ 27.0 KB
(/posts/ 27.8 โ 27.7), admin JS 435.1 โ 434.9 KB(ํ ํฐ ๋งต์ด ์ค๋ค).
- ํ๋ก๋ธ: `boxShadow: 'md'`๋ TS2769, `shadow: 'markerLeft'`๋ ํต๊ณผ.
- ๊ฐ์ ์ด์ ๋ก ์ฐ๋ ๊ณณ์ด 0์ธ blursยทdurationsยทaspectRatios๋ ๋จ๊ธด๋ค. ๋นผ ๋ณด๋ฉด Panda๊ฐ ๊ทธ ์์ฑ
ํ์
์ `string | number`๋ก ๋ํ(์นดํ
๊ณ ๋ฆฌ๊ฐ ํต์งธ๋ก ๋น๋ฉด strictTokens๊ฐ ํ๋ฆฐ๋ค)
`transitionDuration: 'fast'`ยท`backdropBlur: 'md'`ยท`aspectRatio: 'square'`๊ฐ ํ์
์ ํต๊ณผํด
๊นจ์ง CSS๋ก ๋๊ฐ๋ค(2.3.0 ์ค์ธก).
- ์์ฐ์ ๊ทธ๋๋ก๋ค: ์ต๋ 27.7 KB์ ~5% ์ฌ์ ๋ฅผ ์น์ด๋ 30 KB. ๊ฐ ์ค ์ธก์ ๊ฐ ์ฃผ์๋ง ์ด ๋น๋๋ก ๊ฐฑ์ ํ๋ค.
- optimize.removeUnusedTokens(โ1.0 KB)๋ ์ผ์ง ์๋๋ค โ ์ฌ์ฉ์ฒ๋ฅผ css() ์ถ์ถ๊ณผ ์ค์ ์์๋ง ์ธ์,
์ฝ๋ ๋ธ๋ก ๊ตฌ๋ฌธ ๊ฐ์กฐ๊ฐ ๋ฐํ์ token.var()๋ก ๋ถ๋ฅด๋ code.* 15๊ฐ๋ฅผ ์ง์ด๋ค(์ฐจํธ์ token() ์ฐธ์กฐ๋
์ง๊ธ์ ๋ค๋ฅธ css()๊ฐ ๊ฐ์ ํ ํฐ์ ์จ์ ๋จ์ ๋ฟ์ด๋ค). smartCompoundVariants๋
compound variant 3๊ฐ๋ฟ์ด๊ณ ๋ณํ ๊ฐ์ด ๋ฐํ์์ด๋ผ ์ผ์ง ์๋๋ค.
* strict(blog-content): ํ์ด์ง CSS๊ฐ ๋ถ๋ฅด๋ keyframes๊ฐ ๊ทธ CSS์ ์์ผ๋ฉด ๋น๋๊ฐ ์คํจํ๋ค
check-bundle์ด ํ์ด์ง๋ง๋ค ๊ทธ ํ์ด์ง๊ฐ ๋ด๋ ค๋ฐ๋ CSS ์ ๋ถ๋ฅผ ๋ณด๊ณ , animationยทanimation-name
์ ์ธ์ด ๋ถ๋ฅด๋ ์ด๋ฆ(var()๋ ๊ฐ์ CSS์ ์ฌ์ฉ์ ์ ์ ์์ฑ์ผ๋ก ํผ๋ค)์ @Keyframes ์ ์๊ฐ ์๋์ง
ํ์ธํ๋ค(cssKeyframes.ts).
์ ์๊ฐ ์์ผ๋ฉด ๋ธ๋ผ์ฐ์ ๋ ์ง๋จ ์์ด ์ ๋๋ฉ์ด์
์ ๊ฑด๋๋ด๋ค โ ๋ก๋ฉ ์ค์ผ๋ ํค(pulse)๊ณผ ๊ธ
์์ธ์ ์คํฌ๋กค ์งํ ๋ฐ(reading-progress-fill)๊ฐ ๋ฉ์ถ๋ค. ๋ธ๋ก๊ทธ๊ฐ optimize.removeUnusedKeyframes๋ฅผ
์ผ๋ฉด์(์ด PR) keyframes๊ฐ Panda ์ตํฐ๋ง์ด์ ์ ํ๋จ์ ๋ฌ๋ ธ๋๋ฐ, 2.1.2์ ์ตํฐ๋ง์ด์ ๋ animations
ํ ํฐ์ผ๋ก๋ง ๋ถ๋ฅธ keyframes๋ฅผ ์ง์ ๋ค. ๋น๋ยทํ์
ยทjsdom ํ
์คํธ๋ ์์ฑ CSS๋ฅผ ๋ณด์ง ์๋๋ค.
- ์ด๋ฆ ๋ชฉ๋ก์ ๋ฐ๋ก ๋์ง ์๋๋ค โ ๋ถ๋ฅด๋ ์ด๋ฆ์ ์ฐ์ถ๋ฌผ์์ ๋ชจ์ผ๋ฏ๋ก ์ ์ ๋๋ฉ์ด์
๋ ๋ฎ๋๋ค.
- ์์ฑ ๋์กฐ: @Keyframes ์ ์๋ ์๋๋ฐ ๋ถ๋ฅด๋ ์ด๋ฆ์ ํ๋๋ ๋ชป ์ฐพ์ผ๋ฉด keyframes-unseen์ผ๋ก
์คํจํ๋ค(ํ์๊ฐ ์ฐ์ถ๋ฌผ ํํ๋ฅผ ๋์น ๊ฒฝ์ฐ). keyframes๋ ์ ๋๋ฉ์ด์
๋ ์๋ ์ฌ์ดํธ๋ ํต๊ณผํ๋ค โ
์ฒ์์ "๋ถ๋ฅด๋ ์ด๋ฆ 0๊ฐ๋ฉด ์คํจ"๋ก ๊ฑธ์๋ค๊ฐ bundleBudgets.test.ts์ ์ ๋๋ฉ์ด์
์๋ ํฝ์ค์ฒ
์ฌ์ดํธ๊ฐ ์คํจํด ์ขํ๋ค.
- ํ๋ก๋ธ: ์ค์ out/์์ "CSS keyframes ์ฐธ์กฐ 2๊ฐ ๋ชจ๋ ์ ์๋จ". out/ CSS์์ @Keyframes pulse
33๋ฐ์ดํธ๋ฅผ ์ง์ฐ๋ฉด keyframes-missing์ผ๋ก 100์ชฝ ์ ๋ถ๊ฐ ์คํจํ๊ณ (exit 1), ๋๋๋ฆฌ๋ฉด ํต๊ณผํ๋ค.
๋จ์ ํ
์คํธ๋ var() ํด์์ ๋นผ๊ฑฐ๋ ํจ์ ์ ๊ฑฐ๋ฅผ ๋นผ๋ฉด ์คํจํ๋ค.
- ๋น์ฉ: ๋ชจ๋ 189์คยทํ
์คํธ 119์ค, ๋น๋์ CSS ํ์ฑ(ํ์ด์ง๋ณ CSS ์กฐํฉ๋ง๋ค ํ ๋ฒ โ ์ง๊ธ์ ๋ ์กฐํฉ).
์ฌํ๊ฐ: 2027-04-22 โ ๊ทธ๋๊น์ง ๋น ์ง keyframes๋ฅผ ํ ๋ฒ๋ ์ก์ง ๋ชปํ์ผ๋ฉด ์ค์ด๊ฑฐ๋ ๋ด๋ฆฐ๋ค.
* fix(blog-content): keyframes ๊ฒ์ฌ๋ -webkit- ์ ๋์ฌ ์ ์ธ๋ ๋ถ๋ฅด๋ ์ด๋ฆ์ผ๋ก ์ผ๋ค
์ ์๋ `@-webkit-keyframes`๊น์ง ์ธ๋ฉด์ ๋ถ๋ฅด๋ ์ชฝ์ `-webkit-animation(-name)`์ ๋ณด์ง
์์, ์ ๋์ฌ ์ ์ธ๋ง์ผ๋ก ๋ถ๋ฅธ ์ด๋ฆ์ด ๊ฒ์ฌ์์ ๋น ์ก๋ค(๋ฏธํ ๋ฐฉํฅ). ์ง๊ธ out/์๋ ์ ๋์ฌ
์ ์ธ์ด ์๋ค.
๋จธ๋ฆฌ ์ฃผ์์ ๋ฒ์๋ฅผ ์ ๋๋ค โ ์ฒซ ๋ก๋ CSS ์์ ์ ์ธ๋ง ๋ณด๊ณ , ์ง์ฐ ๋ก๋ CSS์ JS๊ฐ ๋ฐํ์์
๊ณ ๋ฅด๋ ์ ๋๋ฉ์ด์
(์ธ๋ผ์ธ styleยทtoken.var)์ ๋ณด์ง ์๋๋ค. ํ์๋ Panda ์ตํฐ๋ง์ด์ ๋ ์ฌ์ฉ์ฒ๋ก
์ธ์ง ์์ผ๋ฏ๋ก ๋ ๋ค ๋์น๊ณ e2e๋ง ๋ณผ ์ ์๋ค.
* strict(blog-content): keyframes ๊ฒ์ฌ๋ ์ ์๊ฐ ์ ๋ถ ๋ถ๋ฆฌ๊ณ ํ์ด์ง CSS๋ฅผ ์ ๋ถ ์ฝ์ด์ผ ํต๊ณผํ๋ค
์์ฑ ๋์กฐ keyframes-unseen("์ ์๋ ์๋๋ฐ ๋ถ๋ฅด๋ ์ด๋ฆ์ด 0๊ฐ")์ ๋ ๊ท์น์ผ๋ก ๋ฐ๊พผ๋ค.
- keyframes-unreferenced: ์ ์๋๋๋ฐ ์ด๋ ํ์ด์ง์ ์ ์ธ๋ ๋ถ๋ฅด์ง ์๋ keyframes๊ฐ ์์ผ๋ฉด
์คํจํ๋ค. ๋ธ๋ก๊ทธ๋ ์ฐ์ง ์๋ keyframes๋ฅผ ๋น๋๊ฐ ์ง์ฐ๋ฏ๋ก(removeUnusedKeyframes) ๋จ์ ์ ์๋
์ ๋ถ ๋ถ๋ ค์ผ ํ๋ค. ์์ ์กฐ๊ฑด์ ์ด๋ฆ์ด ํ๋๋ผ๋ ๋ถ๋ฆฌ๋ฉด ํต๊ณผํด์, ํ์๊ฐ var() ๊ฒฝ์ ํํ๋ง
๋์น๋ฉด pulse๊ฐ ๋น ์ ธ๋ reading-progress-fill(์ง์ ์ ์ธ) ํ๋๋ก ํต๊ณผํ๋ค โ ์ด ๊ฐ๋๊ฐ ๋ง์ผ๋ ค๋
๋ฐ๋ก ๊ทธ ๊ฒฝ์ฐ๋ค. ์ตํฐ๋ง์ด์ ๋ฅผ ๋๋ฉด ์ด ๊ท์น์ด ๋จผ์ ์คํจํ๋ค.
- keyframes-unread: ํ์ด์ง๊ฐ ๋ถ๋ฅด๋ CSS๋ฅผ ์ฝ์ง ๋ชปํ๋ฉด ์คํจํ๋ค. ์์ ์ ๋ชป ์ฝ์ ํ์ผ์ ๋น
๋ฌธ์์ด๋ก ํฉ์ณ์, check-bundle์ ๊ฒฝ๋ก ํด์์ด ์ด๊ธ๋๋ฉด ์ ์ยท์ฐธ์กฐ๊ฐ ๋ ๋ค 0๊ฐ๊ฐ ๋์ด "๋ณผ ๊ฒ
์์"์ผ๋ก ํต๊ณผํ๋ค.
ํ๋ก๋ธ(์ค์ out/, ์๋ณต ํ์ธ): ๊ทธ๋๋ก๋ฉด ํต๊ณผ. CSS์์ `animation:var(--animations-pulse)`๋ง
์ง์ฐ๋ฉด keyframes-unreferenced: pulse. ์์ CSS ํ์ผ์ ์ง์ฐ๋ฉด keyframes-unread(์์ฐ์
asset-missing๊ณผ ํจ๊ป). ๋จ์ ํ
์คํธ๋ ๋ ๊ท์น์ ๊ฐ๊ฐ ๋๋ฉด ์คํจํ๋ค.
---------
Co-authored-by: Claude <noreply@anthropic.com>
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.
Closes #3991
Missing token references inside style strings previously passed linting silently. This PR reports them through
no-invalid-token-pathsand emitsunknown_token_referencewarnings during source builds.Behavior and diagnostic policy
{โฆ}and stringtoken(โฆ)references, including nested fallbacks and opacity modifiers, in actual style sections. Recipe names, variant selectors, factory metadata, and non-style pattern props are excluded.token(sizes.ghost, 10px)emits valid CSS using10px, but the requested theme token is absent. This is intentional for both lint and source-build warnings.extraction-diagnosticsexcludes this warning to avoid duplicate lint reports.Design and included tooling changes
pandacss_systemselects style sections for both inspection and build token diagnostics. Inspection adds source locations without constructing synthetic extractor calls. Recipe ownership checks borrow the compiled variant sets, and inspection reuses its existingLineIndex.Pattern props are checked by declared type:
propertyandtokenprops accept references; text, enum, and boolean props do not. Undeclared props use native CSS and configured utility metadata.This PR also includes these inspection changes:
keyframes()stops contribute to usage inspection.prefer-tokento check them.gapis not counted as a separate pattern.styled(...)andstyled.div(...).The token scanner also fixes a CSS expansion boundary: longer names such as
my-token(...)and URLs containingmytoken(...)remain unchanged. Standalonetoken(...)still expands. A newpandacss_stylesheetsnapshot covers the emitted CSS; existing CSS snapshots are unchanged.Measured build cost
Style paths now borrow object keys and retain numeric array indexes in inline storage. Inspection creates owned lookup keys only after finding a reference. Strings without
{ortoken(skip the reference scanner.The native
sandbox_vite_tsharness compared the PR base (8c179ea85), previous PR (cc930bdd3), and optimized PR using 220 amplified files, seven rounds rotating order, three warmups, and 20 iterations per round. Values are medians of round averages.The optimization saves about 0.53 ms per cold build versus the previous implementation, leaving about 0.37 ms overhead versus the base. Cold timings include outliers; watch-total differences are small relative to observed variation. This measures the combined optimization, not each change independently. All builds produced 149 atoms and 11,456 CSS bytes.
Measured with Rust 1.93.0 release builds on macOS arm64, using
sandbox_vite_ts --multiplier 20 --unique --warm 3 --iterations 20. File I/O was excluded, no builds or tests ran concurrently, and other desktop processes were uncontrolled. The corpus contained 433,450 source bytes; config was the harnessโs sandbox-shaped config. Cold-build standard deviations across round averages were 1.24 ms (base), 0.08 ms (previous PR), and 1.34 ms (optimized). These results do not establish an overhead bound for other projects.Validation
pnpm rust:test: 3,589 tests passed, plus doc tests.pnpm rust:fmtandpnpm rust:clippy: passed.pnpm test:compiler: rebuilt the native binding; 752 tests passed.Still outside this PR: missing-reference warnings in config
globalCss/config recipes, the existing missing-token opacity emission issue, andprefer-tokenclassifying a whole-value broken brace reference as a hardcoded value.