Skip to content

Commit 5bd2772

Browse files
committed
fix(parse/css/tailwind): make @custom-variant accept at-rules like @media
1 parent 53ddb17 commit 5bd2772

File tree

110 files changed

+27641
-18747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+27641
-18747
lines changed

.changeset/forty-nails-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
The CSS Parser, with `tailwindDirectives` enabled, will now accept at rules like `@media` and `@supports` in `@custom-variant` shorthand syntax.

crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use biome_analyze::{
77
};
88
use biome_console::markup;
99
use biome_css_syntax::{
10-
AnyCssAtRule, AnyCssGenericComponentValue, AnyCssValue, CssAtRule,
11-
CssGenericComponentValueList, CssGenericProperty, CssSyntaxKind,
10+
AnyCssAtRuleWithDeclarationBlockDeclarator, AnyCssGenericComponentValue, AnyCssValue,
11+
CssAtRule, CssGenericComponentValueList, CssGenericProperty, CssSyntaxKind,
1212
};
1313
use biome_diagnostics::Severity;
1414
use biome_rowan::{AstNode, SyntaxNodeCast, TextRange};
@@ -156,7 +156,14 @@ fn is_in_font_face_at_rule(node: &CssGenericProperty) -> bool {
156156
.find(|n| n.kind() == CssSyntaxKind::CSS_AT_RULE)
157157
.and_then(|n| n.cast::<CssAtRule>())
158158
.and_then(|n| n.rule().ok())
159-
.is_some_and(|n| matches!(n, AnyCssAtRule::CssFontFaceAtRule(_)))
159+
.and_then(|n| n.as_css_at_rule_with_declaration_block().cloned())
160+
.and_then(|n| n.declarator().ok())
161+
.is_some_and(|n| {
162+
matches!(
163+
n,
164+
AnyCssAtRuleWithDeclarationBlockDeclarator::CssFontFaceAtRuleDeclarator(_)
165+
)
166+
})
160167
}
161168

162169
fn is_shorthand_font_property_with_keyword(properties: &CssGenericComponentValueList) -> bool {

0 commit comments

Comments
 (0)