Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/social-groups-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

The [noUnknownProperty](https://biomejs.dev/linter/rules/no-unknown-property/) now only ignores `composes` property when `cssModules` is enabled in parser settings
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ impl Rule for NoUnknownProperty {
let property_name = node.name().ok()?.to_trimmed_text();
let property_name_lower = property_name.to_ascii_lowercase_cow();
if !property_name_lower.starts_with("--")
// Ignore `composes` property.
// See https://github.com/css-modules/css-modules/blob/master/docs/composition.md for more details.
&& property_name_lower != "composes"
&& !is_known_properties(&property_name_lower)
&& !vendor_prefixed(&property_name_lower)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ a {
a {
my-property: 1;
}

/* Composition is only valid when css-modules is enabled */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ a {
my-property: 1;
}

/* Composition is only valid when css-modules is enabled */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}

```

# Diagnostics
Expand Down Expand Up @@ -51,3 +62,21 @@ invalid.css:6:3 lint/correctness/noUnknownProperty ━━━━━━━━━


```

```
invalid.css:16:3 lint/correctness/noUnknownProperty ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Unknown property is not allowed.

15 │ .classB {
> 16 │ composes: classA;
│ ^^^^^^^^
17 │ color: yellow;
18 │ }

i See CSS Specifications and browser specific properties for more details.

i To resolve this issue, replace the unknown property with a valid CSS property.


```
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ a {
--custom-property: 10px;
}

/* Composition */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}

/* View Transition navigation property (should not be flagged) */
view-transition {
navigation: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ a {
--custom-property: 10px;
}

/* Composition */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}

/* View Transition navigation property (should not be flagged) */
view-transition {
navigation: auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* should not generate diagnostics */
/* Composition */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
expression: validCssModulesComposition.css
---
# Input
```css
/* should not generate diagnostics */
/* Composition */
.classA {
color: green;
background: red;
}

.classB {
composes: classA;
color: yellow;
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"css": {
"parser": {
"cssModules": true
}
}
}
Loading