-
Notifications
You must be signed in to change notification settings - Fork 0
fix: migrate to @eslint/css-tree to support CSS variables (var()) #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replace css-tree with @eslint/css-tree v3.6.6 - Add var() detection to skip validation for CSS custom properties - Update all imports across 8 files - Fix TypeScript types for walk() callbacks - Remove @types/css-tree dependency Resolves issue where properties containing var() would report validation errors even though expansion was successful. CSS variables are runtime values that cannot be validated at parse time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates from the original css-tree library to @eslint/css-tree v3.6.6 to add support for CSS custom properties using var(). The migration addresses a validation issue where properties containing var() would incorrectly report errors even though expansion was successful, since CSS variables are runtime values that cannot be validated at parse time.
Key changes:
- Migrated from
css-treepeer dependency to@eslint/css-treev3.6.6 as a regular dependency - Added
containsVar()helper function to detect and skip validation for declarations with CSS variables - Fixed TypeScript types for
walk()callbacks by changing parameter type fromcsstree.Valuetocsstree.CssNodewith type guards
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| package.json | Changed from peerDependency css-tree to regular dependency @eslint/css-tree, removed @types/css-tree |
| pnpm-lock.yaml | Updated package resolutions and dependencies, mdn-data bumped from 2.12.2 to 2.23.0 |
| src/core/validate.ts | Added containsVar() function and logic to skip validation for declarations containing CSS variables |
| src/internal/layer-parser-utils.ts | Updated import and fixed walk callback types |
| src/internal/is-value-node.ts | Updated type import |
| src/handlers/transition/transition-layers.ts | Updated import and fixed walk callback types |
| src/handlers/mask/mask-layers.ts | Updated import and fixed walk callback types |
| src/handlers/grid/expand.ts | Updated import and fixed walk callback types |
| src/handlers/background/background-layers.ts | Updated import and fixed walk callback types |
| src/handlers/animation/animation-layers.ts | Updated import and fixed walk callback types |
| docs.llm/llm_src.txt | Documentation file reflecting source code changes |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
src/core/validate.ts:5
- The documentation comment still references 'css-tree library' but should be updated to '@eslint/css-tree' to reflect the migration.
* This function parses CSS using the css-tree library and validates each CSS property
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/core/validate.ts
Outdated
|
|
||
| /** | ||
| * Checks if a CSS value node contains var() function. | ||
| * CSS variables cannot be validated by css-tree as they are runtime values. |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment references 'css-tree' but should be updated to '@eslint/css-tree' for consistency with the migration.
| * CSS variables cannot be validated by css-tree as they are runtime values. | |
| * CSS variables cannot be validated by @eslint/css-tree as they are runtime values. |
- Update bundle size: ~68KB (ESM), ~73KB (CJS) minified + brotli - Remove css-tree from installation (now bundled dependency) - Update test count: 973 tests - Update acknowledgments to @eslint/css-tree - Add accurate performance metrics
- Keep @eslint/css-tree link to upstream repo - Add b_values link for CSS value expansion/validation work
Resolves issue where properties containing var() would report validation
errors even though expansion was successful. CSS variables are runtime
values that cannot be validated at parse time.