From e936902d42a020685ac5edc6c0a403379791f5d5 Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Fri, 15 Nov 2024 16:06:03 +0800 Subject: [PATCH] fix(noUnknownPseudoClass): not error for pseudo class after webkit scrollbar element (#4543) --- CHANGELOG.md | 13 +++++++++++++ .../src/lint/nursery/no_unknown_pseudo_class.rs | 1 + .../specs/nursery/noUnknownPseudoClass/valid.css | 3 ++- .../nursery/noUnknownPseudoClass/valid.css.snap | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2d0c137ca1b..c6983eb39178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,10 +45,23 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b ### Bug fixes - Fix [#4121](https://github.com/biomejs/biome/issues/4326), don't ident a CSS selector when has leading comments. Contributed by @fireairforce + - Fix [#4334](https://github.com/biomejs/biome/issues/4334), don't insert trailing comma on type import statement. Contributed by @fireairforce + - Fix [#3229](https://github.com/biomejs/biome/issues/3229), where Biome wasn't idempotent when block comments were placed inside compound selectors. Contributed by @ematipico + - Fix [#4026](https://github.com/biomejs/biome/issues/4026), don't move comments in `grid-template`. Contributed by @fireairforce +- Fix [#4533](URL_ADDRESS.com/biomejs/biome/issues/4533), don't throw error when pseudeo class after a webkit scrollbar pseudeo element. + + The follow code will not report: + + ```css + ::-webkit-scrollbar-thumb:hover {} + ``` + + Contributed by @fireairforce + ### JavaScript APIs ### Linter diff --git a/crates/biome_css_analyze/src/lint/nursery/no_unknown_pseudo_class.rs b/crates/biome_css_analyze/src/lint/nursery/no_unknown_pseudo_class.rs index c42262b81c15..cd6c89598a13 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_unknown_pseudo_class.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_unknown_pseudo_class.rs @@ -176,6 +176,7 @@ impl Rule for NoUnknownPseudoClass { PseudoClassType::PagePseudoClass => is_page_pseudo_class(lower_name), PseudoClassType::WebkitScrollbarPseudoClass => { WEBKIT_SCROLLBAR_PSEUDO_CLASSES.contains(&lower_name) + || is_known_pseudo_class(lower_name) } PseudoClassType::Other => { is_custom_selector(lower_name) diff --git a/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css b/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css index 5d05c9612135..b1378007cd66 100644 --- a/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css +++ b/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css @@ -34,4 +34,5 @@ html { --custom-property-set: {} } a:defined { } *:is(*) { } :popover-open {} -:seeking, :stalled, :buffering, :volume-locked, :muted {} \ No newline at end of file +:seeking, :stalled, :buffering, :volume-locked, :muted {} +::-webkit-scrollbar-button:hover {} \ No newline at end of file diff --git a/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css.snap b/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css.snap index 9b7bdc3f1efd..f76c91e75274 100644 --- a/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css.snap +++ b/crates/biome_css_analyze/tests/specs/nursery/noUnknownPseudoClass/valid.css.snap @@ -41,4 +41,5 @@ a:defined { } *:is(*) { } :popover-open {} :seeking, :stalled, :buffering, :volume-locked, :muted {} +::-webkit-scrollbar-button:hover {} ```