Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(biome_css_analyzer): noUnknownSelectorPseudoElement #2655

Merged
56 changes: 39 additions & 17 deletions crates/biome_configuration/src/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions crates/biome_css_analyze/src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,104 @@ pub const FUNCTION_KEYWORDS: [&str; 671] = [
"xywh",
];

// These are the ones that can have single-colon notation
pub const LEVEL_ONE_AND_TWO_PSEUDO_ELEMENTS: [&str; 4] =
["before", "after", "first-line", "first-letter"];

pub const VENDOR_SPECIFIC_PSEUDO_ELEMENTS: [&str; 66] = [
"-moz-focus-inner",
"-moz-focus-outer",
"-moz-list-bullet",
"-moz-meter-bar",
"-moz-placeholder",
"-moz-progress-bar",
"-moz-range-progress",
"-moz-range-thumb",
"-moz-range-track",
"-ms-browse",
"-ms-check",
"-ms-clear",
"-ms-expand",
"-ms-fill",
"-ms-fill-lower",
"-ms-fill-upper",
"-ms-reveal",
"-ms-thumb",
"-ms-ticks-after",
"-ms-ticks-before",
"-ms-tooltip",
"-ms-track",
"-ms-value",
"-webkit-color-swatch",
"-webkit-color-swatch-wrapper",
"-webkit-calendar-picker-indicator",
"-webkit-clear-button",
"-webkit-date-and-time-value",
"-webkit-datetime-edit",
"-webkit-datetime-edit-ampm-field",
"-webkit-datetime-edit-day-field",
"-webkit-datetime-edit-fields-wrapper",
"-webkit-datetime-edit-hour-field",
"-webkit-datetime-edit-millisecond-field",
"-webkit-datetime-edit-minute-field",
"-webkit-datetime-edit-month-field",
"-webkit-datetime-edit-second-field",
"-webkit-datetime-edit-text",
"-webkit-datetime-edit-week-field",
"-webkit-datetime-edit-year-field",
"-webkit-details-marker",
"-webkit-distributed",
"-webkit-file-upload-button",
"-webkit-input-placeholder",
"-webkit-keygen-select",
"-webkit-meter-bar",
"-webkit-meter-even-less-good-value",
"-webkit-meter-inner-element",
"-webkit-meter-optimum-value",
"-webkit-meter-suboptimum-value",
"-webkit-progress-bar",
"-webkit-progress-inner-element",
"-webkit-progress-value",
"-webkit-search-cancel-button",
"-webkit-search-decoration",
"-webkit-search-results-button",
"-webkit-search-results-decoration",
"-webkit-slider-runnable-track",
"-webkit-slider-thumb",
"-webkit-textfield-decoration-container",
"-webkit-validation-bubble",
"-webkit-validation-bubble-arrow",
"-webkit-validation-bubble-arrow-clipper",
"-webkit-validation-bubble-heading",
"-webkit-validation-bubble-message",
"-webkit-validation-bubble-text-block",
];

pub const SHADOW_TREE_PSEUDO_ELEMENTS: [&str; 1] = ["part"];

pub const OTHER_PSEUDO_ELEMENTS: [&str; 18] = [
"backdrop",
"content",
"cue",
"file-selector-button",
"grammar-error",
"highlight",
"marker",
"placeholder",
"selection",
"shadow",
"slotted",
"spelling-error",
"target-text",
"view-transition",
"view-transition-group",
"view-transition-image-pair",
"view-transition-new",
"view-transition-old",
];

pub const VENDER_PREFIXES: [&str; 4] = ["-webkit-", "-moz-", "-ms-", "-o-"];

#[cfg(test)]
mod tests {
use std::collections::HashSet;
Expand Down
2 changes: 2 additions & 0 deletions crates/biome_css_analyze/src/lint/nursery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub mod no_duplicate_font_names;
pub mod no_duplicate_selectors_keyframe_block;
pub mod no_important_in_keyframe;
pub mod no_unknown_function;
pub mod no_unknown_selector_pseudo_element;
pub mod no_unknown_unit;
pub mod use_generic_font_names;

Expand All @@ -23,6 +24,7 @@ declare_group! {
self :: no_duplicate_selectors_keyframe_block :: NoDuplicateSelectorsKeyframeBlock ,
self :: no_important_in_keyframe :: NoImportantInKeyframe ,
self :: no_unknown_function :: NoUnknownFunction ,
self :: no_unknown_selector_pseudo_element :: NoUnknownSelectorPseudoElement ,
self :: no_unknown_unit :: NoUnknownUnit ,
self :: use_generic_font_names :: UseGenericFontNames ,
]
Expand Down
Loading