Repository navigation
fix(eslint-plugin): accept negative and opacity-modified tokens in prefer-token - #3968
Merged
Merged
Conversation
โฆefer-token resolveUtilityValue() now reports the tokens Panda resolved for a value, recorded during resolution, so prefer-token no longer guesses from the CSS string. Closes #3963
๐ฆ Changeset detectedLatest commit: 0a501e4 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 tasks
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 branch was successfully deployed
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 #3963
Symptom
@pandacss/prefer-tokenreported real tokens as hardcoded values:marginTop: '-2'/outlineOffset: '-2'โcalc(var(--spacing-2) * -1)color: 'red.500/40'โcolor-mix(โฆ)Cause
The rule treated a value as a token only when its CSS started with
var(.Fix
resolveUtilityValue()now returnstokens: string[], the tokens Panda resolved for the value. The resolver records them while it resolves, instead of re-parsing the output:{path}/token(path, fallback)expansion records each token it substitutes, including tokens in atoken()fallbacktheme('spacing')) fall back to an exact reverse lookup by style referenceprefer-tokenflags a value only when it resolves to no token and isn't a CSS custom property.Behavior notes
1px solid {colors.red.500}) now pass.calc(var(--spacing-2) * 2)) still counts as hardcoded. Use{spacing.2}.Tests
token()fallbacks, and handwritten varsresolveUtilityValuetest)