fix(css): add missing CSS functions to noUnknownFunction#8926
fix(css): add missing CSS functions to noUnknownFunction#8926andre-lmarinho wants to merge 3 commits intobiomejs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 9b6f999 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 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 |
WalkthroughAdds four CSS function names — contrast-color, dynamic-range-limit-mix, progress, and superellipse — to the FUNCTION_KEYWORDS constant in the Biome CSS analyser. Adds corresponding valid tests to noUnknownFunction and a changeset patch entry for the Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@crates/biome_css_analyze/src/keywords.rs`:
- Around line 681-685: The FUNCTION_KEYWORDS array is out of alphabetical order:
the entry "if" must come before the "image", "image-rect", and "image-set"
entries to satisfy test_function_keywords_sorted; update the FUNCTION_KEYWORDS
definition by moving "if" so the list is alphabetically sorted (ensure the
symbol FUNCTION_KEYWORDS is updated accordingly).
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Question for ReviewersI noticed that adding tests for these five new functions increased the parser diagnostic count from 3 to 5 in the -Note: The parser emitted 3 diagnostics which are not shown here. This suggests that some of the new CSS functions I added may have syntax that the Biome CSS parser doesn't fully recognize yet. The functions themselves are now recognized by Questions:
I'm happy to modify the PR based on your guidance. Let me know which approach you prefer. |
|
Are you really asking us questions via claude code? Damn, that's so demoralising... We shouldn't increase the diagnostics, so make sure the parser is correct |
ematipico
left a comment
There was a problem hiding this comment.
Blocking, since the issue is in the parser, not the linter only
|
I removed the functions both from the tests and from the keyword list, so there’s nothing in the codebase without proper parser support / coverage. Do you want me to document this function as an Issue? |
|
Why was |
|
It's a valid CSS function. Doc | compatibility But, tbh I'm not sure that this was the right way to implement it. Rust is not my expertise, just trying to help here. |
Summary
This PR extends the
noUnknownFunctionCSS linter rule to recognize five additional modern CSS functions that were previously being flagged as unknown:contrast-color()- Calculates a contrasting color valuedynamic-range-limit-mix()- Mixes dynamic range limits for HDR contentprogress()- Progress notation for scroll-driven animationssuperellipse()- Defines corner shapes using superellipse curvesMotivation: Similar to PR #8924 which added
sibling-count()andsibling-index(), these are valid CSS functions defined in various CSS specification modules (CSS Color Module Level 5, CSS Values and Units Module Level 5, CSS Borders Module Level 4). Currently, Biome incorrectly reports these as unknown functions, causing false positives in projects using modern CSS features.Related: This extends the work from #8920 to cover additional CSS functions that have emerged in recent specifications.
Browser Compatibility
contrast-color()dynamic-range-limit-mix()progress()superellipse()Note: While some of these functions are marked as experimental and have limited browser support, they are part of official CSS specifications. Including them in Biome's function list allows developers working with cutting-edge CSS features or progressive enhancement to avoid false positives in linting.
Documentation
contrast-color()- CSS Color Module Level 5dynamic-range-limit-mix()- CSS Color HDR Moduleprogress()- CSS Values and Units Module Level 5superellipse()- CSS Borders Module Level 4Changeset
A changeset has been created in
.changeset/brave-lions-smile.md.Test Plan
Added test cases for all five functions in
valid.css:The functions were added to the
FUNCTION_KEYWORDSarray inkeywords.rsin alphabetical order, following the existing pattern.When tests are run, these functions should no longer trigger the
noUnknownFunctiondiagnostic.Docs
No additional documentation needed - this is an additive change to the existing
noUnknownFunctionrule's keyword list. The rule behavior remains unchanged; it simply recognizes additional valid CSS functions.Disclaimer!
This PR was created with AI assistance (Claude Code). Claude Code was used to explore the repository structure and review existing CSS functions. The results were then manually validated against the official MDN documentation to confirm accuracy and identify gaps.