Skip to content

fix(css_analyze): ignore at-rules supporting descriptors#8819

Merged
Netail merged 3 commits intobiomejs:mainfrom
Netail:fix/ignore-at-rules-supporting-discriptors
Jan 23, 2026
Merged

fix(css_analyze): ignore at-rules supporting descriptors#8819
Netail merged 3 commits intobiomejs:mainfrom
Netail:fix/ignore-at-rules-supporting-discriptors

Conversation

@Netail
Copy link
Member

@Netail Netail commented Jan 20, 2026

Summary

Closes #6567, ignore unknown properties if located in at-rules supporting descriptors

Test Plan

Unit test

Docs

@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2026

🦋 Changeset detected

Latest commit: 7dfd40f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch
@biomejs/prettier-compare Patch

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

@github-actions github-actions bot added A-Linter Area: linter L-CSS Language: CSS labels Jan 20, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 20, 2026

Merging this PR will degrade performance by 15.64%

❌ 5 regressed benchmarks
✅ 24 untouched benchmarks
⏩ 126 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
css_analyzer[bootstrap_18416142857265205439.css] 478.9 ms 515.6 ms -7.11%
css_analyzer[bulma_5641719244145477318.css] 1.1 s 1.2 s -8.92%
css_analyzer[foundation_11602414662825430680.css] 165.4 ms 191.3 ms -13.54%
css_analyzer[tachyons_11778168428173736564.css] 123.4 ms 140.9 ms -12.41%
css_analyzer[pure_9395922602181450299.css] 17.1 ms 20.3 ms -15.64%

Comparing Netail:fix/ignore-at-rules-supporting-discriptors (7dfd40f) with main (b08270b)2

Open in CodSpeed

Footnotes

  1. 126 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (ad283bb) during the generation of this report, so b08270b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

Broads the noUnknownProperty lint to detect any AnyCssAtRule ancestor and, unless that ancestor is one of the explicitly enumerated descriptor-supporting at-rules, treat the context as supporting descriptors and skip reporting unknown properties. Adds a new public node union AnyDescriptorSupportingAtRules (union of TwApplyAtRule, CssContainerAtRule, CssLayerAtRule, CssMediaAtRule, CssScopeAtRule, CssStartingStyleAtRule, CssSupportsAtRule), updates imports, and adds tests (valid/invalid at-rule cases) plus a changeset entry. No other public APIs changed.

Possibly related PRs

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: modifying CSS analysis to ignore at-rules supporting descriptors in the noUnknownProperty rule.
Description check ✅ Passed The description accurately relates to the changeset, referencing issue #6567 and explaining the intent to ignore unknown properties in descriptor-supporting at-rules with a test plan.
Linked Issues check ✅ Passed The code changes directly address issue #6567 by modifying noUnknownProperty to ignore declarations within at-rules supporting descriptors, with new test cases validating the behaviour.
Out of Scope Changes check ✅ Passed All changes are focused on the noUnknownProperty rule and related tests; formatting updates in valid.css and test configuration files are incidental and appropriately scoped.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/biome_css_analyze/src/lint/correctness/no_unknown_property.rs`:
- Around line 82-101: The current ancestor check for
is_at_rule_supporting_descriptors uses an exclusion-style test (AnyCssAtRule
with a list of denied kinds) and thus incorrectly treats most at-rules as
descriptor-supporting; change it to an inclusive allow-list that returns true
only when an ancestor.kind() is one of the known descriptor-supporting at-rules
(e.g. match AnyCssAtRule::can_cast(ancestor.kind()) and then explicitly check
for the allowed kinds such as the enum variants representing `@font-face`,
`@font-feature-values`, `@property`, `@counter-style`, and `@viewport`), otherwise
return false; update the is_at_rule_supporting_descriptors computation (and any
references to it) so validation is skipped only for those allowed at-rules.

@Netail Netail force-pushed the fix/ignore-at-rules-supporting-discriptors branch from d7fe7c9 to 6a8ba12 Compare January 20, 2026 18:52
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should address the parsing diagnostics

Comment on lines 82 to 95
let is_at_rule_supporting_descriptors = node.syntax().ancestors().any(|ancestor| {
if AnyCssAtRule::can_cast(ancestor.kind())
&& !(TwApplyAtRule::can_cast(ancestor.kind())
|| CssContainerAtRule::can_cast(ancestor.kind())
|| CssLayerAtRule::can_cast(ancestor.kind())
|| CssMediaAtRule::can_cast(ancestor.kind())
|| CssScopeAtRule::can_cast(ancestor.kind())
|| CssStartingStyleAtRule::can_cast(ancestor.kind())
|| CssSupportsAtRule::can_cast(ancestor.kind()))
{
return true;
}

false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • why did we remove skip()?
  • in these cases, it's best to create a new node via declare_node_union. The code becomes more readable


```

_Note: The parser emitted 2 diagnostics which are not shown here._
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems important. There are parsing errors, and I believe you don't want to test broken syntax

Copy link
Member Author

@Netail Netail Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, didn't notice. Some syntax that would be valid with scss 😅

@Netail Netail requested a review from ematipico January 21, 2026 09:59
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A couple of things to address

}

declare_node_union! {
pub DescriptorSupportingAtRules = TwApplyAtRule | CssContainerAtRule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub DescriptorSupportingAtRules = TwApplyAtRule | CssContainerAtRule
pub AnyDescriptorSupportingAtRules = TwApplyAtRule | CssContainerAtRule

As per internal coding guidelines, all unions must start with Any*

"@biomejs/biome": patch
---

Fixed [#6567](https://github.com/biomejs/biome/issues/6567). Ignore unknown properties in at-rules which support descriptors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to mention the rule. Without clicking the issue, there's little context, and it gets difficult to understand what's been fixed and where

@Netail Netail merged commit bc191ff into biomejs:main Jan 23, 2026
17 of 18 checks passed
@Netail Netail deleted the fix/ignore-at-rules-supporting-discriptors branch January 23, 2026 10:46
@github-actions github-actions bot mentioned this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 CSS font-feature-values rules are not ignored by noUnknownProperty

2 participants