Skip to content

Commit

Permalink
feat: implement noUnknownMediaFeatureName
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuhiro-Mimaki committed May 10, 2024
1 parent 4c2f6e3 commit 3f45256
Show file tree
Hide file tree
Showing 7 changed files with 610 additions and 6 deletions.
74 changes: 72 additions & 2 deletions crates/biome_css_analyze/src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ pub const OTHER_PSEUDO_ELEMENTS: [&str; 18] = [
"view-transition-old",
];

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

// https://github.com/known-css/known-css-properties/blob/master/source/w3c.json
pub const KNOWN_PROPERTIES: [&str; 588] = [
Expand Down Expand Up @@ -4958,14 +4958,77 @@ pub const KNOWN_US_BROWSER_PROPERTIES: [&str; 517] = [
"zoom",
];

pub const MEDIA_FEATURE_NAMES: [&str; 60] = [
"any-hover",
"any-pointer",
"aspect-ratio",
"color",
"color-gamut",
"color-index",
"device-aspect-ratio",
"device-height",
"device-posture",
"device-width",
"display-mode",
"dynamic-range",
"environment-blending",
"forced-colors",
"grid",
"height",
"horizontal-viewport-segments",
"hover",
"inverted-colors",
"light-level",
"max-aspect-ratio",
"max-color",
"max-color-index",
"max-device-aspect-ratio",
"max-device-height",
"max-device-width",
"max-height",
"max-monochrome",
"max-resolution",
"max-width",
"min-aspect-ratio",
"min-color",
"min-color-index",
"min-device-aspect-ratio",
"min-device-height",
"min-device-width",
"min-height",
"min-monochrome",
"min-resolution",
"min-width",
"monochrome",
"nav-controls",
"orientation",
"overflow-block",
"overflow-inline",
"pointer",
"prefers-color-scheme",
"prefers-contrast",
"prefers-reduced-data",
"prefers-reduced-motion",
"prefers-reduded-transparency",
"resolution",
"scan",
"screen-spanning",
"scripting",
"update",
"vertical-viewport-segments",
"video-color-gamut",
"video-dynamic-range",
"width",
];

#[cfg(test)]
mod tests {
use std::collections::HashSet;

use super::{
FUNCTION_KEYWORDS, KNOWN_EDGE_PROPERTIES, KNOWN_EXPLORER_PROPERTIES,
KNOWN_FIREFOX_PROPERTIES, KNOWN_PROPERTIES, KNOWN_SAFARI_PROPERTIES,
KNOWN_SUMSUNG_INTERNET_PROPERTIES, KNOWN_US_BROWSER_PROPERTIES,
KNOWN_SUMSUNG_INTERNET_PROPERTIES, KNOWN_US_BROWSER_PROPERTIES, MEDIA_FEATURE_NAMES,
};

#[test]
Expand Down Expand Up @@ -5030,4 +5093,11 @@ mod tests {
assert!(items[0] < items[1], "{} < {}", items[0], items[1]);
}
}

#[test]
fn test_media_feature_names_order() {
for items in MEDIA_FEATURE_NAMES.windows(2) {
assert!(items[0] < items[1], "{} < {}", items[0], items[1]);
}
}
}
Loading

0 comments on commit 3f45256

Please sign in to comment.