Skip to content

Commit

Permalink
fix(linter): noUnknownFunction support calc-size function (#4283)
Browse files Browse the repository at this point in the history
  • Loading branch information
fireairforce authored Oct 14, 2024
1 parent 2342984 commit 6e1170e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Conaclos

- [noUnknownFunction](https://biomejs.dev/linter/rules/no-unknown-function/) correctly handles `calc-size` function ([#4212](https://github.com/biomejs/biome/issues/4212)).

The following code `calc-size` is no longer reported as unknown:

```css
.a { height: calc-size(0px); }
```

Contributed by @fireairforce

### Parser

#### Bug Fixes
Expand Down
16 changes: 15 additions & 1 deletion crates/biome_css_analyze/src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub const LINE_HEIGHT_KEYWORDS: [&str; 1] = ["normal"];

/// List of known CSS value functions sourced from [`css-functions-list`](https://www.npmjs.com/package/css-functions-list).
/// See the original list [here](https://github.com/niksy/css-functions-list/blob/master/index.json).
pub const FUNCTION_KEYWORDS: [&str; 671] = [
pub const FUNCTION_KEYWORDS: [&str; 685] = [
"-moz-abs",
"-moz-acos",
"-moz-anchor",
Expand All @@ -98,6 +98,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-moz-blur",
"-moz-brightness",
"-moz-calc",
"-moz-calc-size",
"-moz-character-variant",
"-moz-circle",
"-moz-clamp",
Expand Down Expand Up @@ -190,6 +191,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-moz-scroll",
"-moz-selector",
"-moz-sepia",
"-moz-shape",
"-moz-sign",
"-moz-sin",
"-moz-skew",
Expand Down Expand Up @@ -233,6 +235,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-ms-blur",
"-ms-brightness",
"-ms-calc",
"-ms-calc-size",
"-ms-character-variant",
"-ms-circle",
"-ms-clamp",
Expand Down Expand Up @@ -264,6 +267,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-ms-hwb",
"-ms-hypot",
"-ms-image",
"-ms-image-rect",
"-ms-image-set",
"-ms-inset",
"-ms-invert",
Expand Down Expand Up @@ -324,6 +328,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-ms-scroll",
"-ms-selector",
"-ms-sepia",
"-ms-shape",
"-ms-sign",
"-ms-sin",
"-ms-skew",
Expand Down Expand Up @@ -367,6 +372,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-o-blur",
"-o-brightness",
"-o-calc",
"-o-calc-size",
"-o-character-variant",
"-o-circle",
"-o-clamp",
Expand Down Expand Up @@ -398,6 +404,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-o-hwb",
"-o-hypot",
"-o-image",
"-o-image-rect",
"-o-image-set",
"-o-inset",
"-o-invert",
Expand Down Expand Up @@ -458,6 +465,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-o-scroll",
"-o-selector",
"-o-sepia",
"-o-shape",
"-o-sign",
"-o-sin",
"-o-skew",
Expand Down Expand Up @@ -501,6 +509,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-webkit-blur",
"-webkit-brightness",
"-webkit-calc",
"-webkit-calc-size",
"-webkit-character-variant",
"-webkit-circle",
"-webkit-clamp",
Expand Down Expand Up @@ -532,6 +541,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-webkit-hwb",
"-webkit-hypot",
"-webkit-image",
"-webkit-image-rect",
"-webkit-image-set",
"-webkit-inset",
"-webkit-invert",
Expand Down Expand Up @@ -592,6 +602,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"-webkit-scroll",
"-webkit-selector",
"-webkit-sepia",
"-webkit-shape",
"-webkit-sign",
"-webkit-sin",
"-webkit-skew",
Expand Down Expand Up @@ -635,6 +646,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"blur",
"brightness",
"calc",
"calc-size",
"character-variant",
"circle",
"clamp",
Expand Down Expand Up @@ -666,6 +678,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"hwb",
"hypot",
"image",
"image-rect",
"image-set",
"inset",
"invert",
Expand Down Expand Up @@ -726,6 +739,7 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"scroll",
"selector",
"sepia",
"shape",
"sign",
"sin",
"skew",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ a { min-width: anchor-size(--button width); }
a { transform: color.adjust(1px); transform: rgb(color.adjust(1px)); }
a { color: light-dark(#777, #000); }
a { offset-path: xywh(20px 30% 150% 200%); }
a { animation-timing-function: linear(0, 0.25, 1); }
a { animation-timing-function: linear(0, 0.25, 1); }
a { height: calc-size(0px); }
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ a { transform: color.adjust(1px); transform: rgb(color.adjust(1px)); }
a { color: light-dark(#777, #000); }
a { offset-path: xywh(20px 30% 150% 200%); }
a { animation-timing-function: linear(0, 0.25, 1); }
a { height: calc-size(0px); }
```

0 comments on commit 6e1170e

Please sign in to comment.