Skip to content

Commit

Permalink
fix(lint/noUnknownProperty): ignore composes for noUnknownProperty (#…
Browse files Browse the repository at this point in the history
…3217)

Co-authored-by: Ze-Zheng Wu <zezhengwu@proton.me>
  • Loading branch information
chansuke and Sec-ant committed Jun 18, 2024
1 parent 6f8cab7 commit 1cdfefc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Sec-ant

- The [noUnknownProperty](https://biomejs.dev/linter/rules/no-unknown-property/) rule now ignores the `composes` property often used in css modules. [#3000](https://github.com/biomejs/biome/issues/3000) Contributed by @chansuke

### Parser

## v1.8.1 (2024-06-10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ impl Rule for NoUnknownProperty {
let node = ctx.query();
let property_name = node.name().ok()?.text().to_lowercase();
if !property_name.starts_with("--")
// Ignore `composes` property.
// See https://github.com/css-modules/css-modules/blob/master/docs/composition.md for more details.
&& property_name != "composes"
&& !is_known_properties(&property_name)
&& !vendor_prefixed(&property_name)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ a {
a {
--custom-property: 10px;
}

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

.classB {
composes: classA;
color: yellow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,15 @@ a {
--custom-property: 10px;
}
/* Composition */
.classA {
color: green;
background: red;
}
.classB {
composes: classA;
color: yellow;
}
```

0 comments on commit 1cdfefc

Please sign in to comment.