diff --git a/crates/rome_js_analyze/src/aria_analyzers/nursery.rs b/crates/rome_js_analyze/src/aria_analyzers/nursery.rs index 14c3e279a714..bf1c8dfb37ad 100644 --- a/crates/rome_js_analyze/src/aria_analyzers/nursery.rs +++ b/crates/rome_js_analyze/src/aria_analyzers/nursery.rs @@ -1,8 +1,9 @@ //! Generated file, do not edit by hand, see `xtask/codegen` use rome_analyze::declare_group; +mod no_noninteractive_element_to_interactive_role; mod use_aria_prop_types; mod use_aria_props_for_role; mod use_valid_aria_props; mod use_valid_lang; -declare_group! { pub (crate) Nursery { name : "nursery" , rules : [self :: use_aria_prop_types :: UseAriaPropTypes , self :: use_aria_props_for_role :: UseAriaPropsForRole , self :: use_valid_aria_props :: UseValidAriaProps , self :: use_valid_lang :: UseValidLang ,] } } +declare_group! { pub (crate) Nursery { name : "nursery" , rules : [self :: no_noninteractive_element_to_interactive_role :: NoNoninteractiveElementToInteractiveRole , self :: use_aria_prop_types :: UseAriaPropTypes , self :: use_aria_props_for_role :: UseAriaPropsForRole , self :: use_valid_aria_props :: UseValidAriaProps , self :: use_valid_lang :: UseValidLang ,] } } diff --git a/crates/rome_service/src/configuration/linter/rules.rs b/crates/rome_service/src/configuration/linter/rules.rs index e3baabf96bc7..59619040c89c 100644 --- a/crates/rome_service/src/configuration/linter/rules.rs +++ b/crates/rome_service/src/configuration/linter/rules.rs @@ -184,9 +184,7 @@ impl Rules { None } } - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } #[doc = r" It returns a tuple of filters. The first element of the tuple are the enabled rules,"] #[doc = r" while the second element are the disabled rules."] #[doc = r""] @@ -421,9 +419,7 @@ impl A11y { RuleFilter::Rule("a11y", Self::CATEGORY_RULES[7]), RuleFilter::Rule("a11y", Self::CATEGORY_RULES[8]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -443,9 +439,7 @@ impl A11y { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -531,9 +525,7 @@ impl Complexity { RuleFilter::Rule("complexity", Self::CATEGORY_RULES[4]), RuleFilter::Rule("complexity", Self::CATEGORY_RULES[5]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -553,9 +545,7 @@ impl Complexity { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -664,9 +654,7 @@ impl Correctness { RuleFilter::Rule("correctness", Self::CATEGORY_RULES[9]), RuleFilter::Rule("correctness", Self::CATEGORY_RULES[10]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -686,9 +674,7 @@ impl Correctness { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -769,6 +755,8 @@ struct NurserySchema { no_invalid_constructor_super: Option, #[doc = "Disallow non-null assertions using the ! postfix operator."] no_non_null_assertion: Option, + #[doc = "Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements."] + no_noninteractive_element_to_interactive_role: Option, #[doc = "Disallow literal numbers that lose precision"] no_precision_loss: Option, #[doc = "Enforce img alt prop does not contain the word \"image\", \"picture\", or \"photo\"."] @@ -826,7 +814,7 @@ struct NurserySchema { } impl Nursery { const CATEGORY_NAME: &'static str = "nursery"; - pub(crate) const CATEGORY_RULES: [&'static str; 43] = [ + pub(crate) const CATEGORY_RULES: [&'static str; 44] = [ "noAccessKey", "noAssignInExpressions", "noBannedTypes", @@ -843,6 +831,7 @@ impl Nursery { "noHeaderScope", "noInvalidConstructorSuper", "noNonNullAssertion", + "noNoninteractiveElementToInteractiveRole", "noPrecisionLoss", "noRedundantAlt", "noRedundantUseStrict", @@ -871,7 +860,7 @@ impl Nursery { "useValidAriaProps", "useValidLang", ]; - const RECOMMENDED_RULES: [&'static str; 34] = [ + const RECOMMENDED_RULES: [&'static str; 35] = [ "noAssignInExpressions", "noBannedTypes", "noClassAssign", @@ -886,6 +875,7 @@ impl Nursery { "noExtraSemicolons", "noHeaderScope", "noInvalidConstructorSuper", + "noNoninteractiveElementToInteractiveRole", "noRedundantAlt", "noSelfCompare", "noSetterReturn", @@ -907,7 +897,7 @@ impl Nursery { "useValidAriaProps", "useValidLang", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 34] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 35] = [ RuleFilter::Rule("nursery", Self::CATEGORY_RULES[1]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[2]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[3]), @@ -922,8 +912,8 @@ impl Nursery { RuleFilter::Rule("nursery", Self::CATEGORY_RULES[12]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[13]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[14]), - RuleFilter::Rule("nursery", Self::CATEGORY_RULES[17]), - RuleFilter::Rule("nursery", Self::CATEGORY_RULES[20]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[16]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[18]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[21]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[22]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[23]), @@ -931,21 +921,20 @@ impl Nursery { RuleFilter::Rule("nursery", Self::CATEGORY_RULES[25]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[26]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[27]), - RuleFilter::Rule("nursery", Self::CATEGORY_RULES[29]), - RuleFilter::Rule("nursery", Self::CATEGORY_RULES[31]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[28]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[30]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[32]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[33]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[34]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[35]), - RuleFilter::Rule("nursery", Self::CATEGORY_RULES[38]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[36]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[39]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[40]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[41]), RuleFilter::Rule("nursery", Self::CATEGORY_RULES[42]), + RuleFilter::Rule("nursery", Self::CATEGORY_RULES[43]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -965,14 +954,12 @@ impl Nursery { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 34] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 35] { Self::RECOMMENDED_RULES_AS_FILTERS } } @@ -1025,9 +1012,7 @@ impl Performance { const RECOMMENDED_RULES: [&'static str; 1] = ["noDelete"]; const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 1] = [RuleFilter::Rule("performance", Self::CATEGORY_RULES[0])]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -1047,9 +1032,7 @@ impl Performance { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -1117,9 +1100,7 @@ impl Security { RuleFilter::Rule("security", Self::CATEGORY_RULES[0]), RuleFilter::Rule("security", Self::CATEGORY_RULES[1]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -1139,9 +1120,7 @@ impl Security { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -1250,9 +1229,7 @@ impl Style { RuleFilter::Rule("style", Self::CATEGORY_RULES[11]), RuleFilter::Rule("style", Self::CATEGORY_RULES[12]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -1272,9 +1249,7 @@ impl Style { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) @@ -1412,9 +1387,7 @@ impl Suspicious { RuleFilter::Rule("suspicious", Self::CATEGORY_RULES[14]), RuleFilter::Rule("suspicious", Self::CATEGORY_RULES[15]), ]; - pub(crate) fn is_recommended(&self) -> bool { - !matches!(self.recommended, Some(false)) - } + pub(crate) fn is_recommended(&self) -> bool { !matches!(self.recommended, Some(false)) } pub(crate) fn get_enabled_rules(&self) -> IndexSet { IndexSet::from_iter(self.rules.iter().filter_map(|(key, conf)| { if conf.is_enabled() { @@ -1434,9 +1407,7 @@ impl Suspicious { })) } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] - pub(crate) fn has_rule(rule_name: &str) -> bool { - Self::CATEGORY_RULES.contains(&rule_name) - } + pub(crate) fn has_rule(rule_name: &str) -> bool { Self::CATEGORY_RULES.contains(&rule_name) } #[doc = r" Checks if, given a rule name, it is marked as recommended"] pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) diff --git a/justfile b/justfile index 3f9b1f251446..8ba206679bf7 100644 --- a/justfile +++ b/justfile @@ -8,10 +8,11 @@ codegen: cargo codegen-bindings codegen-linter: - cargo codegen-configuration - cargo codegen-schema - cargo codegen-bindings - cargo lintdoc + cargo codegen analyzer + cargo codegen-configuration + cargo codegen-schema + cargo codegen-bindings + cargo lintdoc documentation: cargo lintdoc