Skip to content

Commit

Permalink
fix(biome-css-parser): incorrect option name in hint when using `:glo…
Browse files Browse the repository at this point in the history
…bal` in CSS module (#3420)
  • Loading branch information
shulaoda authored Jul 12, 2024
1 parent 48387f6 commit 2691f52
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions crates/biome_css_parser/src/syntax/at_rule/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ fn expected_at_rule_declaration_clause(p: &CssParser, range: TextRange) -> Parse
///
/// This function returns an error diagnostic indicating that the @value at-rule
/// is not a standard CSS feature. It also provides a hint on how to enable
/// parsing of @value at-rules by setting the `css_modules` option to `true`
/// parsing of @value at-rules by setting the `css.parser.cssModules` option to `true`
/// in the configuration file.
pub(crate) fn value_at_rule_not_allowed(p: &CssParser, range: TextRange) -> ParseDiagnostic {
p.err_builder(
"@value at-rule is not a standard CSS feature.",
range,
)
.with_hint(
"You can enable @value at-rule parsing by setting the `css_modules` option to `true` in your configuration file.",
"You can enable @value at-rule parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.",
)
}
8 changes: 4 additions & 4 deletions crates/biome_css_parser/src/syntax/css_modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ pub(crate) const CSS_MODULES_SCOPE_SET: TokenSet<CssSyntaxKind> = token_set![T![
///
/// This function returns an error diagnostic indicating that the `:local` or `:global` pseudo-classes
/// are not standard CSS features. It also provides a hint on how to enable
/// parsing of these pseudo-classes by setting the `css_modules` option to `true`
/// parsing of these pseudo-classes by setting the `css.parser.cssModules` option to `true`
/// in the configuration file.
pub(crate) fn local_or_global_not_allowed(p: &CssParser, range: TextRange) -> ParseDiagnostic {
p.err_builder(
"`:local` and `:global` pseudo-classes are not standard CSS features.",
range,
)
.with_hint(
"You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.",
"You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.",
)
}

Expand All @@ -30,14 +30,14 @@ pub(crate) fn expected_any_css_module_scope(p: &CssParser, range: TextRange) ->
///
/// This function returns an error diagnostic indicating that the `composes` declaration
/// is not a standard CSS feature. It also provides a hint on how to enable parsing of the
/// `composes` declaration by setting the `css_modules` option to `true` in the configuration file.
/// `composes` declaration by setting the `css.parser.cssModules` option to `true` in the configuration file.
pub(crate) fn composes_not_allowed(p: &CssParser, range: TextRange) -> ParseDiagnostic {
p.err_builder(
"`composes` declaration is not a standard CSS feature.",
range,
)
.with_hint(
"You can enable `composes` declaration parsing by setting the `css_modules` option to `true` in your configuration file.",
"You can enable `composes` declaration parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.",
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) fn is_at_pseudo_class_function_selector(p: &mut CssParser) -> bool {
/// Parses a pseudo-class function selector for CSS Modules.
///
/// This function parses a pseudo-class function selector, specifically `:local` or `:global`, in CSS Modules.
/// If the `css_modules` option is not enabled, it generates a diagnostic error and skips the selector.
/// If the `css.parser.cssModules` option is not enabled, it generates a diagnostic error and skips the selector.
/// ```css
/// :local(.className) {
/// color: red;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/biome_css_parser/tests/spec_test.rs
assertion_line: 169
expression: snapshot
---
## Input
Expand Down Expand Up @@ -358,7 +359,7 @@ at_rule_keyframe_disabled_css_modules.css:3:13 parse ━━━━━━━━━
4 │ @keyframes :local("test") {}
5 │ @keyframes :local test {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -371,7 +372,7 @@ at_rule_keyframe_disabled_css_modules.css:4:13 parse ━━━━━━━━━
5 │ @keyframes :local test {}
6 │ @keyframes :local "test" {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -384,7 +385,7 @@ at_rule_keyframe_disabled_css_modules.css:5:13 parse ━━━━━━━━━
6 │ @keyframes :local "test" {}
7 │ @keyframes :global(test) {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -397,7 +398,7 @@ at_rule_keyframe_disabled_css_modules.css:6:13 parse ━━━━━━━━━
7 │ @keyframes :global(test) {}
8 │ @keyframes :global("test") {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -410,7 +411,7 @@ at_rule_keyframe_disabled_css_modules.css:7:13 parse ━━━━━━━━━
8 │ @keyframes :global("test") {}
9 │ @keyframes :global test {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:8:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -423,7 +424,7 @@ at_rule_keyframe_disabled_css_modules.css:8:13 parse ━━━━━━━━━
9 │ @keyframes :global test {}
10 │ @keyframes :global "test" {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:9:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -436,7 +437,7 @@ at_rule_keyframe_disabled_css_modules.css:9:13 parse ━━━━━━━━━
10 │ @keyframes :global "test" {}
11
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_keyframe_disabled_css_modules.css:10:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -448,6 +449,6 @@ at_rule_keyframe_disabled_css_modules.css:10:13 parse ━━━━━━━━
^^^^^^
11
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/biome_css_parser/tests/spec_test.rs
assertion_line: 169
expression: snapshot
---
## Input
Expand Down Expand Up @@ -104,7 +105,7 @@ at_rule_value_disabled.css:1:2 parse ━━━━━━━━━━━━━━
2 │ @value common-gradient: transparent 75%, var(--ring-line-color) 75%, currentColor 79%;
3 │
i You can enable @value at-rule parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable @value at-rule parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
at_rule_value_disabled.css:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -115,6 +116,6 @@ at_rule_value_disabled.css:2:2 parse ━━━━━━━━━━━━━━
│ ^^^^^
3 │
i You can enable @value at-rule parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable @value at-rule parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/biome_css_parser/tests/spec_test.rs
assertion_line: 169
expression: snapshot
---
## Input
Expand Down Expand Up @@ -266,7 +267,7 @@ composes_error_disabled.css:2:2 parse ━━━━━━━━━━━━━━
3 │ }
4
i You can enable `composes` declaration parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `composes` declaration parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
composes_error_disabled.css:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -278,7 +279,7 @@ composes_error_disabled.css:6:2 parse ━━━━━━━━━━━━━━
7 │ }
8
i You can enable `composes` declaration parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `composes` declaration parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
composes_error_disabled.css:10:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -290,6 +291,6 @@ composes_error_disabled.css:10:2 parse ━━━━━━━━━━━━━
11 │ }
12
i You can enable `composes` declaration parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `composes` declaration parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/biome_css_parser/tests/spec_test.rs
assertion_line: 169
expression: snapshot
---
## Input
Expand Down Expand Up @@ -193,7 +194,7 @@ pseudo_class_function_selector_disabled.css:1:2 parse ━━━━━━━━
2 │ :local(.class div + #id) {}
3 │ :global(.class div) .div {}
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
pseudo_class_function_selector_disabled.css:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -205,7 +206,7 @@ pseudo_class_function_selector_disabled.css:2:2 parse ━━━━━━━━
3 │ :global(.class div) .div {}
4
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
pseudo_class_function_selector_disabled.css:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand All @@ -217,6 +218,6 @@ pseudo_class_function_selector_disabled.css:3:2 parse ━━━━━━━━
^^^^^^
4
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css_modules` option to `true` in your configuration file.
i You can enable `:local` and `:global` pseudo-class parsing by setting the `css.parser.cssModules` option to `true` in your configuration file.
```

0 comments on commit 2691f52

Please sign in to comment.