diff --git a/crates/biome_cli/tests/snapshots/main_commands_rage/with_linter_configuration.snap b/crates/biome_cli/tests/snapshots/main_commands_rage/with_linter_configuration.snap index 44e34c649565..b8d781ddfda7 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_rage/with_linter_configuration.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_rage/with_linter_configuration.snap @@ -76,7 +76,7 @@ Linter: correctness/all = true nursery/useConsistentArrayType = {"level":"warn","options":{"syntax":"shorthand"}} style/noNonNullAssertion = "off" - suspicious/noCommentText = {"level":"warn"} + suspicious/noCommentText = {"level":"warn","options":null} Server: Version: 0.0.0 diff --git a/crates/biome_css_analyze/src/analyzers.rs b/crates/biome_css_analyze/src/analyzers.rs index 2112770ad47c..bbb3a8c7f133 100644 --- a/crates/biome_css_analyze/src/analyzers.rs +++ b/crates/biome_css_analyze/src/analyzers.rs @@ -1,4 +1,4 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod nursery; -::biome_analyze::declare_category! { pub (crate) Analyzers { kind : Lint , groups : [self :: nursery :: Nursery ,] } } +pub mod nursery; +::biome_analyze::declare_category! { pub Analyzers { kind : Lint , groups : [self :: nursery :: Nursery ,] } } diff --git a/crates/biome_css_analyze/src/analyzers/nursery.rs b/crates/biome_css_analyze/src/analyzers/nursery.rs index 6b3f0eb15794..3655f65beed6 100644 --- a/crates/biome_css_analyze/src/analyzers/nursery.rs +++ b/crates/biome_css_analyze/src/analyzers/nursery.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod noop; +pub mod noop; declare_group! { - pub (crate) Nursery { + pub Nursery { name : "nursery" , rules : [ self :: noop :: Noop , diff --git a/crates/biome_css_analyze/src/analyzers/nursery/noop.rs b/crates/biome_css_analyze/src/analyzers/nursery/noop.rs index 626d7a44397a..e0118a424ed4 100644 --- a/crates/biome_css_analyze/src/analyzers/nursery/noop.rs +++ b/crates/biome_css_analyze/src/analyzers/nursery/noop.rs @@ -3,7 +3,7 @@ use biome_css_syntax::CssColor; declare_rule! { /// Noop rule - pub(crate) Noop { + pub Noop { version: "next", name: "noop", } diff --git a/crates/biome_deserialize/src/impls.rs b/crates/biome_deserialize/src/impls.rs index 438fce6fc765..23b132a65c42 100644 --- a/crates/biome_deserialize/src/impls.rs +++ b/crates/biome_deserialize/src/impls.rs @@ -483,6 +483,16 @@ impl Deserializable for PathBuf { } } +impl Deserializable for Box { + fn deserialize( + value: &impl DeserializableValue, + name: &str, + diagnostics: &mut Vec, + ) -> Option { + T::deserialize(value, name, diagnostics).map(Box::new) + } +} + impl Deserializable for Vec { fn deserialize( value: &impl DeserializableValue, diff --git a/crates/biome_deserialize_macros/src/deserializable_derive.rs b/crates/biome_deserialize_macros/src/deserializable_derive.rs index e5848000b523..7c28e16673c8 100644 --- a/crates/biome_deserialize_macros/src/deserializable_derive.rs +++ b/crates/biome_deserialize_macros/src/deserializable_derive.rs @@ -281,6 +281,7 @@ fn generate_deserializable_newtype( }; let trait_bounds = generate_trait_bounds(&generics); + let generics = generate_generics_without_trait_bounds(&generics); quote! { impl #generics biome_deserialize::Deserializable for #ident #generics #trait_bounds { @@ -401,8 +402,6 @@ fn generate_deserializable_struct( }) .collect(); - let trait_bounds = generate_trait_bounds(&generics); - let validator = if required_fields.is_empty() { quote! {} } else { @@ -443,6 +442,10 @@ fn generate_deserializable_struct( validator }; + let tuple_type = generate_generics_tuple(&generics); + let trait_bounds = generate_trait_bounds(&generics); + let generics = generate_generics_without_trait_bounds(&generics); + quote! { impl #generics biome_deserialize::Deserializable for #ident #generics #trait_bounds { fn deserialize( @@ -450,9 +453,10 @@ fn generate_deserializable_struct( name: &str, diagnostics: &mut Vec, ) -> Option { - struct Visitor #generics; - impl #generics biome_deserialize::DeserializationVisitor for Visitor #generics { - type Output = #ident; + use std::marker::PhantomData; + struct Visitor #generics (PhantomData< #tuple_type >); + impl #generics biome_deserialize::DeserializationVisitor for Visitor #generics #trait_bounds { + type Output = #ident #generics; const EXPECTED_TYPE: biome_deserialize::VisitableType = biome_deserialize::VisitableType::MAP; @@ -486,7 +490,7 @@ fn generate_deserializable_struct( } } - value.deserialize(Visitor, name, diagnostics) + value.deserialize(Visitor(PhantomData), name, diagnostics) } } } @@ -498,6 +502,7 @@ fn generate_deserializable_from( data: DeserializableFromData, ) -> TokenStream { let trait_bounds = generate_trait_bounds(&generics); + let generics = generate_generics_without_trait_bounds(&generics); let from = data.from; let validator = if data.with_validator { quote! { @@ -530,6 +535,7 @@ fn generate_deserializable_try_from( data: DeserializableTryFromData, ) -> TokenStream { let trait_bounds = generate_trait_bounds(&generics); + let generics = generate_generics_without_trait_bounds(&generics); let try_from = data.try_from; let validator = if data.with_validator { quote! { @@ -565,6 +571,27 @@ fn generate_deserializable_try_from( } } +fn generate_generics_without_trait_bounds(generics: &Generics) -> TokenStream { + if generics.params.is_empty() { + quote! {} + } else { + let params = generics.params.iter().map(|param| match param { + GenericParam::Type(ty) => { + let attrs = ty + .attrs + .iter() + .fold(quote! {}, |acc, attr| quote! { #acc #attr }); + let ident = &ty.ident; + quote! { #attrs #ident } + } + _ => abort!(generics, "Unsupported generic parameter"), + }); + quote! { + < #(#params),* > + } + } +} + fn generate_trait_bounds(generics: &Generics) -> TokenStream { if generics.params.is_empty() { quote! {} @@ -572,7 +599,12 @@ fn generate_trait_bounds(generics: &Generics) -> TokenStream { let params = generics.params.iter().map(|param| match param { GenericParam::Type(ty) => { let ident = &ty.ident; - quote! { #ident: biome_deserialize::Deserializable } + let bounds = &ty.bounds; + if bounds.is_empty() { + quote! { #ident: biome_deserialize::Deserializable } + } else { + quote! { #ident: #bounds + biome_deserialize::Deserializable } + } } _ => abort!(generics, "Unsupported generic parameter"), }); @@ -581,3 +613,16 @@ fn generate_trait_bounds(generics: &Generics) -> TokenStream { } } } + +fn generate_generics_tuple(generics: &Generics) -> TokenStream { + let params = generics.params.iter().map(|param| match param { + GenericParam::Type(ty) => { + let ident = &ty.ident; + quote! { #ident } + } + _ => abort!(generics, "Unsupported generic parameter"), + }); + quote! { + ( #(#params),* ) + } +} diff --git a/crates/biome_js_analyze/src/analyzers.rs b/crates/biome_js_analyze/src/analyzers.rs index 1a4492f1ccd4..f73a9dd51873 100644 --- a/crates/biome_js_analyze/src/analyzers.rs +++ b/crates/biome_js_analyze/src/analyzers.rs @@ -1,10 +1,10 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod a11y; -pub(crate) mod complexity; -pub(crate) mod correctness; -pub(crate) mod nursery; -pub(crate) mod performance; -pub(crate) mod style; -pub(crate) mod suspicious; -::biome_analyze::declare_category! { pub (crate) Analyzers { kind : Lint , groups : [self :: a11y :: A11y , self :: complexity :: Complexity , self :: correctness :: Correctness , self :: nursery :: Nursery , self :: performance :: Performance , self :: style :: Style , self :: suspicious :: Suspicious ,] } } +pub mod a11y; +pub mod complexity; +pub mod correctness; +pub mod nursery; +pub mod performance; +pub mod style; +pub mod suspicious; +::biome_analyze::declare_category! { pub Analyzers { kind : Lint , groups : [self :: a11y :: A11y , self :: complexity :: Complexity , self :: correctness :: Correctness , self :: nursery :: Nursery , self :: performance :: Performance , self :: style :: Style , self :: suspicious :: Suspicious ,] } } diff --git a/crates/biome_js_analyze/src/analyzers/a11y.rs b/crates/biome_js_analyze/src/analyzers/a11y.rs index d83ab2076494..15d28299f398 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y.rs @@ -2,29 +2,29 @@ use biome_analyze::declare_group; -pub(crate) mod no_access_key; -pub(crate) mod no_auto_focus; -pub(crate) mod no_blank_target; -pub(crate) mod no_distracting_elements; -pub(crate) mod no_header_scope; -pub(crate) mod no_redundant_alt; -pub(crate) mod no_svg_without_title; -pub(crate) mod use_alt_text; -pub(crate) mod use_anchor_content; -pub(crate) mod use_heading_content; -pub(crate) mod use_html_lang; -pub(crate) mod use_iframe_title; -pub(crate) mod use_key_with_click_events; -pub(crate) mod use_key_with_mouse_events; -pub(crate) mod use_media_caption; -pub(crate) mod use_valid_anchor; +pub mod no_access_key; +pub mod no_autofocus; +pub mod no_blank_target; +pub mod no_distracting_elements; +pub mod no_header_scope; +pub mod no_redundant_alt; +pub mod no_svg_without_title; +pub mod use_alt_text; +pub mod use_anchor_content; +pub mod use_heading_content; +pub mod use_html_lang; +pub mod use_iframe_title; +pub mod use_key_with_click_events; +pub mod use_key_with_mouse_events; +pub mod use_media_caption; +pub mod use_valid_anchor; declare_group! { - pub (crate) A11y { + pub A11y { name : "a11y" , rules : [ self :: no_access_key :: NoAccessKey , - self :: no_auto_focus :: NoAutoFocus , + self :: no_autofocus :: NoAutofocus , self :: no_blank_target :: NoBlankTarget , self :: no_distracting_elements :: NoDistractingElements , self :: no_header_scope :: NoHeaderScope , diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_access_key.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_access_key.rs index 6b85fce0738a..3cc94ff84aa2 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_access_key.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_access_key.rs @@ -37,7 +37,7 @@ declare_rule! { /// - [WebAIM: Keyboard Accessibility - Accesskey](https://webaim.org/techniques/keyboard/accesskey#spec) /// - [MDN `accesskey` documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/accesskey) /// - pub(crate) NoAccessKey { + pub NoAccessKey { version: "1.0.0", name: "noAccessKey", source: RuleSource::EslintJsxA11y("no-access-key"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_auto_focus.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_autofocus.rs similarity index 98% rename from crates/biome_js_analyze/src/analyzers/a11y/no_auto_focus.rs rename to crates/biome_js_analyze/src/analyzers/a11y/no_autofocus.rs index c4694df8796d..0c030bd5198e 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_auto_focus.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_autofocus.rs @@ -57,7 +57,7 @@ declare_rule! { /// - [WHATWG HTML Standard, The autofocus attribute](https://html.spec.whatwg.org/multipage/interaction.html#attr-fe-autofocus) /// - [The accessibility of HTML 5 autofocus](https://brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/) /// - pub(crate) NoAutoFocus { + pub NoAutofocus { version: "1.0.0", name: "noAutofocus", source: RuleSource::EslintJsxA11y("no-autofocus"), @@ -66,7 +66,7 @@ declare_rule! { } } -impl Rule for NoAutoFocus { +impl Rule for NoAutofocus { type Query = Ast; type State = JsxAttribute; type Signals = Option; diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_blank_target.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_blank_target.rs index effc0b2fd414..de89f4e4788f 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_blank_target.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_blank_target.rs @@ -48,7 +48,7 @@ declare_rule! { /// ```jsx /// child /// ``` - pub(crate) NoBlankTarget { + pub NoBlankTarget { version: "1.0.0", name: "noBlankTarget", source: RuleSource::EslintReact("jsx-no-target-blank"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_distracting_elements.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_distracting_elements.rs index efa3014ea9a1..67d749313fd2 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_distracting_elements.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_distracting_elements.rs @@ -37,7 +37,7 @@ declare_rule! { /// /// - [WCAG 2.2.2](https://www.w3.org/WAI/WCAG21/Understanding/pause-stop-hide) /// - pub(crate) NoDistractingElements { + pub NoDistractingElements { version: "1.0.0", name: "noDistractingElements", source: RuleSource::EslintJsxA11y("no-distracting-elements"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_header_scope.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_header_scope.rs index 716a72ca3b2e..f9eabba1d777 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_header_scope.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_header_scope.rs @@ -37,7 +37,7 @@ declare_rule! { /// - [WCAG 1.3.1](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships) /// - [WCAG 4.1.1](https://www.w3.org/WAI/WCAG21/Understanding/parsing) /// - pub(crate) NoHeaderScope { + pub NoHeaderScope { version: "1.0.0", name: "noHeaderScope", source: RuleSource::EslintJsxA11y("scope"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_redundant_alt.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_redundant_alt.rs index 9833c7bdf8e3..970b79af72ca 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_redundant_alt.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_redundant_alt.rs @@ -39,7 +39,7 @@ declare_rule! { /// /// ``` /// - pub(crate) NoRedundantAlt { + pub NoRedundantAlt { version: "1.0.0", name: "noRedundantAlt", source: RuleSource::EslintJsxA11y("no-redundant-roles"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/no_svg_without_title.rs b/crates/biome_js_analyze/src/analyzers/a11y/no_svg_without_title.rs index 3f304f9c80bb..2e51d5eea548 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/no_svg_without_title.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/no_svg_without_title.rs @@ -79,7 +79,7 @@ declare_rule! { /// [Accessible SVGs | CSS-Tricks - CSS-Tricks](https://css-tricks.com/accessible-svgs/) /// [Contextually Marking up accessible images and SVGs | scottohara.me](https://www.scottohara.me/blog/2019/05/22/contextual-images-svgs-and-a11y.html) /// - pub(crate) NoSvgWithoutTitle { + pub NoSvgWithoutTitle { version: "1.0.0", name: "noSvgWithoutTitle", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_alt_text.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_alt_text.rs index add1a4d82a74..f974f54808c3 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_alt_text.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_alt_text.rs @@ -43,7 +43,7 @@ declare_rule! { /// /// - [WCAG 1.1.1](https://www.w3.org/WAI/WCAG21/Understanding/non-text-content.html) /// - pub(crate) UseAltText { + pub UseAltText { version: "1.0.0", name: "useAltText", source: RuleSource::EslintJsxA11y("alt-text"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_anchor_content.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_anchor_content.rs index e180b0f4da3f..072db8afc173 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_anchor_content.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_anchor_content.rs @@ -64,7 +64,7 @@ declare_rule! { /// - [WCAG 2.4.4](https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-in-context) /// - [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value) /// - pub(crate) UseAnchorContent { + pub UseAnchorContent { version: "1.0.0", name: "useAnchorContent", source: RuleSource::EslintJsxA11y("anchor-has-content"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_heading_content.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_heading_content.rs index 931fe8bc1a63..a6b2d1d1a330 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_heading_content.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_heading_content.rs @@ -44,7 +44,7 @@ declare_rule! { /// /// - [WCAG 2.4.6](https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-descriptive.html) /// - pub(crate) UseHeadingContent { + pub UseHeadingContent { version: "1.0.0", name: "useHeadingContent", source: RuleSource::EslintJsxA11y("heading-has-content"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_html_lang.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_html_lang.rs index 15a88fb06ddf..592e468d43d8 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_html_lang.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_html_lang.rs @@ -52,7 +52,7 @@ declare_rule! { /// /// - [WCAG 3.1.1](https://www.w3.org/WAI/WCAG21/Understanding/language-of-page) /// - pub(crate) UseHtmlLang { + pub UseHtmlLang { version: "1.0.0", name: "useHtmlLang", source: RuleSource::EslintJsxA11y("html-has-lang"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_iframe_title.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_iframe_title.rs index 4ef7531a96f3..82a79197da26 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_iframe_title.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_iframe_title.rs @@ -58,7 +58,7 @@ declare_rule! { /// - [WCAG 2.4.1](https://www.w3.org/WAI/WCAG21/Understanding/bypass-blocks) /// - [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value) /// - pub(crate) UseIframeTitle { + pub UseIframeTitle { version: "1.0.0", name: "useIframeTitle", source: RuleSource::EslintJsxA11y("iframe-has-title"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_click_events.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_click_events.rs index c214cfb46709..806e3f0dd0c6 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_click_events.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_click_events.rs @@ -56,7 +56,7 @@ declare_rule! { /// /// - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard) /// - pub(crate) UseKeyWithClickEvents { + pub UseKeyWithClickEvents { version: "1.0.0", name: "useKeyWithClickEvents", source: RuleSource::EslintJsxA11y("click-events-have-key-events"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_mouse_events.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_mouse_events.rs index 4fab67bcc851..647ed44fb408 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_mouse_events.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_key_with_mouse_events.rs @@ -39,7 +39,7 @@ declare_rule! { /// /// - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard) /// - pub(crate) UseKeyWithMouseEvents { + pub UseKeyWithMouseEvents { version: "1.0.0", name: "useKeyWithMouseEvents", source: RuleSource::EslintJsxA11y("mouse-events-have-key-events"), @@ -47,7 +47,7 @@ declare_rule! { } } -pub(crate) enum UseKeyWithMouseEventsState { +pub enum UseKeyWithMouseEventsState { MissingOnFocus, MissingOnBlur, } diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_media_caption.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_media_caption.rs index d80f7de09f21..f8f77a404b37 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_media_caption.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_media_caption.rs @@ -30,7 +30,7 @@ declare_rule! { /// ```jsx /// /// ``` - pub(crate) UseMediaCaption { + pub UseMediaCaption { version: "1.0.0", name: "useMediaCaption", source: RuleSource::EslintJsxA11y("media-has-caption"), diff --git a/crates/biome_js_analyze/src/analyzers/a11y/use_valid_anchor.rs b/crates/biome_js_analyze/src/analyzers/a11y/use_valid_anchor.rs index f306f1c4b54b..713181afeaa3 100644 --- a/crates/biome_js_analyze/src/analyzers/a11y/use_valid_anchor.rs +++ b/crates/biome_js_analyze/src/analyzers/a11y/use_valid_anchor.rs @@ -66,7 +66,7 @@ declare_rule! { /// /// - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard) /// - pub(crate) UseValidAnchor { + pub UseValidAnchor { version: "1.0.0", name: "useValidAnchor", source: RuleSource::EslintJsxA11y("anchor-is-valid"), @@ -77,7 +77,7 @@ declare_rule! { /// Representation of the various states /// /// The `TextRange` of each variant represents the range of where the issue is found. -pub(crate) enum UseValidAnchorState { +pub enum UseValidAnchorState { /// The anchor element has not `href` attribute MissingHrefAttribute(TextRange), /// The value assigned to attribute `href` is not valid diff --git a/crates/biome_js_analyze/src/analyzers/complexity.rs b/crates/biome_js_analyze/src/analyzers/complexity.rs index 26f955de101f..3e7d16a9af6e 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity.rs @@ -2,30 +2,30 @@ use biome_analyze::declare_group; -pub(crate) mod no_excessive_cognitive_complexity; -pub(crate) mod no_extra_boolean_cast; -pub(crate) mod no_for_each; -pub(crate) mod no_multiple_spaces_in_regular_expression_literals; -pub(crate) mod no_static_only_class; -pub(crate) mod no_useless_catch; -pub(crate) mod no_useless_constructor; -pub(crate) mod no_useless_empty_export; -pub(crate) mod no_useless_label; -pub(crate) mod no_useless_rename; -pub(crate) mod no_useless_switch_case; -pub(crate) mod no_useless_type_constraint; -pub(crate) mod no_void; -pub(crate) mod no_with; -pub(crate) mod use_arrow_function; -pub(crate) mod use_flat_map; -pub(crate) mod use_literal_keys; -pub(crate) mod use_optional_chain; -pub(crate) mod use_regex_literals; -pub(crate) mod use_simple_number_keys; -pub(crate) mod use_simplified_logic_expression; +pub mod no_excessive_cognitive_complexity; +pub mod no_extra_boolean_cast; +pub mod no_for_each; +pub mod no_multiple_spaces_in_regular_expression_literals; +pub mod no_static_only_class; +pub mod no_useless_catch; +pub mod no_useless_constructor; +pub mod no_useless_empty_export; +pub mod no_useless_label; +pub mod no_useless_rename; +pub mod no_useless_switch_case; +pub mod no_useless_type_constraint; +pub mod no_void; +pub mod no_with; +pub mod use_arrow_function; +pub mod use_flat_map; +pub mod use_literal_keys; +pub mod use_optional_chain; +pub mod use_regex_literals; +pub mod use_simple_number_keys; +pub mod use_simplified_logic_expression; declare_group! { - pub (crate) Complexity { + pub Complexity { name : "complexity" , rules : [ self :: no_excessive_cognitive_complexity :: NoExcessiveCognitiveComplexity , diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_excessive_cognitive_complexity.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_excessive_cognitive_complexity.rs index 4a8c15233989..554091f34820 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_excessive_cognitive_complexity.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_excessive_cognitive_complexity.rs @@ -69,7 +69,7 @@ declare_rule! { /// /// The allowed values range from 1 through 254. The default is 15. /// - pub(crate) NoExcessiveCognitiveComplexity { + pub NoExcessiveCognitiveComplexity { version: "1.0.0", name: "noExcessiveCognitiveComplexity", source: RuleSource::EslintSonarJs("cognitive-complexity"), @@ -133,7 +133,7 @@ impl Rule for NoExcessiveCognitiveComplexity { } #[derive(Clone)] -pub(crate) struct CognitiveComplexity { +pub struct CognitiveComplexity { function_like: AnyFunctionLike, score: ComplexityScore, } diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_extra_boolean_cast.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_extra_boolean_cast.rs index 27ff2eae2bb8..d94a4c30b542 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_extra_boolean_cast.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_extra_boolean_cast.rs @@ -56,7 +56,7 @@ declare_rule! { /// !x; /// !!x; /// ``` - pub(crate) NoExtraBooleanCast { + pub NoExtraBooleanCast { version: "1.0.0", name: "noExtraBooleanCast", source: RuleSource::Eslint("no-extra-boolean-cast"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_for_each.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_for_each.rs index 5cf705f3a04c..020c50a90323 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_for_each.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_for_each.rs @@ -51,7 +51,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoForEach { + pub NoForEach { version: "1.0.0", name: "noForEach", source: RuleSource::EslintUnicorn("no-array-for-each"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_multiple_spaces_in_regular_expression_literals.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_multiple_spaces_in_regular_expression_literals.rs index 04b5a0396c14..b7cfda5377e7 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_multiple_spaces_in_regular_expression_literals.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_multiple_spaces_in_regular_expression_literals.rs @@ -46,7 +46,7 @@ declare_rule! { /// ```js /// /foo bar baz/ ///``` - pub(crate) NoMultipleSpacesInRegularExpressionLiterals { + pub NoMultipleSpacesInRegularExpressionLiterals { version: "1.0.0", name: "noMultipleSpacesInRegularExpressionLiterals", source: RuleSource::Eslint("no-regex-spaces"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_static_only_class.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_static_only_class.rs index b488ccb1fadc..e47c3951d6d0 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_static_only_class.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_static_only_class.rs @@ -88,7 +88,7 @@ declare_rule! { /// mutableField += 1; /// } /// ``` - pub(crate) NoStaticOnlyClass { + pub NoStaticOnlyClass { version: "1.0.0", name: "noStaticOnlyClass", source: RuleSource::EslintTypeScript("no-extraneous-class"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_catch.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_catch.rs index 1939c7aeee62..521b282e30ef 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_catch.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_catch.rs @@ -50,7 +50,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUselessCatch { + pub NoUselessCatch { version: "1.0.0", name: "noUselessCatch", source: RuleSource::Eslint("no-useless-catch"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_constructor.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_constructor.rs index 6f11d33bb8fd..cb008a0b7bc5 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_constructor.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_constructor.rs @@ -102,7 +102,7 @@ declare_rule! { /// constructor (prop: number) {} /// } /// ``` - pub(crate) NoUselessConstructor { + pub NoUselessConstructor { version: "1.0.0", name: "noUselessConstructor", source: RuleSource::EslintTypeScript("no-useless-constructor"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_empty_export.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_empty_export.rs index da5787a1d9b4..2b781c36dc09 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_empty_export.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_empty_export.rs @@ -42,7 +42,7 @@ declare_rule! { /// export {}; /// ``` /// - pub(crate) NoUselessEmptyExport { + pub NoUselessEmptyExport { version: "1.0.0", name: "noUselessEmptyExport", source: RuleSource::EslintTypeScript("no-useless-empty-export"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_label.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_label.rs index 780650ef2196..895e74023e37 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_label.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_label.rs @@ -32,7 +32,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUselessLabel { + pub NoUselessLabel { version: "1.0.0", name: "noUselessLabel", source: RuleSource::Eslint("no-extra-label"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_rename.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_rename.rs index 251eb242da8b..eda7bfe575d6 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_rename.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_rename.rs @@ -57,7 +57,7 @@ declare_rule! { /// let { foo: bar } = baz; /// ``` /// - pub(crate) NoUselessRename { + pub NoUselessRename { version: "1.0.0", name: "noUselessRename", source: RuleSource::Eslint("no-useless-rename"), @@ -67,7 +67,7 @@ declare_rule! { } declare_node_union! { - pub(crate) JsRenaming = JsExportNamedFromSpecifier | JsExportNamedSpecifier | JsNamedImportSpecifier | JsObjectBindingPatternProperty + pub JsRenaming = JsExportNamedFromSpecifier | JsExportNamedSpecifier | JsNamedImportSpecifier | JsObjectBindingPatternProperty } impl Rule for NoUselessRename { diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_switch_case.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_switch_case.rs index 4fd60de0bae4..0d4513811eae 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_switch_case.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_switch_case.rs @@ -57,7 +57,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUselessSwitchCase { + pub NoUselessSwitchCase { version: "1.0.0", name: "noUselessSwitchCase", source: RuleSource::EslintUnicorn("no-useless-switch-case"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_type_constraint.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_type_constraint.rs index 7564f8e008a3..61384d76550f 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_useless_type_constraint.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_useless_type_constraint.rs @@ -76,7 +76,7 @@ declare_rule! { /// /// type Bar = {}; ///``` - pub(crate) NoUselessTypeConstraint { + pub NoUselessTypeConstraint { version: "1.0.0", name: "noUselessTypeConstraint", source: RuleSource::EslintTypeScript("no-unnecessary-type-constraint"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_void.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_void.rs index f1aa0b060eb7..3c506913fa0f 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_void.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_void.rs @@ -17,7 +17,7 @@ declare_rule! { /// void 0; /// ``` /// - pub(crate) NoVoid { + pub NoVoid { version: "1.0.0", name: "noVoid", source: RuleSource::Eslint("no-void"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/no_with.rs b/crates/biome_js_analyze/src/analyzers/complexity/no_with.rs index 6db4d0af0632..af54764d4af8 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/no_with.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/no_with.rs @@ -22,7 +22,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoWith { + pub NoWith { version: "1.0.0", name: "noWith", source: RuleSource::Eslint("no-with"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_arrow_function.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_arrow_function.rs index b3ea7635cc4f..049bd0a03f21 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_arrow_function.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_arrow_function.rs @@ -67,7 +67,7 @@ declare_rule! { /// return 0; /// } /// ``` - pub(crate) UseArrowFunction { + pub UseArrowFunction { version: "1.0.0", name: "useArrowFunction", source: RuleSource::Eslint("prefer-arrow-callback"), @@ -221,7 +221,7 @@ fn needs_parentheses(function_expression: &JsFunctionExpression) -> bool { } declare_node_union! { - pub(crate) AnyThisScope = + pub AnyThisScope = JsConstructorClassMember | JsFunctionExpression | JsFunctionDeclaration @@ -238,12 +238,12 @@ declare_node_union! { } #[derive(Debug, Clone)] -pub(crate) struct AnyThisScopeMetadata { +pub struct AnyThisScopeMetadata { scope: AnyThisScope, has_this: bool, } -pub(crate) struct ActualThisScope(AnyThisScopeMetadata); +pub struct ActualThisScope(AnyThisScopeMetadata); impl QueryMatch for ActualThisScope { fn text_range(&self) -> TextRange { diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_flat_map.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_flat_map.rs index 0450b101f575..e6c556a80c82 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_flat_map.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_flat_map.rs @@ -31,7 +31,7 @@ declare_rule! { /// array.map(sentence => sentence.split(' ')).flat(2); /// ``` /// - pub(crate) UseFlatMap { + pub UseFlatMap { version: "1.0.0", name: "useFlatMap", source: RuleSource::EslintUnicorn("prefer-array-flat-map"), diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_literal_keys.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_literal_keys.rs index ca4f8891affb..4d45adfb15c5 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_literal_keys.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_literal_keys.rs @@ -49,7 +49,7 @@ declare_rule! { /// a[d.c]; /// ``` /// - pub(crate) UseLiteralKeys { + pub UseLiteralKeys { version: "1.0.0", name: "useLiteralKeys", source: RuleSource::Eslint("dot-notation"), @@ -178,5 +178,5 @@ impl Rule for UseLiteralKeys { } declare_node_union! { - pub(crate) AnyJsMember = AnyJsComputedMember | JsLiteralMemberName | JsComputedMemberName + pub AnyJsMember = AnyJsComputedMember | JsLiteralMemberName | JsComputedMemberName } diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_optional_chain.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_optional_chain.rs index 3a1741874683..f91278fa42cd 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_optional_chain.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_optional_chain.rs @@ -73,7 +73,7 @@ declare_rule! { /// foo["some long"] && foo["some long string"].baz ///``` /// - pub(crate) UseOptionalChain { + pub UseOptionalChain { version: "1.0.0", name: "useOptionalChain", source: RuleSource::EslintTypeScript("prefer-optional-chain"), @@ -82,7 +82,7 @@ declare_rule! { } } -pub(crate) enum UseOptionalChainState { +pub enum UseOptionalChainState { LogicalAnd(VecDeque), LogicalOrLike(LogicalOrLikeChain), } @@ -310,7 +310,7 @@ enum LogicalAndChainOrdering { /// Iterate buffer `[bar, zoo]` we need to make every `JsAnyExpression` optional: `foo?.bar.baz?.zoo;` /// #[derive(Debug)] -pub(crate) struct LogicalAndChain { +pub struct LogicalAndChain { head: AnyJsExpression, /// The buffer of `JsAnyExpression` which need to make optional chain. buf: VecDeque, @@ -575,7 +575,7 @@ impl LogicalAndChain { /// `foo?.bar?.baz;` /// #[derive(Debug)] -pub(crate) struct LogicalOrLikeChain { +pub struct LogicalOrLikeChain { member: AnyJsMemberExpression, } diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_regex_literals.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_regex_literals.rs index d06b5c93fbf6..2816a9caf1c0 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_regex_literals.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_regex_literals.rs @@ -45,7 +45,7 @@ declare_rule! { /// new RegExp("abc", flags); /// ``` /// - pub(crate) UseRegexLiterals { + pub UseRegexLiterals { version: "1.3.0", name: "useRegexLiterals", source: RuleSource::Eslint("prefer-regex-literals"), @@ -55,7 +55,7 @@ declare_rule! { } declare_node_union! { - pub(crate) JsNewOrCallExpression = JsNewExpression | JsCallExpression + pub JsNewOrCallExpression = JsNewExpression | JsCallExpression } pub struct UseRegexLiteralsState { diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs index 01f94f349e2d..7b64c0b7cc81 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs @@ -45,7 +45,7 @@ declare_rule! { /// ({ 3.1e12: "floating point with e" }); /// ``` /// - pub(crate) UseSimpleNumberKeys { + pub UseSimpleNumberKeys { version: "1.0.0", name: "useSimpleNumberKeys", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/complexity/use_simplified_logic_expression.rs b/crates/biome_js_analyze/src/analyzers/complexity/use_simplified_logic_expression.rs index 46aae2e54c56..0aaae4f97864 100644 --- a/crates/biome_js_analyze/src/analyzers/complexity/use_simplified_logic_expression.rs +++ b/crates/biome_js_analyze/src/analyzers/complexity/use_simplified_logic_expression.rs @@ -48,7 +48,7 @@ declare_rule! { /// const boolExpr6 = false; /// ``` /// - pub(crate) UseSimplifiedLogicExpression { + pub UseSimplifiedLogicExpression { version: "1.0.0", name: "useSimplifiedLogicExpression", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/correctness.rs b/crates/biome_js_analyze/src/analyzers/correctness.rs index 7a2db2ad2b2c..105289e35606 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness.rs @@ -2,29 +2,29 @@ use biome_analyze::declare_group; -pub(crate) mod no_constructor_return; -pub(crate) mod no_empty_character_class_in_regex; -pub(crate) mod no_empty_pattern; -pub(crate) mod no_inner_declarations; -pub(crate) mod no_invalid_constructor_super; -pub(crate) mod no_nonoctal_decimal_escape; -pub(crate) mod no_precision_loss; -pub(crate) mod no_self_assign; -pub(crate) mod no_setter_return; -pub(crate) mod no_string_case_mismatch; -pub(crate) mod no_switch_declarations; -pub(crate) mod no_unnecessary_continue; -pub(crate) mod no_unreachable; -pub(crate) mod no_unreachable_super; -pub(crate) mod no_unsafe_finally; -pub(crate) mod no_unsafe_optional_chaining; -pub(crate) mod no_unused_labels; -pub(crate) mod no_void_type_return; -pub(crate) mod use_valid_for_direction; -pub(crate) mod use_yield; +pub mod no_constructor_return; +pub mod no_empty_character_class_in_regex; +pub mod no_empty_pattern; +pub mod no_inner_declarations; +pub mod no_invalid_constructor_super; +pub mod no_nonoctal_decimal_escape; +pub mod no_precision_loss; +pub mod no_self_assign; +pub mod no_setter_return; +pub mod no_string_case_mismatch; +pub mod no_switch_declarations; +pub mod no_unnecessary_continue; +pub mod no_unreachable; +pub mod no_unreachable_super; +pub mod no_unsafe_finally; +pub mod no_unsafe_optional_chaining; +pub mod no_unused_labels; +pub mod no_void_type_return; +pub mod use_valid_for_direction; +pub mod use_yield; declare_group! { - pub (crate) Correctness { + pub Correctness { name : "correctness" , rules : [ self :: no_constructor_return :: NoConstructorReturn , diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_constructor_return.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_constructor_return.rs index 0e6ef172f2f4..ddc6f18e3f95 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_constructor_return.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_constructor_return.rs @@ -43,7 +43,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoConstructorReturn { + pub NoConstructorReturn { version: "1.0.0", name: "noConstructorReturn", source: RuleSource::Eslint("no-constructor-return"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_empty_character_class_in_regex.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_empty_character_class_in_regex.rs index f3035e9ae782..d1866ba9c1ce 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_empty_character_class_in_regex.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_empty_character_class_in_regex.rs @@ -38,7 +38,7 @@ declare_rule! { /// /^a\[]/.test("a[]"); // true /// ``` /// - pub(crate) NoEmptyCharacterClassInRegex { + pub NoEmptyCharacterClassInRegex { version: "1.3.0", name: "noEmptyCharacterClassInRegex", source: RuleSource::Eslint("no-empty-character-class"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_empty_pattern.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_empty_pattern.rs index 2eec360b06c2..19bbb80b74b8 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_empty_pattern.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_empty_pattern.rs @@ -32,7 +32,7 @@ declare_rule! { /// function foo({a = []}) {} /// var [a] = foo; /// ``` - pub(crate) NoEmptyPattern { + pub NoEmptyPattern { version: "1.0.0", name: "noEmptyPattern", source: RuleSource::Eslint("no-empty-pattern"), @@ -85,5 +85,5 @@ impl Rule for NoEmptyPattern { declare_node_union! { /// enum of `JsObjectBindingPattern` and `JsArrayBindingPattern` - pub(crate) JsAnyBindPatternLike = JsArrayBindingPattern | JsObjectBindingPattern + pub JsAnyBindPatternLike = JsArrayBindingPattern | JsObjectBindingPattern } diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_inner_declarations.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_inner_declarations.rs index 618659e1b468..bd226672e2c5 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_inner_declarations.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_inner_declarations.rs @@ -85,7 +85,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoInnerDeclarations { + pub NoInnerDeclarations { version: "1.0.0", name: "noInnerDeclarations", source: RuleSource::Eslint("no-inner-declarations"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_invalid_constructor_super.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_invalid_constructor_super.rs index 12bcdc25c7e6..21fac5baa67a 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_invalid_constructor_super.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_invalid_constructor_super.rs @@ -45,7 +45,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoInvalidConstructorSuper { + pub NoInvalidConstructorSuper { version: "1.0.0", name: "noInvalidConstructorSuper", source: RuleSource::Eslint("constructor-super"), @@ -53,7 +53,7 @@ declare_rule! { } } -pub(crate) enum NoInvalidConstructorSuperState { +pub enum NoInvalidConstructorSuperState { UnexpectedSuper(TextRange), BadExtends { extends_range: TextRange, diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_nonoctal_decimal_escape.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_nonoctal_decimal_escape.rs index 5ce39d61ba7b..8d99643897b9 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_nonoctal_decimal_escape.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_nonoctal_decimal_escape.rs @@ -53,7 +53,7 @@ declare_rule! { /// const x = "Don't use \\8 and \\9 escapes."; /// ``` /// - pub(crate) NoNonoctalDecimalEscape { + pub NoNonoctalDecimalEscape { version: "1.0.0", name: "noNonoctalDecimalEscape", source: RuleSource::Eslint("no-nonoctal-decimal-escape"), @@ -63,12 +63,12 @@ declare_rule! { } #[derive(Debug)] -pub(crate) enum FixSuggestionKind { +pub enum FixSuggestionKind { Refactor, } #[derive(Debug)] -pub(crate) struct RuleState { +pub struct RuleState { kind: FixSuggestionKind, diagnostics_text_range: TextRange, replace_from: String, diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_precision_loss.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_precision_loss.rs index aa20b32ddbde..6ed39059eaaf 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_precision_loss.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_precision_loss.rs @@ -45,7 +45,7 @@ declare_rule! { /// const x = 9007_1992547409_91 /// ``` /// - pub(crate) NoPrecisionLoss { + pub NoPrecisionLoss { version: "1.0.0", name: "noPrecisionLoss", source: RuleSource::Eslint("no-loss-of-precision"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_self_assign.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_self_assign.rs index 5282102f275e..0a391889f51a 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_self_assign.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_self_assign.rs @@ -63,7 +63,7 @@ declare_rule! { /// [a, b] = [b, a]; /// ``` /// - pub(crate) NoSelfAssign { + pub NoSelfAssign { version: "1.0.0", name: "noSelfAssign", source: RuleSource::Eslint("no-self-assign"), @@ -546,11 +546,11 @@ enum AnyAssignmentLike { } declare_node_union! { - pub(crate) AnyNameLike = AnyJsName | JsReferenceIdentifier | AnyJsLiteralExpression + pub AnyNameLike = AnyJsName | JsReferenceIdentifier | AnyJsLiteralExpression } declare_node_union! { - pub(crate) AnyAssignmentExpressionLike = JsStaticMemberExpression | JsComputedMemberExpression + pub AnyAssignmentExpressionLike = JsStaticMemberExpression | JsComputedMemberExpression } impl AnyAssignmentExpressionLike { @@ -656,7 +656,7 @@ impl TryFrom<(AnyJsAssignmentPattern, AnyJsExpression)> for AnyAssignmentLike { /// - the first one is the identifier found in the left arm of the assignment; /// - the second one is the identifier found in the right arm of the assignment; #[derive(Debug, Clone)] -pub(crate) enum IdentifiersLike { +pub enum IdentifiersLike { /// To store identifiers found in code like: /// /// ```js diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_setter_return.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_setter_return.rs index a687c43a886f..565e516e6d21 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_setter_return.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_setter_return.rs @@ -64,7 +64,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoSetterReturn { + pub NoSetterReturn { version: "1.0.0", name: "noSetterReturn", source: RuleSource::Eslint("no-setter-return"), @@ -73,7 +73,7 @@ declare_rule! { } declare_node_union! { - pub(crate) JsSetterMember = JsSetterClassMember | JsSetterObjectMember + pub JsSetterMember = JsSetterClassMember | JsSetterObjectMember } impl Rule for NoSetterReturn { diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_string_case_mismatch.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_string_case_mismatch.rs index a64785420243..29c3d10aad16 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_string_case_mismatch.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_string_case_mismatch.rs @@ -31,7 +31,7 @@ declare_rule! { /// while (s.toLocaleUpperCase() === "abc") {} /// for (let s = "abc"; s === "abc"; s = s.toUpperCase()) {} /// ``` - pub(crate) NoStringCaseMismatch { + pub NoStringCaseMismatch { version: "1.0.0", name: "noStringCaseMismatch", source: RuleSource::Clippy("match_str_case_mismatch"), @@ -109,10 +109,10 @@ impl Rule for NoStringCaseMismatch { } declare_node_union! { - pub(crate) QueryCandidate = JsBinaryExpression | JsSwitchStatement + pub QueryCandidate = JsBinaryExpression | JsSwitchStatement } -pub(crate) struct CaseMismatchInfo { +pub struct CaseMismatchInfo { expected_case: ExpectedStringCase, expected_value: String, call: JsCallExpression, diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_switch_declarations.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_switch_declarations.rs index 543afeb4b2dc..66889bc9df8d 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_switch_declarations.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_switch_declarations.rs @@ -69,7 +69,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoSwitchDeclarations { + pub NoSwitchDeclarations { version: "1.0.0", name: "noSwitchDeclarations", source: RuleSource::Eslint("no-case-declarations"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unnecessary_continue.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unnecessary_continue.rs index 1efad3709731..cc1fea6339be 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unnecessary_continue.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unnecessary_continue.rs @@ -71,7 +71,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoUnnecessaryContinue { + pub NoUnnecessaryContinue { version: "1.0.0", name: "noUnnecessaryContinue", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable.rs index d3e339fa2670..cd1d05d47464 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable.rs @@ -47,7 +47,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoUnreachable { + pub NoUnreachable { version: "1.0.0", name: "noUnreachable", source: RuleSource::Eslint("no-unreachable"), @@ -616,7 +616,7 @@ fn handle_return<'cfg>( /// Stores a list of unreachable code ranges, sorted in ascending source order #[derive(Debug)] -pub(crate) struct UnreachableRanges { +pub struct UnreachableRanges { ranges: Vec, } @@ -940,7 +940,7 @@ impl IntoIterator for UnreachableRanges { /// code, along with a list of secondary labels pointing to the dominating /// terminator instructions that cause it to be unreachable #[derive(Debug)] -pub(crate) struct UnreachableRange { +pub struct UnreachableRange { text_range: TextRange, text_trimmed_range: TextRange, terminators: Vec, diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable_super.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable_super.rs index 473c11eae6aa..e1fabf7ede9f 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable_super.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unreachable_super.rs @@ -61,7 +61,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUnreachableSuper { + pub NoUnreachableSuper { version: "1.0.0", name: "noUnreachableSuper", source: RuleSource::Eslint("no-this-before-super"), @@ -70,7 +70,7 @@ declare_rule! { } #[allow(clippy::enum_variant_names)] -pub(crate) enum RuleState { +pub enum RuleState { /// The constructor may call `super` multiple times DuplicateSuper { first: TextRange, second: TextRange }, /// The constructor may read or write from `this` without calling `super` diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_finally.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_finally.rs index 41dc4685944b..df2d0141687d 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_finally.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_finally.rs @@ -124,7 +124,7 @@ declare_rule! { /// }; /// ``` /// - pub(crate) NoUnsafeFinally { + pub NoUnsafeFinally { version: "1.0.0", name: "noUnsafeFinally", source: RuleSource::Eslint("no-unsafe-finally"), @@ -133,7 +133,7 @@ declare_rule! { } declare_node_union! { - pub(crate) ControlFlowStatement = JsReturnStatement | JsThrowStatement | JsBreakStatement | JsContinueStatement + pub ControlFlowStatement = JsReturnStatement | JsThrowStatement | JsBreakStatement | JsContinueStatement } impl Rule for NoUnsafeFinally { diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_optional_chaining.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_optional_chaining.rs index 24acb997db30..1b0bce6a0db0 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_optional_chaining.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unsafe_optional_chaining.rs @@ -61,7 +61,7 @@ declare_rule! { /// foo?.()?.bar; /// ``` /// - pub(crate) NoUnsafeOptionalChaining { + pub NoUnsafeOptionalChaining { version: "1.0.0", name: "noUnsafeOptionalChaining", source: RuleSource::Eslint("no-unsafe-optional-chaining"), @@ -309,7 +309,7 @@ impl Rule for NoUnsafeOptionalChaining { declare_node_union! { /// Only these variants of the union can be part of an unsafe optional chain. - pub(crate) RuleNode = + pub RuleNode = JsLogicalExpression | JsSequenceExpression | JsConditionalExpression diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_unused_labels.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_unused_labels.rs index 58118d77db71..8e1029bd6b4b 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_unused_labels.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_unused_labels.rs @@ -51,7 +51,7 @@ declare_rule! { /// return n; /// } /// ``` - pub(crate) NoUnusedLabels { + pub NoUnusedLabels { version: "1.0.0", name: "noUnusedLabels", source: RuleSource::Eslint("no-unused-labels"), @@ -122,7 +122,7 @@ impl Visitor for UnusedLabelVisitor { } } -pub(crate) struct UnusedLabel(JsLabeledStatement); +pub struct UnusedLabel(JsLabeledStatement); impl QueryMatch for UnusedLabel { fn text_range(&self) -> TextRange { diff --git a/crates/biome_js_analyze/src/analyzers/correctness/no_void_type_return.rs b/crates/biome_js_analyze/src/analyzers/correctness/no_void_type_return.rs index 180ad97a351b..6fabd6588e1a 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/no_void_type_return.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/no_void_type_return.rs @@ -84,7 +84,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoVoidTypeReturn { + pub NoVoidTypeReturn { version: "1.0.0", name: "noVoidTypeReturn", recommended: true, @@ -92,7 +92,7 @@ declare_rule! { } declare_node_union! { - pub(crate) JsFunctionMethod = JsArrowFunctionExpression | JsFunctionDeclaration | JsFunctionExportDefaultDeclaration | JsFunctionExpression | JsGetterClassMember | JsGetterObjectMember | JsMethodClassMember | JsMethodObjectMember + pub JsFunctionMethod = JsArrowFunctionExpression | JsFunctionDeclaration | JsFunctionExportDefaultDeclaration | JsFunctionExpression | JsGetterClassMember | JsGetterObjectMember | JsMethodClassMember | JsMethodObjectMember } pub(crate) fn return_type(func: &JsFunctionMethod) -> Option { diff --git a/crates/biome_js_analyze/src/analyzers/correctness/use_valid_for_direction.rs b/crates/biome_js_analyze/src/analyzers/correctness/use_valid_for_direction.rs index 195638797e66..788f865a05ea 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/use_valid_for_direction.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/use_valid_for_direction.rs @@ -38,7 +38,7 @@ declare_rule! { /// for (var i = 0; i < 10; i++) { /// } /// ``` - pub(crate) UseValidForDirection { + pub UseValidForDirection { version: "1.0.0", name: "useValidForDirection", source: RuleSource::Eslint("for-direction"), diff --git a/crates/biome_js_analyze/src/analyzers/correctness/use_yield.rs b/crates/biome_js_analyze/src/analyzers/correctness/use_yield.rs index 64b2c92b0dc6..5b8241b053e8 100644 --- a/crates/biome_js_analyze/src/analyzers/correctness/use_yield.rs +++ b/crates/biome_js_analyze/src/analyzers/correctness/use_yield.rs @@ -36,7 +36,7 @@ declare_rule! { /// // This rule does not warn on empty generator functions. /// function* foo() { } /// ``` - pub(crate) UseYield { + pub UseYield { version: "1.0.0", name: "useYield", source: RuleSource::Eslint("require-yield"), @@ -94,7 +94,7 @@ impl Visitor for MissingYieldVisitor { } } -pub(crate) struct MissingYield(AnyFunctionLike); +pub struct MissingYield(AnyFunctionLike); impl QueryMatch for MissingYield { fn text_range(&self) -> TextRange { diff --git a/crates/biome_js_analyze/src/analyzers/nursery.rs b/crates/biome_js_analyze/src/analyzers/nursery.rs index 593b1ca4fdcb..6f186bd2c926 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery.rs @@ -2,28 +2,28 @@ use biome_analyze::declare_group; -pub(crate) mod no_empty_block_statements; -pub(crate) mod no_empty_type_parameters; -pub(crate) mod no_focused_tests; -pub(crate) mod no_namespace_import; -pub(crate) mod no_nodejs_modules; -pub(crate) mod no_restricted_imports; -pub(crate) mod no_skipped_tests; -pub(crate) mod no_undeclared_dependencies; -pub(crate) mod no_unused_private_class_members; -pub(crate) mod no_useless_lone_block_statements; -pub(crate) mod no_useless_ternary; -pub(crate) mod use_await; -pub(crate) mod use_consistent_array_type; -pub(crate) mod use_filenaming_convention; -pub(crate) mod use_grouped_type_import; -pub(crate) mod use_import_restrictions; -pub(crate) mod use_node_assert_strict; -pub(crate) mod use_nodejs_import_protocol; -pub(crate) mod use_shorthand_function_type; +pub mod no_empty_block_statements; +pub mod no_empty_type_parameters; +pub mod no_focused_tests; +pub mod no_namespace_import; +pub mod no_nodejs_modules; +pub mod no_restricted_imports; +pub mod no_skipped_tests; +pub mod no_undeclared_dependencies; +pub mod no_unused_private_class_members; +pub mod no_useless_lone_block_statements; +pub mod no_useless_ternary; +pub mod use_await; +pub mod use_consistent_array_type; +pub mod use_filenaming_convention; +pub mod use_grouped_type_import; +pub mod use_import_restrictions; +pub mod use_node_assert_strict; +pub mod use_nodejs_import_protocol; +pub mod use_shorthand_function_type; declare_group! { - pub (crate) Nursery { + pub Nursery { name : "nursery" , rules : [ self :: no_empty_block_statements :: NoEmptyBlockStatements , diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_empty_block_statements.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_empty_block_statements.rs index b6ab7f177184..4a6aa578b338 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_empty_block_statements.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_empty_block_statements.rs @@ -51,7 +51,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoEmptyBlockStatements { + pub NoEmptyBlockStatements { version: "1.3.0", name: "noEmptyBlockStatements", // Include also `eslint/no-empty-static-block` @@ -61,7 +61,7 @@ declare_rule! { } declare_node_union! { - pub(crate) Query = JsBlockStatement | JsFunctionBody | JsStaticInitializationBlockClassMember | JsSwitchStatement + pub Query = JsBlockStatement | JsFunctionBody | JsStaticInitializationBlockClassMember | JsSwitchStatement } impl Rule for NoEmptyBlockStatements { diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_empty_type_parameters.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_empty_type_parameters.rs index 068da914e130..6b71c698a8f9 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_empty_type_parameters.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_empty_type_parameters.rs @@ -34,7 +34,7 @@ declare_rule! { /// bar: T; /// } /// ``` - pub(crate) NoEmptyTypeParameters { + pub NoEmptyTypeParameters { version: "1.5.0", name: "noEmptyTypeParameters", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_focused_tests.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_focused_tests.rs index 16ea94ee41ec..a7c0baf5cc49 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_focused_tests.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_focused_tests.rs @@ -33,7 +33,7 @@ declare_rule! { /// ```js /// test("foo", () => {}); /// ``` - pub(crate) NoFocusedTests { + pub NoFocusedTests { version: "next", name: "noFocusedTests", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_namespace_import.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_namespace_import.rs index 45e3f6eabf21..28cc8fa04430 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_namespace_import.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_namespace_import.rs @@ -28,7 +28,7 @@ declare_rule! { /// import type * as baz from "baz" /// ``` /// - pub(crate) NoNamespaceImport { + pub NoNamespaceImport { version: "next", name: "noNamespaceImport", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_nodejs_modules.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_nodejs_modules.rs index c5e5317cac22..a4cadddbd4ef 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_nodejs_modules.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_nodejs_modules.rs @@ -26,7 +26,7 @@ declare_rule! { /// ```js /// import fs from "fs-custom"; /// ``` - pub(crate) NoNodejsModules { + pub NoNodejsModules { version: "1.5.0", name: "noNodejsModules", source: RuleSource::EslintImport("no-nodejs-modules"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_restricted_imports.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_restricted_imports.rs index 2dce6d1faf9e..463db90d6d42 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_restricted_imports.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_restricted_imports.rs @@ -24,7 +24,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoRestrictedImports { + pub NoRestrictedImports { version: "next", name: "noRestrictedImports", source: RuleSource::Eslint("no-restricted-imports"), @@ -46,7 +46,7 @@ impl Rule for NoRestrictedImports { type Query = Ast; type State = (TextRange, String); type Signals = Option; - type Options = RestrictedImportsOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Self::Signals { let module_name = ctx.query().module_name_token()?; diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_skipped_tests.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_skipped_tests.rs index 79f51a8b3089..575b29e824ea 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_skipped_tests.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_skipped_tests.rs @@ -34,7 +34,7 @@ declare_rule! { /// test("test", () => {}); /// ``` /// - pub(crate) NoSkippedTests { + pub NoSkippedTests { version: "next", name: "noSkippedTests", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_undeclared_dependencies.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_undeclared_dependencies.rs index 7036cadd77d3..2972f334b4f3 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_undeclared_dependencies.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_undeclared_dependencies.rs @@ -18,7 +18,7 @@ declare_rule! { /// import "vite"; /// ``` /// - pub(crate) NoUndeclaredDependencies { + pub NoUndeclaredDependencies { version: "next", name: "noUndeclaredDependencies", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_unused_private_class_members.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_unused_private_class_members.rs index 98f8dc80fd6d..ecd47b9d0753 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_unused_private_class_members.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_unused_private_class_members.rs @@ -61,7 +61,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUnusedPrivateClassMembers { + pub NoUnusedPrivateClassMembers { version: "1.3.3", name: "noUnusedPrivateClassMembers", source: RuleSource::Eslint("no-unused-private-class-members"), @@ -71,7 +71,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyMember = AnyJsClassMember | TsPropertyParameter + pub AnyMember = AnyJsClassMember | TsPropertyParameter } impl Rule for NoUnusedPrivateClassMembers { diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_useless_lone_block_statements.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_useless_lone_block_statements.rs index 3ff44d77a60e..46972df35b2a 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_useless_lone_block_statements.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_useless_lone_block_statements.rs @@ -43,7 +43,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUselessLoneBlockStatements { + pub NoUselessLoneBlockStatements { version: "1.3.3", name: "noUselessLoneBlockStatements", source: RuleSource::Eslint("no-lone-blocks"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/no_useless_ternary.rs b/crates/biome_js_analyze/src/analyzers/nursery/no_useless_ternary.rs index 0a24c8a03e79..9e4198f64884 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/no_useless_ternary.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/no_useless_ternary.rs @@ -53,7 +53,7 @@ declare_rule! { /// /// Logical NOT: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_NOT /// - pub(crate) NoUselessTernary { + pub NoUselessTernary { version: "1.5.0", name: "noUselessTernary", source: RuleSource::Eslint("no-unneeded-ternary"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_await.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_await.rs index 3b7f3f05d98e..5a961db2f587 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_await.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_await.rs @@ -45,7 +45,7 @@ declare_rule! { /// // Nor does it warn about empty `async` functions /// async function noop() { } /// ``` - pub(crate) UseAwait { + pub UseAwait { version: "1.4.0", name: "useAwait", source: RuleSource::Eslint("require-await"), @@ -99,7 +99,7 @@ impl Visitor for MissingAwaitVisitor { } } -pub(crate) struct MissingAwait(AnyFunctionLike); +pub struct MissingAwait(AnyFunctionLike); impl QueryMatch for MissingAwait { fn text_range(&self) -> TextRange { diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_consistent_array_type.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_consistent_array_type.rs index 7c231478503f..42c34a1f256a 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_consistent_array_type.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_consistent_array_type.rs @@ -67,7 +67,7 @@ declare_rule! { /// By default, all array declarations will be converted to `T[]` or `readonly T[]`, which it means `shorthand`, /// or if the options is set to the "generic", that all will converted to `Array` or `ReadonlyArray`. /// - pub(crate) UseConsistentArrayType { + pub UseConsistentArrayType { version: "1.5.0", name: "useConsistentArrayType", source: RuleSource::EslintTypeScript("array-type"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_filenaming_convention.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_filenaming_convention.rs index 5be43ecfe946..28087f7eb8ea 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_filenaming_convention.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_filenaming_convention.rs @@ -75,7 +75,7 @@ declare_rule! { /// [`kebab-case`]: https://en.wikipedia.org/wiki/Letter_case#Kebab_case /// [`PascalCase`]: https://en.wikipedia.org/wiki/Camel_case /// [`snake_case`]: https://en.wikipedia.org/wiki/Snake_case - pub(crate) UseFilenamingConvention { + pub UseFilenamingConvention { version: "1.5.0", name: "useFilenamingConvention", source: RuleSource::EslintUnicorn("filename-case"), @@ -88,7 +88,7 @@ impl Rule for UseFilenamingConvention { type Query = SemanticServices; type State = FileNamingConventionState; type Signals = Option; - type Options = FilenamingConventionOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Self::Signals { let file_name = ctx.file_path().file_name()?.to_str()?; @@ -226,7 +226,7 @@ impl Rule for UseFilenamingConvention { } #[derive(Debug)] -pub(crate) enum FileNamingConventionState { +pub enum FileNamingConventionState { /// The name is not in ASCII while `reuireAscii` is enabled. Ascii, /// The filename doesn't match the expected case diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_grouped_type_import.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_grouped_type_import.rs index c536e5eb5f71..9b8a52d9ebed 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_grouped_type_import.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_grouped_type_import.rs @@ -57,7 +57,7 @@ declare_rule! { /// ```ts /// import { A, type B } from "mod"; /// ``` - pub(crate) UseGroupedTypeImport { + pub UseGroupedTypeImport { version: "1.0.0", name: "useGroupedTypeImport", source: RuleSource::EslintTypeScript("no-import-type-side-effects"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_import_restrictions.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_import_restrictions.rs index d2abb221ff33..8879be472ae6 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_import_restrictions.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_import_restrictions.rs @@ -72,7 +72,7 @@ declare_rule! { /// import useAsync from "react-use/lib/useAsync"; /// ``` /// - pub(crate) UseImportRestrictions { + pub UseImportRestrictions { version: "1.0.0", name: "useImportRestrictions", source: RuleSource::EslintImportAccess("eslint-plugin-import-access"), @@ -115,7 +115,7 @@ impl Rule for UseImportRestrictions { } } -pub(crate) struct ImportRestrictionsState { +pub struct ImportRestrictionsState { /// The path that is being restricted. path: String, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_node_assert_strict.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_node_assert_strict.rs index 864a553d9f7f..958ddb5827f6 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_node_assert_strict.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_node_assert_strict.rs @@ -26,7 +26,7 @@ declare_rule! { /// import * as assert from "node:assert/strict" /// ``` /// - pub(crate) UseNodeAssertStrict { + pub UseNodeAssertStrict { version: "next", name: "useNodeAssertStrict", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_nodejs_import_protocol.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_nodejs_import_protocol.rs index 6b14d29ed159..0edd2b69b26e 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_nodejs_import_protocol.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_nodejs_import_protocol.rs @@ -41,7 +41,7 @@ declare_rule! { /// import path from 'node:path'; /// ``` /// - pub(crate) UseNodejsImportProtocol { + pub UseNodejsImportProtocol { version: "1.5.0", name: "useNodejsImportProtocol", source: RuleSource::EslintUnicorn("prefer-node-protocol"), diff --git a/crates/biome_js_analyze/src/analyzers/nursery/use_shorthand_function_type.rs b/crates/biome_js_analyze/src/analyzers/nursery/use_shorthand_function_type.rs index f8f69242ad48..5c1a9bd02179 100644 --- a/crates/biome_js_analyze/src/analyzers/nursery/use_shorthand_function_type.rs +++ b/crates/biome_js_analyze/src/analyzers/nursery/use_shorthand_function_type.rs @@ -78,7 +78,7 @@ declare_rule! { /// type Intersection = ((data: string) => number) & ((id: number) => string); ///``` /// - pub(crate) UseShorthandFunctionType { + pub UseShorthandFunctionType { version: "1.5.0", name: "useShorthandFunctionType", source: RuleSource::EslintTypeScript("prefer-function-type"), diff --git a/crates/biome_js_analyze/src/analyzers/performance.rs b/crates/biome_js_analyze/src/analyzers/performance.rs index f4b8ca632ce1..b7495d528ba5 100644 --- a/crates/biome_js_analyze/src/analyzers/performance.rs +++ b/crates/biome_js_analyze/src/analyzers/performance.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod no_delete; +pub mod no_delete; declare_group! { - pub (crate) Performance { + pub Performance { name : "performance" , rules : [ self :: no_delete :: NoDelete , diff --git a/crates/biome_js_analyze/src/analyzers/performance/no_delete.rs b/crates/biome_js_analyze/src/analyzers/performance/no_delete.rs index ba5c93f5ff0d..c6cd97d1c1a7 100644 --- a/crates/biome_js_analyze/src/analyzers/performance/no_delete.rs +++ b/crates/biome_js_analyze/src/analyzers/performance/no_delete.rs @@ -58,7 +58,7 @@ declare_rule! { /// delete f(); // uncovered by this rule. ///``` /// - pub(crate) NoDelete { + pub NoDelete { version: "1.0.0", name: "noDelete", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/style.rs b/crates/biome_js_analyze/src/analyzers/style.rs index 6113daa20bea..b360479047b9 100644 --- a/crates/biome_js_analyze/src/analyzers/style.rs +++ b/crates/biome_js_analyze/src/analyzers/style.rs @@ -2,34 +2,34 @@ use biome_analyze::declare_group; -pub(crate) mod no_comma_operator; -pub(crate) mod no_default_export; -pub(crate) mod no_implicit_boolean; -pub(crate) mod no_inferrable_types; -pub(crate) mod no_namespace; -pub(crate) mod no_negation_else; -pub(crate) mod no_non_null_assertion; -pub(crate) mod no_parameter_properties; -pub(crate) mod no_unused_template_literal; -pub(crate) mod no_useless_else; -pub(crate) mod use_as_const_assertion; -pub(crate) mod use_block_statements; -pub(crate) mod use_collapsed_else_if; -pub(crate) mod use_default_parameter_last; -pub(crate) mod use_enum_initializers; -pub(crate) mod use_exponentiation_operator; -pub(crate) mod use_literal_enum_members; -pub(crate) mod use_numeric_literals; -pub(crate) mod use_self_closing_elements; -pub(crate) mod use_shorthand_array_type; -pub(crate) mod use_shorthand_assign; -pub(crate) mod use_single_case_statement; -pub(crate) mod use_single_var_declarator; -pub(crate) mod use_template; -pub(crate) mod use_while; +pub mod no_comma_operator; +pub mod no_default_export; +pub mod no_implicit_boolean; +pub mod no_inferrable_types; +pub mod no_namespace; +pub mod no_negation_else; +pub mod no_non_null_assertion; +pub mod no_parameter_properties; +pub mod no_unused_template_literal; +pub mod no_useless_else; +pub mod use_as_const_assertion; +pub mod use_block_statements; +pub mod use_collapsed_else_if; +pub mod use_default_parameter_last; +pub mod use_enum_initializers; +pub mod use_exponentiation_operator; +pub mod use_literal_enum_members; +pub mod use_numeric_literals; +pub mod use_self_closing_elements; +pub mod use_shorthand_array_type; +pub mod use_shorthand_assign; +pub mod use_single_case_statement; +pub mod use_single_var_declarator; +pub mod use_template; +pub mod use_while; declare_group! { - pub (crate) Style { + pub Style { name : "style" , rules : [ self :: no_comma_operator :: NoCommaOperator , diff --git a/crates/biome_js_analyze/src/analyzers/style/no_comma_operator.rs b/crates/biome_js_analyze/src/analyzers/style/no_comma_operator.rs index 6bdcf74d5b72..1c0a67011d1e 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_comma_operator.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_comma_operator.rs @@ -36,7 +36,7 @@ declare_rule! { /// for(a = 0, b = 0; (a + b) < 10; a++, b += 2) {} /// ``` /// - pub(crate) NoCommaOperator { + pub NoCommaOperator { version: "1.0.0", name: "noCommaOperator", source: RuleSource::Eslint("no-sequences"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_default_export.rs b/crates/biome_js_analyze/src/analyzers/style/no_default_export.rs index eee63f3a3181..dd1564503852 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_default_export.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_default_export.rs @@ -56,7 +56,7 @@ declare_rule! { /// module.exports = class {}; /// ``` /// - pub(crate) NoDefaultExport { + pub NoDefaultExport { version: "1.4.0", name: "noDefaultExport", source: RuleSource::EslintImport("no-default-export"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_implicit_boolean.rs b/crates/biome_js_analyze/src/analyzers/style/no_implicit_boolean.rs index 2c9cda894405..3690e5997098 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_implicit_boolean.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_implicit_boolean.rs @@ -44,7 +44,7 @@ declare_rule! { /// ```jsx /// ///``` - pub(crate) NoImplicitBoolean { + pub NoImplicitBoolean { version: "1.0.0", name: "noImplicitBoolean", source: RuleSource::EslintReact("jsx-boolean-value"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_inferrable_types.rs b/crates/biome_js_analyze/src/analyzers/style/no_inferrable_types.rs index 0deb24483f03..24eb4ef0a4f9 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_inferrable_types.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_inferrable_types.rs @@ -95,7 +95,7 @@ declare_rule! { /// function f(param: 1 | 2 = 1): void {} /// ``` /// - pub(crate) NoInferrableTypes { + pub NoInferrableTypes { version: "1.0.0", name: "noInferrableTypes", source: RuleSource::EslintTypeScript("no-inferrable-types"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_namespace.rs b/crates/biome_js_analyze/src/analyzers/style/no_namespace.rs index d72f29b6a8c6..1f01caf68097 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_namespace.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_namespace.rs @@ -45,7 +45,7 @@ declare_rule! { /// declare module 'foo' {} /// ``` /// - pub(crate) NoNamespace { + pub NoNamespace { version: "1.0.0", name: "noNamespace", source: RuleSource::EslintTypeScript("no-namespace"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_negation_else.rs b/crates/biome_js_analyze/src/analyzers/style/no_negation_else.rs index b648226ed1f6..06dd5d5e057a 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_negation_else.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_negation_else.rs @@ -44,7 +44,7 @@ declare_rule! { /// ```js /// if (!!val) { f(); } else { g(); } ///``` - pub(crate) NoNegationElse { + pub NoNegationElse { version: "1.0.0", name: "noNegationElse", source: RuleSource::Eslint("no-negated-condition"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_non_null_assertion.rs b/crates/biome_js_analyze/src/analyzers/style/no_non_null_assertion.rs index 7fca46bce524..98d088627ad3 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_non_null_assertion.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_non_null_assertion.rs @@ -45,7 +45,7 @@ declare_rule! { /// const includesBaz = foo.property?.includes('baz') ?? false; /// ``` /// - pub(crate) NoNonNullAssertion { + pub NoNonNullAssertion { version: "1.0.0", name: "noNonNullAssertion", source: RuleSource::EslintTypeScript("no-non-null-assertion"), @@ -55,7 +55,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyTsNonNullAssertion = TsNonNullAssertionExpression | TsNonNullAssertionAssignment + pub AnyTsNonNullAssertion = TsNonNullAssertionExpression | TsNonNullAssertionAssignment } impl Rule for NoNonNullAssertion { diff --git a/crates/biome_js_analyze/src/analyzers/style/no_parameter_properties.rs b/crates/biome_js_analyze/src/analyzers/style/no_parameter_properties.rs index 74cfcc5be892..7c174558ef63 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_parameter_properties.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_parameter_properties.rs @@ -30,7 +30,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoParameterProperties { + pub NoParameterProperties { version: "1.0.0", name: "noParameterProperties", source: RuleSource::EslintTypeScript("parameter-properties"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_unused_template_literal.rs b/crates/biome_js_analyze/src/analyzers/style/no_unused_template_literal.rs index e7b8f5540366..de5c3dac64a5 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_unused_template_literal.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_unused_template_literal.rs @@ -38,7 +38,7 @@ declare_rule! { /// ```js /// const foo = `'bar'` /// ``` - pub(crate) NoUnusedTemplateLiteral { + pub NoUnusedTemplateLiteral { version: "1.0.0", name: "noUnusedTemplateLiteral", source: RuleSource::EslintTypeScript("no-useless-template-literals"), diff --git a/crates/biome_js_analyze/src/analyzers/style/no_useless_else.rs b/crates/biome_js_analyze/src/analyzers/style/no_useless_else.rs index 370ca706408b..7084f8150df9 100644 --- a/crates/biome_js_analyze/src/analyzers/style/no_useless_else.rs +++ b/crates/biome_js_analyze/src/analyzers/style/no_useless_else.rs @@ -85,7 +85,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoUselessElse { + pub NoUselessElse { version: "1.3.0", name: "noUselessElse", source: RuleSource::Eslint("no-else-return"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_as_const_assertion.rs b/crates/biome_js_analyze/src/analyzers/style/use_as_const_assertion.rs index 40a57843ac4d..28e54c73f5ab 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_as_const_assertion.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_as_const_assertion.rs @@ -45,7 +45,7 @@ declare_rule! { /// let bar = 'bar' as string; /// let foo = { bar: 'baz' }; /// ``` - pub(crate) UseAsConstAssertion { + pub UseAsConstAssertion { version: "1.3.0", name: "useAsConstAssertion", source: RuleSource::EslintTypeScript("prefer-as-const"), @@ -55,10 +55,10 @@ declare_rule! { } declare_node_union! { - pub(crate) Query = JsVariableDeclarator | JsPropertyClassMember | TsAsExpression | TsTypeAssertionExpression + pub Query = JsVariableDeclarator | JsPropertyClassMember | TsAsExpression | TsTypeAssertionExpression } -pub(crate) enum RuleState { +pub enum RuleState { AsAssertion(TextRange), /// The angle bracket assertion is useful when the JSX option is None in tsconfig.json. AngleBracketAssertion(TextRange), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_block_statements.rs b/crates/biome_js_analyze/src/analyzers/style/use_block_statements.rs index 70f03ee4026c..100db88afaeb 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_block_statements.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_block_statements.rs @@ -65,7 +65,7 @@ declare_rule! { /// ```js,expect_diagnostic /// with (x); /// ``` - pub(crate) UseBlockStatements { + pub UseBlockStatements { version: "1.0.0", name: "useBlockStatements", source: RuleSource::Eslint("curly"), @@ -75,7 +75,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyJsBlockStatement = JsIfStatement | JsElseClause | JsDoWhileStatement | JsForInStatement | JsForOfStatement | JsForStatement | JsWhileStatement | JsWithStatement + pub AnyJsBlockStatement = JsIfStatement | JsElseClause | JsDoWhileStatement | JsForInStatement | JsForOfStatement | JsForStatement | JsWhileStatement | JsWithStatement } impl Rule for UseBlockStatements { diff --git a/crates/biome_js_analyze/src/analyzers/style/use_collapsed_else_if.rs b/crates/biome_js_analyze/src/analyzers/style/use_collapsed_else_if.rs index 2f2abe678bee..e2c6718bbc12 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_collapsed_else_if.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_collapsed_else_if.rs @@ -81,7 +81,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseCollapsedElseIf { + pub UseCollapsedElseIf { version: "1.1.0", name: "useCollapsedElseIf", source: RuleSource::Eslint("no-lonely-if"), @@ -90,7 +90,7 @@ declare_rule! { } } -pub(crate) struct RuleState { +pub struct RuleState { block_statement: JsBlockStatement, if_statement: JsIfStatement, } diff --git a/crates/biome_js_analyze/src/analyzers/style/use_default_parameter_last.rs b/crates/biome_js_analyze/src/analyzers/style/use_default_parameter_last.rs index 36bad9c2642e..e7f9d4c4fbcc 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_default_parameter_last.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_default_parameter_last.rs @@ -48,7 +48,7 @@ declare_rule! { /// function f(a: number, b = 0, c?: number) {} /// ``` /// - pub(crate) UseDefaultParameterLast { + pub UseDefaultParameterLast { version: "1.0.0", name: "useDefaultParameterLast", source: RuleSource::Eslint("default-param-last"), @@ -58,7 +58,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyFormalParameter = JsFormalParameter | TsPropertyParameter + pub AnyFormalParameter = JsFormalParameter | TsPropertyParameter } impl AnyFormalParameter { diff --git a/crates/biome_js_analyze/src/analyzers/style/use_enum_initializers.rs b/crates/biome_js_analyze/src/analyzers/style/use_enum_initializers.rs index c43c21553b7a..ead97f8eb4cf 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_enum_initializers.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_enum_initializers.rs @@ -64,7 +64,7 @@ declare_rule! { /// Sunny, /// } /// ``` - pub(crate) UseEnumInitializers { + pub UseEnumInitializers { version: "1.0.0", name: "useEnumInitializers", source: RuleSource::EslintTypeScript("prefer-enum-initializers"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs b/crates/biome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs index c4e9ffe1523f..2366c1278be9 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs @@ -53,7 +53,7 @@ declare_rule! { /// let quux = (-1) ** n; /// ``` /// - pub(crate) UseExponentiationOperator { + pub UseExponentiationOperator { version: "1.0.0", name: "useExponentiationOperator", source: RuleSource::Eslint("prefer-exponentiation-operator"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_literal_enum_members.rs b/crates/biome_js_analyze/src/analyzers/style/use_literal_enum_members.rs index 04fa375b6e53..b03fbf0c33e2 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_literal_enum_members.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_literal_enum_members.rs @@ -61,7 +61,7 @@ declare_rule! { /// All = Read | Write /// } /// ``` - pub(crate) UseLiteralEnumMembers { + pub UseLiteralEnumMembers { version: "1.0.0", name: "useLiteralEnumMembers", source: RuleSource::EslintTypeScript("prefer-literal-enum-member"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_numeric_literals.rs b/crates/biome_js_analyze/src/analyzers/style/use_numeric_literals.rs index 2d7b384ba11e..c0be161c7cac 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_numeric_literals.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_numeric_literals.rs @@ -54,7 +54,7 @@ declare_rule! { /// Number.parseInt(foo); /// Number.parseInt(foo, 2); /// ``` - pub(crate) UseNumericLiterals { + pub UseNumericLiterals { version: "1.0.0", name: "useNumericLiterals", source: RuleSource::Eslint("prefer-numeric-literals"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_self_closing_elements.rs b/crates/biome_js_analyze/src/analyzers/style/use_self_closing_elements.rs index bd12df50442d..4f4400fa3323 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_self_closing_elements.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_self_closing_elements.rs @@ -54,7 +54,7 @@ declare_rule! { /// ```js /// child ///``` - pub(crate) UseSelfClosingElements { + pub UseSelfClosingElements { version: "1.0.0", name: "useSelfClosingElements", source: RuleSource::EslintStylistic("jsx-self-closing-comp"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_shorthand_array_type.rs b/crates/biome_js_analyze/src/analyzers/style/use_shorthand_array_type.rs index dbc05cefdee2..41a996752fbf 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_shorthand_array_type.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_shorthand_array_type.rs @@ -49,7 +49,7 @@ declare_rule! { /// let valid: Array; /// let valid: Array; /// ``` - pub(crate) UseShorthandArrayType { + pub UseShorthandArrayType { version: "1.0.0", name: "useShorthandArrayType", source: RuleSource::EslintTypeScript("array-type"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_shorthand_assign.rs b/crates/biome_js_analyze/src/analyzers/style/use_shorthand_assign.rs index fc8ed337bd1f..aa3a48b296ce 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_shorthand_assign.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_shorthand_assign.rs @@ -50,7 +50,7 @@ declare_rule! { /// ```js /// a *= 1; /// ``` - pub(crate) UseShorthandAssign { + pub UseShorthandAssign { version: "1.3.0", name: "useShorthandAssign", source: RuleSource::Eslint("operator-assignment"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_single_case_statement.rs b/crates/biome_js_analyze/src/analyzers/style/use_single_case_statement.rs index 7f0840948112..ad7b2baa1d96 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_single_case_statement.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_single_case_statement.rs @@ -36,7 +36,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) UseSingleCaseStatement { + pub UseSingleCaseStatement { version: "1.0.0", name: "useSingleCaseStatement", recommended: false, diff --git a/crates/biome_js_analyze/src/analyzers/style/use_single_var_declarator.rs b/crates/biome_js_analyze/src/analyzers/style/use_single_var_declarator.rs index 266db04af2e3..fc3f6e50856c 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_single_var_declarator.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_single_var_declarator.rs @@ -41,7 +41,7 @@ declare_rule! { /// ```js /// for (let i = 0, x = 1; i < arr.length; i++) {} /// ``` - pub(crate) UseSingleVarDeclarator { + pub UseSingleVarDeclarator { version: "1.0.0", name: "useSingleVarDeclarator", source: RuleSource::Eslint("one-var"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_template.rs b/crates/biome_js_analyze/src/analyzers/style/use_template.rs index 571ff290b3de..938aa604b6be 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_template.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_template.rs @@ -47,7 +47,7 @@ declare_rule! { /// ```js /// let s = `value: ${1}`; /// ``` - pub(crate) UseTemplate { + pub UseTemplate { version: "1.0.0", name: "useTemplate", source: RuleSource::Eslint("prefer-template"), diff --git a/crates/biome_js_analyze/src/analyzers/style/use_while.rs b/crates/biome_js_analyze/src/analyzers/style/use_while.rs index f8d5363b36a0..8f278b3d80e3 100644 --- a/crates/biome_js_analyze/src/analyzers/style/use_while.rs +++ b/crates/biome_js_analyze/src/analyzers/style/use_while.rs @@ -38,7 +38,7 @@ declare_rule! { /// i++ /// } /// ``` - pub(crate) UseWhile { + pub UseWhile { version: "1.0.0", name: "useWhile", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/suspicious.rs b/crates/biome_js_analyze/src/analyzers/suspicious.rs index 70fbe8624f7c..d9f132dcaeeb 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious.rs @@ -2,41 +2,41 @@ use biome_analyze::declare_group; -pub(crate) mod no_approximative_numeric_constant; -pub(crate) mod no_assign_in_expressions; -pub(crate) mod no_async_promise_executor; -pub(crate) mod no_comment_text; -pub(crate) mod no_compare_neg_zero; -pub(crate) mod no_confusing_labels; -pub(crate) mod no_confusing_void_type; -pub(crate) mod no_const_enum; -pub(crate) mod no_control_characters_in_regex; -pub(crate) mod no_debugger; -pub(crate) mod no_double_equals; -pub(crate) mod no_duplicate_case; -pub(crate) mod no_duplicate_class_members; -pub(crate) mod no_duplicate_jsx_props; -pub(crate) mod no_duplicate_object_keys; -pub(crate) mod no_empty_interface; -pub(crate) mod no_explicit_any; -pub(crate) mod no_extra_non_null_assertion; -pub(crate) mod no_fallthrough_switch_clause; -pub(crate) mod no_implicit_any_let; -pub(crate) mod no_misleading_instantiator; -pub(crate) mod no_misrefactored_shorthand_assign; -pub(crate) mod no_prototype_builtins; -pub(crate) mod no_redundant_use_strict; -pub(crate) mod no_self_compare; -pub(crate) mod no_shadow_restricted_names; -pub(crate) mod no_sparse_array; -pub(crate) mod no_unsafe_negation; -pub(crate) mod use_default_switch_clause_last; -pub(crate) mod use_getter_return; -pub(crate) mod use_namespace_keyword; -pub(crate) mod use_valid_typeof; +pub mod no_approximative_numeric_constant; +pub mod no_assign_in_expressions; +pub mod no_async_promise_executor; +pub mod no_comment_text; +pub mod no_compare_neg_zero; +pub mod no_confusing_labels; +pub mod no_confusing_void_type; +pub mod no_const_enum; +pub mod no_control_characters_in_regex; +pub mod no_debugger; +pub mod no_double_equals; +pub mod no_duplicate_case; +pub mod no_duplicate_class_members; +pub mod no_duplicate_jsx_props; +pub mod no_duplicate_object_keys; +pub mod no_empty_interface; +pub mod no_explicit_any; +pub mod no_extra_non_null_assertion; +pub mod no_fallthrough_switch_clause; +pub mod no_implicit_any_let; +pub mod no_misleading_instantiator; +pub mod no_misrefactored_shorthand_assign; +pub mod no_prototype_builtins; +pub mod no_redundant_use_strict; +pub mod no_self_compare; +pub mod no_shadow_restricted_names; +pub mod no_sparse_array; +pub mod no_unsafe_negation; +pub mod use_default_switch_clause_last; +pub mod use_getter_return; +pub mod use_namespace_keyword; +pub mod use_valid_typeof; declare_group! { - pub (crate) Suspicious { + pub Suspicious { name : "suspicious" , rules : [ self :: no_approximative_numeric_constant :: NoApproximativeNumericConstant , diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_approximative_numeric_constant.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_approximative_numeric_constant.rs index 9ebfd93a0003..aa2cc7e4c5d5 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_approximative_numeric_constant.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_approximative_numeric_constant.rs @@ -43,7 +43,7 @@ declare_rule! { /// ```js /// let x = Math.LN10; /// ``` - pub(crate) NoApproximativeNumericConstant { + pub NoApproximativeNumericConstant { version: "1.3.0", name: "noApproximativeNumericConstant", source: RuleSource::Clippy("approx_constant"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_assign_in_expressions.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_assign_in_expressions.rs index a9598a369843..85eb4aeb8c70 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_assign_in_expressions.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_assign_in_expressions.rs @@ -41,7 +41,7 @@ declare_rule! { /// let a; /// a = 1; /// ``` - pub(crate) NoAssignInExpressions { + pub NoAssignInExpressions { version: "1.0.0", name: "noAssignInExpressions", source: RuleSource::Eslint("no-cond-assign"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_async_promise_executor.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_async_promise_executor.rs index d5151b7ba890..d663ca8370e4 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_async_promise_executor.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_async_promise_executor.rs @@ -36,7 +36,7 @@ declare_rule! { /// new Foo(async (resolve, reject) => {}) /// new Foo((( (resolve, reject) => {} ))) /// ``` - pub(crate) NoAsyncPromiseExecutor { + pub NoAsyncPromiseExecutor { version: "1.0.0", name: "noAsyncPromiseExecutor", source: RuleSource::Eslint("no-async-promise-executor"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_comment_text.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_comment_text.rs index 940fb2cc61da..c15b20d4ced0 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_comment_text.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_comment_text.rs @@ -35,7 +35,7 @@ declare_rule! { /// const a1 =
{/** comment */}
; /// const a2 =
; /// ``` - pub(crate) NoCommentText { + pub NoCommentText { version: "1.0.0", name: "noCommentText", source: RuleSource::EslintReact("jsx-no-comment-textnodes"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_compare_neg_zero.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_compare_neg_zero.rs index 7472b2cf3c98..6ba82886442f 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_compare_neg_zero.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_compare_neg_zero.rs @@ -34,7 +34,7 @@ declare_rule! { /// ```js /// (1 >= 0) ///``` - pub(crate) NoCompareNegZero { + pub NoCompareNegZero { version: "1.0.0", name: "noCompareNegZero", source: RuleSource::Eslint("no-compare-neg-zero"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_labels.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_labels.rs index a082bb43c607..32fa769fdba3 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_labels.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_labels.rs @@ -47,7 +47,7 @@ declare_rule! { /// } /// } /// ``` - pub(crate) NoConfusingLabels { + pub NoConfusingLabels { version: "1.0.0", name: "noConfusingLabels", source: RuleSource::Eslint("no-labels"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_void_type.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_void_type.rs index 739acc0400e0..188151bc5486 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_void_type.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_confusing_void_type.rs @@ -46,7 +46,7 @@ declare_rule! { /// ```ts /// function printArg(arg: T) {} /// ``` - pub(crate) NoConfusingVoidType { + pub NoConfusingVoidType { version: "1.2.0", name: "noConfusingVoidType", source: RuleSource::EslintTypeScript("no-invalid-void-type"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_const_enum.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_const_enum.rs index f1bbd1ae87b0..cd6fbca094a9 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_const_enum.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_const_enum.rs @@ -35,7 +35,7 @@ declare_rule! { /// Close, /// } /// ``` - pub(crate) NoConstEnum { + pub NoConstEnum { version: "1.0.0", name: "noConstEnum", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_control_characters_in_regex.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_control_characters_in_regex.rs index ccfb487c3bed..9f76c5a0b4ec 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_control_characters_in_regex.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_control_characters_in_regex.rs @@ -58,7 +58,7 @@ declare_rule! { /// var pattern6 = new RegExp("\x20"); /// ``` /// - pub(crate) NoControlCharactersInRegex { + pub NoControlCharactersInRegex { version: "1.0.0", name: "noControlCharactersInRegex", source: RuleSource::Eslint("no-control-regex"), @@ -67,7 +67,7 @@ declare_rule! { } declare_node_union! { - pub(crate) RegexExpressionLike = JsNewExpression | JsCallExpression | JsRegexLiteralExpression + pub RegexExpressionLike = JsNewExpression | JsCallExpression | JsRegexLiteralExpression } fn decode_hex_character_to_code_point(iter: &mut Peekable) -> Option<(String, i64)> { diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_debugger.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_debugger.rs index 76a4c2d26e20..ae0a0e16641e 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_debugger.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_debugger.rs @@ -26,7 +26,7 @@ declare_rule! { /// const test = { debugger: 1 }; /// test.debugger; ///``` - pub(crate) NoDebugger { + pub NoDebugger { version: "1.0.0", name: "noDebugger", source: RuleSource::Eslint("no-debugger"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_double_equals.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_double_equals.rs index e23e7f1f918f..a5fa553e6814 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_double_equals.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_double_equals.rs @@ -47,7 +47,7 @@ declare_rule! { /// ```js /// null != foo ///``` - pub(crate) NoDoubleEquals { + pub NoDoubleEquals { version: "1.0.0", name: "noDoubleEquals", source: RuleSource::Eslint("eqeqeq"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_case.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_case.rs index 55dce6fdbacc..d2f107cd77d1 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_case.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_case.rs @@ -80,7 +80,7 @@ declare_rule! { /// break; /// } /// ``` - pub(crate) NoDuplicateCase { + pub NoDuplicateCase { version: "1.0.0", name: "noDuplicateCase", source: RuleSource::Eslint("no-duplicate-case"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_class_members.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_class_members.rs index dd54ad6c8609..c309a6524f4d 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_class_members.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_class_members.rs @@ -84,7 +84,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoDuplicateClassMembers { + pub NoDuplicateClassMembers { version: "1.0.0", name: "noDuplicateClassMembers", source: RuleSource::Eslint("no-dupe-class-members"), @@ -110,7 +110,7 @@ fn is_static_member(node: JsSyntaxList) -> bool { } declare_node_union! { - pub(crate) AnyClassMemberDefinition = JsGetterClassMember | JsMethodClassMember | JsPropertyClassMember | JsSetterClassMember + pub AnyClassMemberDefinition = JsGetterClassMember | JsMethodClassMember | JsPropertyClassMember | JsSetterClassMember } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs index bb0847f636cb..b5ec54f52c92 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs @@ -30,7 +30,7 @@ declare_rule! { /// ```js /// /// ``` - pub(crate) NoDuplicateJsxProps { + pub NoDuplicateJsxProps { version: "1.0.0", name: "noDuplicateJsxProps", source: RuleSource::EslintReact("jsx-no-duplicate-props"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_object_keys.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_object_keys.rs index bcf631d48169..41f009aeced3 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_object_keys.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_duplicate_object_keys.rs @@ -54,7 +54,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoDuplicateObjectKeys { + pub NoDuplicateObjectKeys { version: "1.0.0", name: "noDuplicateObjectKeys", source: RuleSource::Eslint("no-dupe-keys"), @@ -185,7 +185,7 @@ impl From for DefinedProperty { } } -pub(crate) struct PropertyConflict(DefinedProperty, MemberDefinition); +pub struct PropertyConflict(DefinedProperty, MemberDefinition); impl DefinedProperty { fn extend_with( &self, diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_empty_interface.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_empty_interface.rs index 8fbf705f28ec..f256baf8ab48 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_empty_interface.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_empty_interface.rs @@ -40,7 +40,7 @@ declare_rule! { /// // Allow empty interfaces that extend a type. /// interface B extends A {} /// ``` - pub(crate) NoEmptyInterface { + pub NoEmptyInterface { version: "1.0.0", name: "noEmptyInterface", source: RuleSource::EslintTypeScript("no-empty-interface"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs index ce92631a771b..4c80e99d43fc 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_explicit_any.rs @@ -51,7 +51,7 @@ declare_rule! { /// function fn(param: Array>): Array {} /// ``` /// - pub(crate) NoExplicitAny { + pub NoExplicitAny { version: "1.0.0", name: "noExplicitAny", source: RuleSource::EslintTypeScript("no-explicit-any"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_extra_non_null_assertion.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_extra_non_null_assertion.rs index 78eed6e0371f..4f868e308684 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_extra_non_null_assertion.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_extra_non_null_assertion.rs @@ -45,7 +45,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoExtraNonNullAssertion { + pub NoExtraNonNullAssertion { version: "1.0.0", name: "noExtraNonNullAssertion", source: RuleSource::EslintTypeScript("no-extra-non-null-assertion"), @@ -55,7 +55,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyTsNonNullAssertion = TsNonNullAssertionAssignment | TsNonNullAssertionExpression + pub AnyTsNonNullAssertion = TsNonNullAssertionAssignment | TsNonNullAssertionExpression } impl Rule for NoExtraNonNullAssertion { diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_fallthrough_switch_clause.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_fallthrough_switch_clause.rs index a20d602d1470..7b811108ea12 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_fallthrough_switch_clause.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_fallthrough_switch_clause.rs @@ -52,7 +52,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoFallthroughSwitchClause { + pub NoFallthroughSwitchClause { version: "1.0.0", name: "noFallthroughSwitchClause", source: RuleSource::Eslint("no-fallthrough"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_implicit_any_let.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_implicit_any_let.rs index 90d7cf844366..d9f4c782fae9 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_implicit_any_let.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_implicit_any_let.rs @@ -33,7 +33,7 @@ declare_rule! { /// var b =10; /// ``` /// - pub(crate) NoImplicitAnyLet { + pub NoImplicitAnyLet { version: "1.4.0", name: "noImplicitAnyLet", recommended: true, diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_misleading_instantiator.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_misleading_instantiator.rs index bcdd54336291..38329b939621 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_misleading_instantiator.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_misleading_instantiator.rs @@ -45,7 +45,7 @@ declare_rule! { /// new (): C; /// } /// ``` - pub(crate) NoMisleadingInstantiator { + pub NoMisleadingInstantiator { version: "1.3.0", name: "noMisleadingInstantiator", source: RuleSource::EslintTypeScript("no-misused-new"), @@ -54,10 +54,10 @@ declare_rule! { } declare_node_union! { - pub(crate) DeclarationQuery = TsInterfaceDeclaration | TsTypeAliasDeclaration | JsClassDeclaration | TsDeclareStatement + pub DeclarationQuery = TsInterfaceDeclaration | TsTypeAliasDeclaration | JsClassDeclaration | TsDeclareStatement } -pub(crate) enum RuleState { +pub enum RuleState { ClassMisleadingNew(TextRange), InterfaceMisleadingNew(TextRange), InterfaceMisleadingConstructor(TextRange), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_misrefactored_shorthand_assign.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_misrefactored_shorthand_assign.rs index bcda8bd2186f..81ac92e9618b 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_misrefactored_shorthand_assign.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_misrefactored_shorthand_assign.rs @@ -49,7 +49,7 @@ declare_rule! { /// ```js /// a = a - b /// ``` - pub(crate) NoMisrefactoredShorthandAssign { + pub NoMisrefactoredShorthandAssign { version: "1.3.0", name: "noMisrefactoredShorthandAssign", source: RuleSource::Clippy("misrefactored_assign_op"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_prototype_builtins.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_prototype_builtins.rs index c81f8d3764a8..eb0f1974df41 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_prototype_builtins.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_prototype_builtins.rs @@ -39,7 +39,7 @@ declare_rule! { /// var valid = {}.propertyIsEnumerable.call(foo, "bar"); /// ``` /// - pub(crate) NoPrototypeBuiltins { + pub NoPrototypeBuiltins { version: "1.0.0", name: "noPrototypeBuiltins", source: RuleSource::Eslint("no-prototype-builtins"), @@ -47,7 +47,7 @@ declare_rule! { } } -pub(crate) struct RuleState { +pub struct RuleState { prototype_builtins_method_name: String, text_range: TextRange, } diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs index 9de27b12e738..d68511b1812d 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs @@ -67,7 +67,7 @@ declare_rule! { ///``` /// - pub(crate) NoRedundantUseStrict { + pub NoRedundantUseStrict { version: "1.0.0", name: "noRedundantUseStrict", recommended: true, @@ -84,7 +84,7 @@ impl AnyNodeWithDirectives { } } } -declare_node_union! { pub(crate) AnyJsStrictModeNode = AnyJsClass| JsModule | JsDirective } +declare_node_union! { pub AnyJsStrictModeNode = AnyJsClass| JsModule | JsDirective } impl Rule for NoRedundantUseStrict { type Query = Ast; diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_self_compare.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_self_compare.rs index c13a8b118d1a..2894ab25c6f4 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_self_compare.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_self_compare.rs @@ -24,7 +24,7 @@ declare_rule! { /// if (a.b.c() !== a.b .c()) {} /// ``` /// - pub(crate) NoSelfCompare { + pub NoSelfCompare { version: "1.0.0", name: "noSelfCompare", source: RuleSource::Eslint("no-self-compare"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_shadow_restricted_names.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_shadow_restricted_names.rs index 8a2942a1c659..a86b6306d70b 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_shadow_restricted_names.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_shadow_restricted_names.rs @@ -30,7 +30,7 @@ declare_rule! { /// ```js,expect_diagnostic /// function test(JSON) {console.log(JSON)} /// ``` - pub(crate) NoShadowRestrictedNames { + pub NoShadowRestrictedNames { version: "1.0.0", name: "noShadowRestrictedNames", source: RuleSource::Eslint("no-shadow-restricted-names"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_sparse_array.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_sparse_array.rs index 7db262557f23..cbc3c3bd9cec 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_sparse_array.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_sparse_array.rs @@ -20,7 +20,7 @@ declare_rule! { /// ```js,expect_diagnostic /// [1,,2] /// ``` - pub(crate) NoSparseArray { + pub NoSparseArray { version: "1.0.0", name: "noSparseArray", source: RuleSource::Eslint("no-sparse-array"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/no_unsafe_negation.rs b/crates/biome_js_analyze/src/analyzers/suspicious/no_unsafe_negation.rs index 800ed0952a1a..aadfbba05966 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/no_unsafe_negation.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/no_unsafe_negation.rs @@ -33,7 +33,7 @@ declare_rule! { /// delete 1 in [1,2]; /// +1 instanceof [1,2]; /// ``` - pub(crate) NoUnsafeNegation { + pub NoUnsafeNegation { version: "1.0.0", name: "noUnsafeNegation", source: RuleSource::Eslint("no-unsafe-negation"), @@ -151,5 +151,5 @@ impl Rule for NoUnsafeNegation { declare_node_union! { /// Enum for [JsInstanceofExpression] and [JsInExpression] #[allow(dead_code)] - pub(crate) JsInOrInstanceOfExpression = JsInstanceofExpression | JsInExpression + pub JsInOrInstanceOfExpression = JsInstanceofExpression | JsInExpression } diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/use_default_switch_clause_last.rs b/crates/biome_js_analyze/src/analyzers/suspicious/use_default_switch_clause_last.rs index f1f7f208c0d0..7186cfa50a6e 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/use_default_switch_clause_last.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/use_default_switch_clause_last.rs @@ -69,7 +69,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseDefaultSwitchClauseLast { + pub UseDefaultSwitchClauseLast { version: "1.0.0", name: "useDefaultSwitchClauseLast", source: RuleSource::Eslint("default-case-last"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/use_getter_return.rs b/crates/biome_js_analyze/src/analyzers/suspicious/use_getter_return.rs index 7b4ae31c4365..269e42e633af 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/use_getter_return.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/use_getter_return.rs @@ -57,7 +57,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseGetterReturn { + pub UseGetterReturn { version: "1.0.0", name: "useGetterReturn", source: RuleSource::Eslint("getter-return"), @@ -158,7 +158,7 @@ impl Rule for UseGetterReturn { } #[derive(Debug)] -pub(crate) enum InvalidGetterReturn { +pub enum InvalidGetterReturn { /// No `return` statement. MissingReturn, // A `return` statement without argument. diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/use_namespace_keyword.rs b/crates/biome_js_analyze/src/analyzers/suspicious/use_namespace_keyword.rs index 2796bcead370..aa597500ffef 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/use_namespace_keyword.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/use_namespace_keyword.rs @@ -41,7 +41,7 @@ declare_rule! { /// declare module "foo" {} /// ``` /// - pub(crate) UseNamespaceKeyword { + pub UseNamespaceKeyword { version: "1.0.0", name: "useNamespaceKeyword", source: RuleSource::EslintTypeScript("prefer-namespace-keyword"), diff --git a/crates/biome_js_analyze/src/analyzers/suspicious/use_valid_typeof.rs b/crates/biome_js_analyze/src/analyzers/suspicious/use_valid_typeof.rs index 2067c7c555fc..cdd6781167f3 100644 --- a/crates/biome_js_analyze/src/analyzers/suspicious/use_valid_typeof.rs +++ b/crates/biome_js_analyze/src/analyzers/suspicious/use_valid_typeof.rs @@ -69,7 +69,7 @@ declare_rule! { /// ```js /// typeof bar === typeof qux /// ``` - pub(crate) UseValidTypeof { + pub UseValidTypeof { version: "1.0.0", name: "useValidTypeof", source: RuleSource::Eslint("valid-typeof"), diff --git a/crates/biome_js_analyze/src/aria_analyzers.rs b/crates/biome_js_analyze/src/aria_analyzers.rs index 0b18adea18a7..b302f1cd3f00 100644 --- a/crates/biome_js_analyze/src/aria_analyzers.rs +++ b/crates/biome_js_analyze/src/aria_analyzers.rs @@ -1,4 +1,4 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod a11y; -::biome_analyze::declare_category! { pub (crate) AriaAnalyzers { kind : Lint , groups : [self :: a11y :: A11y ,] } } +pub mod a11y; +::biome_analyze::declare_category! { pub AriaAnalyzers { kind : Lint , groups : [self :: a11y :: A11y ,] } } diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y.rs index 93ca13e101fa..4ac846182a4f 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y.rs @@ -2,21 +2,21 @@ use biome_analyze::declare_group; -pub(crate) mod no_aria_hidden_on_focusable; -pub(crate) mod no_aria_unsupported_elements; -pub(crate) mod no_interactive_element_to_noninteractive_role; -pub(crate) mod no_noninteractive_element_to_interactive_role; -pub(crate) mod no_noninteractive_tabindex; -pub(crate) mod no_redundant_roles; -pub(crate) mod use_aria_activedescendant_with_tabindex; -pub(crate) mod use_aria_props_for_role; -pub(crate) mod use_valid_aria_props; -pub(crate) mod use_valid_aria_role; -pub(crate) mod use_valid_aria_values; -pub(crate) mod use_valid_lang; +pub mod no_aria_hidden_on_focusable; +pub mod no_aria_unsupported_elements; +pub mod no_interactive_element_to_noninteractive_role; +pub mod no_noninteractive_element_to_interactive_role; +pub mod no_noninteractive_tabindex; +pub mod no_redundant_roles; +pub mod use_aria_activedescendant_with_tabindex; +pub mod use_aria_props_for_role; +pub mod use_valid_aria_props; +pub mod use_valid_aria_role; +pub mod use_valid_aria_values; +pub mod use_valid_lang; declare_group! { - pub (crate) A11y { + pub A11y { name : "a11y" , rules : [ self :: no_aria_hidden_on_focusable :: NoAriaHiddenOnFocusable , diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_hidden_on_focusable.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_hidden_on_focusable.rs index 92a0bf4c99ea..6035d1b424d4 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_hidden_on_focusable.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_hidden_on_focusable.rs @@ -42,7 +42,7 @@ declare_rule! { /// - [Element with aria-hidden has no content in sequential focus navigation](https://www.w3.org/WAI/standards-guidelines/act/rules/6cfa84/proposed/) /// - [MDN aria-hidden](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden) /// - pub(crate) NoAriaHiddenOnFocusable { + pub NoAriaHiddenOnFocusable { version: "1.4.0", name: "noAriaHiddenOnFocusable", source: RuleSource::EslintJsxA11y("no-aria-hidden-on-focusable"), diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_unsupported_elements.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_unsupported_elements.rs index 7c67e7268b84..48bb1953febf 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_unsupported_elements.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_aria_unsupported_elements.rs @@ -33,7 +33,7 @@ declare_rule! { /// ``` /// /// - pub(crate) NoAriaUnsupportedElements { + pub NoAriaUnsupportedElements { version: "1.0.0", name: "noAriaUnsupportedElements", source: RuleSource::EslintJsxA11y("aria-unsupported-elements"), diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_interactive_element_to_noninteractive_role.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_interactive_element_to_noninteractive_role.rs index 564bfc186c83..d06ad3730515 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_interactive_element_to_noninteractive_role.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_interactive_element_to_noninteractive_role.rs @@ -32,7 +32,7 @@ declare_rule! { /// ; /// ``` /// - pub(crate) NoInteractiveElementToNoninteractiveRole { + pub NoInteractiveElementToNoninteractiveRole { version: "1.3.0", name: "noInteractiveElementToNoninteractiveRole", source: RuleSource::EslintJsxA11y("no-interactive-element-to-noninteractive-role"), diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_element_to_interactive_role.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_element_to_interactive_role.rs index 83ce71dd6e8f..bf0e8747116c 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_element_to_interactive_role.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_element_to_interactive_role.rs @@ -45,7 +45,7 @@ declare_rule! { /// - [Fundamental Keyboard Navigation Conventions](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav) /// - [Mozilla Developer Network - ARIA Techniques](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role#Keyboard_and_focus) /// - pub(crate) NoNoninteractiveElementToInteractiveRole { + pub NoNoninteractiveElementToInteractiveRole { version: "1.0.0", name: "noNoninteractiveElementToInteractiveRole", source: RuleSource::EslintJsxA11y("no-noninteractive-element-to-interactive-role"), @@ -54,7 +54,7 @@ declare_rule! { } } -pub(crate) struct RuleState { +pub struct RuleState { attribute_range: TextRange, element_name: String, } diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_tabindex.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_tabindex.rs index eee88fe4f567..bb1331a45ea7 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_tabindex.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_noninteractive_tabindex.rs @@ -48,7 +48,7 @@ declare_rule! { ///
/// ``` /// - pub(crate) NoNoninteractiveTabindex { + pub NoNoninteractiveTabindex { version: "1.0.0", name: "noNoninteractiveTabindex", source: RuleSource::EslintJsxA11y("no-noninteractive-tabindex"), @@ -66,7 +66,7 @@ declare_node_union! { /// - `JsNumberLiteralExpression` — `5` /// - `JsUnaryExpression` — `+5` | `-5` /// - pub(crate) AnyNumberLikeExpression = JsStringLiteralExpression | JsNumberLiteralExpression | JsUnaryExpression + pub AnyNumberLikeExpression = JsStringLiteralExpression | JsNumberLiteralExpression | JsUnaryExpression } impl AnyNumberLikeExpression { @@ -91,7 +91,7 @@ impl AnyNumberLikeExpression { } } -pub(crate) struct RuleState { +pub struct RuleState { attribute_range: TextRange, element_name: String, } diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_redundant_roles.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_redundant_roles.rs index a3dbdfdf58a2..4aaf2387dd1f 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/no_redundant_roles.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/no_redundant_roles.rs @@ -43,7 +43,7 @@ declare_rule! { /// /// ``` /// - pub(crate) NoRedundantRoles { + pub NoRedundantRoles { version: "1.0.0", name: "noRedundantRoles", source: RuleSource::EslintJsxA11y("no-redundant-roles"), @@ -52,7 +52,7 @@ declare_rule! { } } -pub(crate) struct RuleState { +pub struct RuleState { redundant_attribute: JsxAttribute, redundant_attribute_value: AnyJsxAttributeValue, element_name: String, diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_activedescendant_with_tabindex.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_activedescendant_with_tabindex.rs index 3feac574f7ae..32bc524cd26a 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_activedescendant_with_tabindex.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_activedescendant_with_tabindex.rs @@ -48,7 +48,7 @@ declare_rule! { /// /// ``` /// - pub(crate) UseAriaActivedescendantWithTabindex { + pub UseAriaActivedescendantWithTabindex { version: "1.3.0", name: "useAriaActivedescendantWithTabindex", source: RuleSource::EslintJsxA11y("aria-activedescendant-has-tabindex"), diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_props_for_role.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_props_for_role.rs index e0dbc5bb8c25..119dcf9efcdc 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_props_for_role.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_aria_props_for_role.rs @@ -38,7 +38,7 @@ declare_rule! { /// ### Resources /// - [ARIA Spec, Roles](https://www.w3.org/TR/wai-aria/#roles) /// - [Chrome Audit Rules, AX_ARIA_03](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_03) - pub(crate) UseAriaPropsForRole { + pub UseAriaPropsForRole { version: "1.0.0", name: "useAriaPropsForRole", source: RuleSource::EslintJsxA11y("role-has-required-aria-props"), @@ -47,7 +47,7 @@ declare_rule! { } #[derive(Default, Debug)] -pub(crate) struct UseAriaPropsForRoleState { +pub struct UseAriaPropsForRoleState { missing_aria_props: Vec, attribute: Option<(JsxAttribute, String)>, } diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_props.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_props.rs index f44a0922d157..40cd0a0658e0 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_props.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_props.rs @@ -25,7 +25,7 @@ declare_rule! { /// /// ## Accessibility guidelines /// - [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value) - pub(crate) UseValidAriaProps { + pub UseValidAriaProps { version: "1.0.0", name: "useValidAriaProps", source: RuleSource::EslintJsxA11y("aria-props"), diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_role.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_role.rs index 98a2094aad5a..5ac8e10e9bb2 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_role.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_role.rs @@ -64,7 +64,7 @@ declare_rule! { /// - [DPUB-ARIA roles](https://www.w3.org/TR/dpub-aria-1.0/) /// - [MDN: Using ARIA: Roles, states, and properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques) /// - pub(crate) UseValidAriaRole { + pub UseValidAriaRole { version: "1.4.0", name: "useValidAriaRole", source: RuleSource::EslintJsxA11y("aria-role"), @@ -85,7 +85,7 @@ impl Rule for UseValidAriaRole { type Query = Aria; type State = (); type Signals = Option; - type Options = ValidAriaRoleOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_values.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_values.rs index 68c36a52c37b..2672b867d50c 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_values.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_aria_values.rs @@ -47,7 +47,7 @@ declare_rule! { /// /// - [ARIA Spec, States and Properties](https://www.w3.org/TR/wai-aria/#states_and_properties) /// - [Chrome Audit Rules, AX_ARIA_04](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_04) - pub(crate) UseValidAriaValues { + pub UseValidAriaValues { version: "1.0.0", name: "useValidAriaValues", source: RuleSource::EslintJsxA11y("aria-proptypes"), @@ -55,7 +55,7 @@ declare_rule! { } } -pub(crate) struct UseValidAriaValuesState { +pub struct UseValidAriaValuesState { attribute_value_range: TextRange, allowed_values: Iter<'static, &'static str>, attribute_name: JsSyntaxToken, diff --git a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_lang.rs b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_lang.rs index e11eed20f5cf..ee63d2c50bad 100644 --- a/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_lang.rs +++ b/crates/biome_js_analyze/src/aria_analyzers/a11y/use_valid_lang.rs @@ -28,7 +28,7 @@ declare_rule! { /// ```jsx /// /// ``` - pub(crate) UseValidLang { + pub UseValidLang { version: "1.0.0", name: "useValidLang", source: RuleSource::EslintJsxA11y("lang"), @@ -42,7 +42,7 @@ enum InvalidKind { Value, } -pub(crate) struct UseValidLangState { +pub struct UseValidLangState { invalid_kind: InvalidKind, attribute_range: TextRange, } diff --git a/crates/biome_js_analyze/src/aria_analyzers/nursery.rs b/crates/biome_js_analyze/src/aria_analyzers/nursery.rs new file mode 100644 index 000000000000..a64bf3fd3f8d --- /dev/null +++ b/crates/biome_js_analyze/src/aria_analyzers/nursery.rs @@ -0,0 +1,16 @@ +//! Generated file, do not edit by hand, see `xtask/codegen` + +use biome_analyze::declare_group; + +pub mod no_aria_hidden_on_focusable; +pub mod use_valid_aria_role; + +declare_group! { + pub Nursery { + name : "nursery" , + rules : [ + self :: no_aria_hidden_on_focusable :: NoAriaHiddenOnFocusable , + self :: use_valid_aria_role :: UseValidAriaRole , + ] + } +} diff --git a/crates/biome_js_analyze/src/aria_services.rs b/crates/biome_js_analyze/src/aria_services.rs index 23642f973827..2db48d8a5c85 100644 --- a/crates/biome_js_analyze/src/aria_services.rs +++ b/crates/biome_js_analyze/src/aria_services.rs @@ -10,7 +10,7 @@ use rustc_hash::FxHashMap; use std::sync::Arc; #[derive(Debug, Clone)] -pub(crate) struct AriaServices { +pub struct AriaServices { pub(crate) roles: Arc, pub(crate) properties: Arc, } @@ -97,7 +97,7 @@ impl Phase for AriaServices { /// Query type usable by lint rules **that uses the semantic model** to match on specific [AstNode] types #[derive(Clone)] -pub(crate) struct Aria(pub N); +pub struct Aria(pub N); impl Queryable for Aria where diff --git a/crates/biome_js_analyze/src/assists.rs b/crates/biome_js_analyze/src/assists.rs index 3314b5be1175..5e445c76fc6e 100644 --- a/crates/biome_js_analyze/src/assists.rs +++ b/crates/biome_js_analyze/src/assists.rs @@ -1,4 +1,4 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod correctness; -::biome_analyze::declare_category! { pub (crate) Assists { kind : Action , groups : [self :: correctness :: Correctness ,] } } +pub mod correctness; +::biome_analyze::declare_category! { pub Assists { kind : Action , groups : [self :: correctness :: Correctness ,] } } diff --git a/crates/biome_js_analyze/src/assists/correctness.rs b/crates/biome_js_analyze/src/assists/correctness.rs index e17bda672767..4fe923edaceb 100644 --- a/crates/biome_js_analyze/src/assists/correctness.rs +++ b/crates/biome_js_analyze/src/assists/correctness.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod organize_imports; +pub mod organize_imports; declare_group! { - pub (crate) Correctness { + pub Correctness { name : "correctness" , rules : [ self :: organize_imports :: OrganizeImports , diff --git a/crates/biome_js_analyze/src/assists/correctness/organize_imports.rs b/crates/biome_js_analyze/src/assists/correctness/organize_imports.rs index f7fa87534deb..5e51fbc2392d 100644 --- a/crates/biome_js_analyze/src/assists/correctness/organize_imports.rs +++ b/crates/biome_js_analyze/src/assists/correctness/organize_imports.rs @@ -41,7 +41,7 @@ declare_rule! { /// import { Popup } from '@ui/Popup'; /// import { createConnection } from '@server/database'; /// ``` - pub(crate) OrganizeImports { + pub OrganizeImports { version: "1.0.0", name: "organizeImports", recommended: false, @@ -245,7 +245,7 @@ impl Rule for OrganizeImports { } #[derive(Debug)] -pub(crate) struct ImportGroups { +pub struct ImportGroups { /// The list of all the import groups in the file groups: Vec, } diff --git a/crates/biome_js_analyze/src/control_flow/visitor.rs b/crates/biome_js_analyze/src/control_flow/visitor.rs index 7954c7b6c38f..af0ec302bb33 100644 --- a/crates/biome_js_analyze/src/control_flow/visitor.rs +++ b/crates/biome_js_analyze/src/control_flow/visitor.rs @@ -158,7 +158,7 @@ pub(super) struct FunctionVisitor { } declare_node_union! { - pub(crate) AnyJsControlFlowRoot = JsModule + pub AnyJsControlFlowRoot = JsModule | JsScript | AnyJsFunction | JsGetterObjectMember diff --git a/crates/biome_js_analyze/src/lib.rs b/crates/biome_js_analyze/src/lib.rs index 6d20cc877845..c84e3c711041 100644 --- a/crates/biome_js_analyze/src/lib.rs +++ b/crates/biome_js_analyze/src/lib.rs @@ -15,8 +15,8 @@ use serde::{Deserialize, Serialize}; use std::sync::Arc; use std::{borrow::Cow, error::Error}; -mod analyzers; -mod aria_analyzers; +pub mod analyzers; +pub mod aria_analyzers; mod aria_services; mod assists; mod ast_utils; diff --git a/crates/biome_js_analyze/src/manifest_services.rs b/crates/biome_js_analyze/src/manifest_services.rs index f31a85a0d4f2..ee8fa1884b0d 100644 --- a/crates/biome_js_analyze/src/manifest_services.rs +++ b/crates/biome_js_analyze/src/manifest_services.rs @@ -8,7 +8,7 @@ use biome_rowan::AstNode; use std::sync::Arc; #[derive(Debug, Clone)] -pub(crate) struct ManifestServices { +pub struct ManifestServices { pub(crate) manifest: Arc, } @@ -50,7 +50,7 @@ impl Phase for ManifestServices { /// Query type usable by lint rules **that uses the semantic model** to match on specific [AstNode] types #[derive(Clone)] -pub(crate) struct Manifest(pub N); +pub struct Manifest(pub N); impl Queryable for Manifest where diff --git a/crates/biome_js_analyze/src/options.rs b/crates/biome_js_analyze/src/options.rs index d6d415d4a24b..a44eb830019c 100644 --- a/crates/biome_js_analyze/src/options.rs +++ b/crates/biome_js_analyze/src/options.rs @@ -1,175 +1,292 @@ -//! This module contains the rules that have options +//! Generated file, do not edit by hand, see `xtask/codegen` -use crate::analyzers::nursery::no_restricted_imports::RestrictedImportsOptions; -use crate::analyzers::nursery::use_consistent_array_type::ConsistentArrayTypeOptions; -use crate::analyzers::nursery::use_filenaming_convention::FilenamingConventionOptions; -use crate::semantic_analyzers::correctness::use_exhaustive_dependencies::HooksOptions; -use crate::semantic_analyzers::correctness::use_hook_at_top_level::DeprecatedHooksOptions; -use crate::semantic_analyzers::nursery::use_sorted_classes::UtilityClassSortingOptions; -use crate::semantic_analyzers::style::no_restricted_globals::RestrictedGlobalsOptions; -use crate::semantic_analyzers::style::use_naming_convention::NamingConventionOptions; -use crate::{ - analyzers::complexity::no_excessive_cognitive_complexity::ComplexityOptions, - aria_analyzers::a11y::use_valid_aria_role::ValidAriaRoleOptions, -}; -use biome_analyze::options::RuleOptions; -use biome_analyze::RuleKey; -use biome_console::markup; -use biome_deserialize::{Deserializable, DeserializableValue, DeserializationDiagnostic}; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use crate::analyzers; +use crate::aria_analyzers; +use crate::semantic_analyzers; -#[derive(Deserialize, Serialize, Debug, Eq, PartialEq, Clone)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, untagged)] -pub enum PossibleOptions { - /// Options for `noExcessiveComplexity` rule - Complexity(ComplexityOptions), - /// Options for `useConsistentArrayType` rule - ConsistentArrayType(ConsistentArrayTypeOptions), - /// Options for `useFilenamingConvention` rule - FilenamingConvention(FilenamingConventionOptions), - /// Options for `useExhaustiveDependencies` rule - Hooks(HooksOptions), - /// Deprecated options for `useHookAtTopLevel` rule - DeprecatedHooks(DeprecatedHooksOptions), - /// Options for `useNamingConvention` rule - NamingConvention(NamingConventionOptions), - /// Options for `noRestrictedGlobals` rule - RestrictedGlobals(RestrictedGlobalsOptions), - /// Options for `noRestrictedImports` rule - RestrictedImports(RestrictedImportsOptions), - /// Options for `useValidAriaRole` rule - ValidAriaRole(ValidAriaRoleOptions), - /// Options for `useSortedClasses` rule - UtilityClassSorting(UtilityClassSortingOptions), -} - -impl Default for PossibleOptions { - fn default() -> Self { - Self::Complexity(ComplexityOptions::default()) - } -} - -impl PossibleOptions { - pub fn extract_option(&self, rule_key: &RuleKey) -> RuleOptions { - match rule_key.rule_name() { - "noExcessiveCognitiveComplexity" => { - let options = match self { - PossibleOptions::Complexity(options) => options.clone(), - _ => ComplexityOptions::default(), - }; - RuleOptions::new(options) - } - "useConsistentArrayType" => { - let options = match self { - PossibleOptions::ConsistentArrayType(options) => options.clone(), - _ => ConsistentArrayTypeOptions::default(), - }; - RuleOptions::new(options) - } - "useExhaustiveDependencies" => { - let options = match self { - PossibleOptions::Hooks(options) => options.clone(), - _ => HooksOptions::default(), - }; - RuleOptions::new(options) - } - "useFilenamingConvention" => { - let options = match self { - PossibleOptions::FilenamingConvention(options) => options.clone(), - _ => FilenamingConventionOptions::default(), - }; - RuleOptions::new(options) - } - "useHookAtTopLevel" => { - let options = match self { - PossibleOptions::DeprecatedHooks(options) => options.clone(), - _ => DeprecatedHooksOptions::default(), - }; - RuleOptions::new(options) - } - "useNamingConvention" => { - let options = match self { - PossibleOptions::NamingConvention(options) => options.clone(), - _ => NamingConventionOptions::default(), - }; - RuleOptions::new(options) - } - "noRestrictedGlobals" => { - let options = match self { - PossibleOptions::RestrictedGlobals(options) => options.clone(), - _ => RestrictedGlobalsOptions::default(), - }; - RuleOptions::new(options) - } - "noRestrictedImports" => { - let options = match self { - PossibleOptions::RestrictedImports(options) => options.clone(), - _ => RestrictedImportsOptions::default(), - }; - RuleOptions::new(options) - } - "useValidAriaRole" => { - let options = match self { - PossibleOptions::ValidAriaRole(options) => options.clone(), - _ => ValidAriaRoleOptions::default(), - }; - RuleOptions::new(options) - } - "useSortedClasses" => { - let options = match self { - PossibleOptions::UtilityClassSorting(options) => options.clone(), - _ => UtilityClassSortingOptions::default(), - }; - RuleOptions::new(options) - } - // TODO: review error - _ => panic!("This rule {:?} doesn't have options", rule_key), - } - } -} - -impl Deserializable for PossibleOptions { - fn deserialize( - value: &impl DeserializableValue, - rule_name: &str, - diagnostics: &mut Vec, - ) -> Option { - match rule_name { - "noExcessiveCognitiveComplexity" => { - Deserializable::deserialize(value, "options", diagnostics).map(Self::Complexity) - } - "noRestrictedGlobals" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::RestrictedGlobals), - "noRestrictedImports" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::RestrictedImports), - "useConsistentArrayType" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::ConsistentArrayType), - "useExhaustiveDependencies" => { - Deserializable::deserialize(value, "options", diagnostics).map(Self::Hooks) - } - "useHookAtTopLevel" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::DeprecatedHooks), - "useFilenamingConvention" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::FilenamingConvention), - "useNamingConvention" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::NamingConvention), - "useValidAriaRole" => { - Deserializable::deserialize(value, "options", diagnostics).map(Self::ValidAriaRole) - } - "useSortedClasses" => Deserializable::deserialize(value, "options", diagnostics) - .map(Self::UtilityClassSorting), - _ => { - diagnostics.push( - DeserializationDiagnostic::new(markup! { - "The rule "{rule_name}" doesn't accept any options." - }) - .with_range(value.range()), - ); - None - } - } - } -} +pub type NoAccessKey = + ::Options; +pub type NoAccumulatingSpread = < semantic_analyzers :: performance :: no_accumulating_spread :: NoAccumulatingSpread as biome_analyze :: Rule > :: Options ; +pub type NoApproximativeNumericConstant = < analyzers :: suspicious :: no_approximative_numeric_constant :: NoApproximativeNumericConstant as biome_analyze :: Rule > :: Options ; +pub type NoArguments = + ::Options; +pub type NoAriaHiddenOnFocusable = < aria_analyzers :: a11y :: no_aria_hidden_on_focusable :: NoAriaHiddenOnFocusable as biome_analyze :: Rule > :: Options ; +pub type NoAriaUnsupportedElements = < aria_analyzers :: a11y :: no_aria_unsupported_elements :: NoAriaUnsupportedElements as biome_analyze :: Rule > :: Options ; +pub type NoArrayIndexKey = < semantic_analyzers :: suspicious :: no_array_index_key :: NoArrayIndexKey as biome_analyze :: Rule > :: Options ; +pub type NoAssignInExpressions = < analyzers :: suspicious :: no_assign_in_expressions :: NoAssignInExpressions as biome_analyze :: Rule > :: Options ; +pub type NoAsyncPromiseExecutor = < analyzers :: suspicious :: no_async_promise_executor :: NoAsyncPromiseExecutor as biome_analyze :: Rule > :: Options ; +pub type NoAutofocus = ::Options; +pub type NoBannedTypes = < semantic_analyzers :: complexity :: no_banned_types :: NoBannedTypes as biome_analyze :: Rule > :: Options ; +pub type NoBlankTarget = + ::Options; +pub type NoCatchAssign = < semantic_analyzers :: suspicious :: no_catch_assign :: NoCatchAssign as biome_analyze :: Rule > :: Options ; +pub type NoChildrenProp = < semantic_analyzers :: correctness :: no_children_prop :: NoChildrenProp as biome_analyze :: Rule > :: Options ; +pub type NoClassAssign = < semantic_analyzers :: suspicious :: no_class_assign :: NoClassAssign as biome_analyze :: Rule > :: Options ; +pub type NoCommaOperator = + ::Options; +pub type NoCommentText = + ::Options; +pub type NoCompareNegZero = + ::Options; +pub type NoConfusingLabels = + ::Options; +pub type NoConfusingVoidType = < analyzers :: suspicious :: no_confusing_void_type :: NoConfusingVoidType as biome_analyze :: Rule > :: Options ; +pub type NoConsole = + ::Options; +pub type NoConsoleLog = + ::Options; +pub type NoConstAssign = < semantic_analyzers :: correctness :: no_const_assign :: NoConstAssign as biome_analyze :: Rule > :: Options ; +pub type NoConstEnum = + ::Options; +pub type NoConstantCondition = < semantic_analyzers :: correctness :: no_constant_condition :: NoConstantCondition as biome_analyze :: Rule > :: Options ; +pub type NoConstructorReturn = < analyzers :: correctness :: no_constructor_return :: NoConstructorReturn as biome_analyze :: Rule > :: Options ; +pub type NoControlCharactersInRegex = < analyzers :: suspicious :: no_control_characters_in_regex :: NoControlCharactersInRegex as biome_analyze :: Rule > :: Options ; +pub type NoDangerouslySetInnerHtml = < semantic_analyzers :: security :: no_dangerously_set_inner_html :: NoDangerouslySetInnerHtml as biome_analyze :: Rule > :: Options ; +pub type NoDangerouslySetInnerHtmlWithChildren = < semantic_analyzers :: security :: no_dangerously_set_inner_html_with_children :: NoDangerouslySetInnerHtmlWithChildren as biome_analyze :: Rule > :: Options ; +pub type NoDebugger = + ::Options; +pub type NoDefaultExport = + ::Options; +pub type NoDelete = ::Options; +pub type NoDistractingElements = < analyzers :: a11y :: no_distracting_elements :: NoDistractingElements as biome_analyze :: Rule > :: Options ; +pub type NoDoubleEquals = + ::Options; +pub type NoDuplicateCase = + ::Options; +pub type NoDuplicateClassMembers = < analyzers :: suspicious :: no_duplicate_class_members :: NoDuplicateClassMembers as biome_analyze :: Rule > :: Options ; +pub type NoDuplicateJsxProps = < analyzers :: suspicious :: no_duplicate_jsx_props :: NoDuplicateJsxProps as biome_analyze :: Rule > :: Options ; +pub type NoDuplicateObjectKeys = < analyzers :: suspicious :: no_duplicate_object_keys :: NoDuplicateObjectKeys as biome_analyze :: Rule > :: Options ; +pub type NoDuplicateParameters = < semantic_analyzers :: suspicious :: no_duplicate_parameters :: NoDuplicateParameters as biome_analyze :: Rule > :: Options ; +pub type NoEmptyBlockStatements = < analyzers :: nursery :: no_empty_block_statements :: NoEmptyBlockStatements as biome_analyze :: Rule > :: Options ; +pub type NoEmptyCharacterClassInRegex = < analyzers :: correctness :: no_empty_character_class_in_regex :: NoEmptyCharacterClassInRegex as biome_analyze :: Rule > :: Options ; +pub type NoEmptyInterface = + ::Options; +pub type NoEmptyPattern = + ::Options; +pub type NoEmptyTypeParameters = < analyzers :: nursery :: no_empty_type_parameters :: NoEmptyTypeParameters as biome_analyze :: Rule > :: Options ; +pub type NoExcessiveCognitiveComplexity = < analyzers :: complexity :: no_excessive_cognitive_complexity :: NoExcessiveCognitiveComplexity as biome_analyze :: Rule > :: Options ; +pub type NoExplicitAny = + ::Options; +pub type NoExtraBooleanCast = < analyzers :: complexity :: no_extra_boolean_cast :: NoExtraBooleanCast as biome_analyze :: Rule > :: Options ; +pub type NoExtraNonNullAssertion = < analyzers :: suspicious :: no_extra_non_null_assertion :: NoExtraNonNullAssertion as biome_analyze :: Rule > :: Options ; +pub type NoFallthroughSwitchClause = < analyzers :: suspicious :: no_fallthrough_switch_clause :: NoFallthroughSwitchClause as biome_analyze :: Rule > :: Options ; +pub type NoFocusedTests = + ::Options; +pub type NoForEach = + ::Options; +pub type NoFunctionAssign = < semantic_analyzers :: suspicious :: no_function_assign :: NoFunctionAssign as biome_analyze :: Rule > :: Options ; +pub type NoGlobalAssign = + ::Options; +pub type NoGlobalEval = + ::Options; +pub type NoGlobalIsFinite = < semantic_analyzers :: suspicious :: no_global_is_finite :: NoGlobalIsFinite as biome_analyze :: Rule > :: Options ; +pub type NoGlobalIsNan = < semantic_analyzers :: suspicious :: no_global_is_nan :: NoGlobalIsNan as biome_analyze :: Rule > :: Options ; +pub type NoGlobalObjectCalls = < semantic_analyzers :: correctness :: no_global_object_calls :: NoGlobalObjectCalls as biome_analyze :: Rule > :: Options ; +pub type NoHeaderScope = + ::Options; +pub type NoImplicitAnyLet = + ::Options; +pub type NoImplicitBoolean = + ::Options; +pub type NoImportAssign = < semantic_analyzers :: suspicious :: no_import_assign :: NoImportAssign as biome_analyze :: Rule > :: Options ; +pub type NoInferrableTypes = + ::Options; +pub type NoInnerDeclarations = < analyzers :: correctness :: no_inner_declarations :: NoInnerDeclarations as biome_analyze :: Rule > :: Options ; +pub type NoInteractiveElementToNoninteractiveRole = < aria_analyzers :: a11y :: no_interactive_element_to_noninteractive_role :: NoInteractiveElementToNoninteractiveRole as biome_analyze :: Rule > :: Options ; +pub type NoInvalidConstructorSuper = < analyzers :: correctness :: no_invalid_constructor_super :: NoInvalidConstructorSuper as biome_analyze :: Rule > :: Options ; +pub type NoInvalidNewBuiltin = < semantic_analyzers :: correctness :: no_invalid_new_builtin :: NoInvalidNewBuiltin as biome_analyze :: Rule > :: Options ; +pub type NoInvalidUseBeforeDeclaration = < semantic_analyzers :: nursery :: no_invalid_use_before_declaration :: NoInvalidUseBeforeDeclaration as biome_analyze :: Rule > :: Options ; +pub type NoLabelVar = + ::Options; +pub type NoMisleadingCharacterClass = < semantic_analyzers :: nursery :: no_misleading_character_class :: NoMisleadingCharacterClass as biome_analyze :: Rule > :: Options ; +pub type NoMisleadingInstantiator = < analyzers :: suspicious :: no_misleading_instantiator :: NoMisleadingInstantiator as biome_analyze :: Rule > :: Options ; +pub type NoMisrefactoredShorthandAssign = < analyzers :: suspicious :: no_misrefactored_shorthand_assign :: NoMisrefactoredShorthandAssign as biome_analyze :: Rule > :: Options ; +pub type NoMultipleSpacesInRegularExpressionLiterals = < analyzers :: complexity :: no_multiple_spaces_in_regular_expression_literals :: NoMultipleSpacesInRegularExpressionLiterals as biome_analyze :: Rule > :: Options ; +pub type NoNamespace = + ::Options; +pub type NoNamespaceImport = + ::Options; +pub type NoNegationElse = + ::Options; +pub type NoNewSymbol = + ::Options; +pub type NoNodejsModules = + ::Options; +pub type NoNonNullAssertion = + ::Options; +pub type NoNoninteractiveElementToInteractiveRole = < aria_analyzers :: a11y :: no_noninteractive_element_to_interactive_role :: NoNoninteractiveElementToInteractiveRole as biome_analyze :: Rule > :: Options ; +pub type NoNoninteractiveTabindex = < aria_analyzers :: a11y :: no_noninteractive_tabindex :: NoNoninteractiveTabindex as biome_analyze :: Rule > :: Options ; +pub type NoNonoctalDecimalEscape = < analyzers :: correctness :: no_nonoctal_decimal_escape :: NoNonoctalDecimalEscape as biome_analyze :: Rule > :: Options ; +pub type NoParameterAssign = < semantic_analyzers :: style :: no_parameter_assign :: NoParameterAssign as biome_analyze :: Rule > :: Options ; +pub type NoParameterProperties = < analyzers :: style :: no_parameter_properties :: NoParameterProperties as biome_analyze :: Rule > :: Options ; +pub type NoPositiveTabindex = < semantic_analyzers :: a11y :: no_positive_tabindex :: NoPositiveTabindex as biome_analyze :: Rule > :: Options ; +pub type NoPrecisionLoss = + ::Options; +pub type NoPrototypeBuiltins = < analyzers :: suspicious :: no_prototype_builtins :: NoPrototypeBuiltins as biome_analyze :: Rule > :: Options ; +pub type NoReExportAll = + ::Options; +pub type NoRedeclare = + ::Options; +pub type NoRedundantAlt = + ::Options; +pub type NoRedundantRoles = + ::Options; +pub type NoRedundantUseStrict = < analyzers :: suspicious :: no_redundant_use_strict :: NoRedundantUseStrict as biome_analyze :: Rule > :: Options ; +pub type NoRenderReturnValue = < semantic_analyzers :: correctness :: no_render_return_value :: NoRenderReturnValue as biome_analyze :: Rule > :: Options ; +pub type NoRestrictedGlobals = < semantic_analyzers :: style :: no_restricted_globals :: NoRestrictedGlobals as biome_analyze :: Rule > :: Options ; +pub type NoRestrictedImports = < analyzers :: nursery :: no_restricted_imports :: NoRestrictedImports as biome_analyze :: Rule > :: Options ; +pub type NoSelfAssign = + ::Options; +pub type NoSelfCompare = + ::Options; +pub type NoSetterReturn = + ::Options; +pub type NoShadowRestrictedNames = < analyzers :: suspicious :: no_shadow_restricted_names :: NoShadowRestrictedNames as biome_analyze :: Rule > :: Options ; +pub type NoShoutyConstants = < semantic_analyzers :: style :: no_shouty_constants :: NoShoutyConstants as biome_analyze :: Rule > :: Options ; +pub type NoSkippedTests = + ::Options; +pub type NoSparseArray = + ::Options; +pub type NoStaticOnlyClass = < analyzers :: complexity :: no_static_only_class :: NoStaticOnlyClass as biome_analyze :: Rule > :: Options ; +pub type NoStringCaseMismatch = < analyzers :: correctness :: no_string_case_mismatch :: NoStringCaseMismatch as biome_analyze :: Rule > :: Options ; +pub type NoSvgWithoutTitle = + ::Options; +pub type NoSwitchDeclarations = < analyzers :: correctness :: no_switch_declarations :: NoSwitchDeclarations as biome_analyze :: Rule > :: Options ; +pub type NoThenProperty = + ::Options; +pub type NoThisInStatic = < semantic_analyzers :: complexity :: no_this_in_static :: NoThisInStatic as biome_analyze :: Rule > :: Options ; +pub type NoUndeclaredDependencies = < analyzers :: nursery :: no_undeclared_dependencies :: NoUndeclaredDependencies as biome_analyze :: Rule > :: Options ; +pub type NoUndeclaredVariables = < semantic_analyzers :: correctness :: no_undeclared_variables :: NoUndeclaredVariables as biome_analyze :: Rule > :: Options ; +pub type NoUnnecessaryContinue = < analyzers :: correctness :: no_unnecessary_continue :: NoUnnecessaryContinue as biome_analyze :: Rule > :: Options ; +pub type NoUnreachable = + ::Options; +pub type NoUnreachableSuper = < analyzers :: correctness :: no_unreachable_super :: NoUnreachableSuper as biome_analyze :: Rule > :: Options ; +pub type NoUnsafeDeclarationMerging = < semantic_analyzers :: suspicious :: no_unsafe_declaration_merging :: NoUnsafeDeclarationMerging as biome_analyze :: Rule > :: Options ; +pub type NoUnsafeFinally = + ::Options; +pub type NoUnsafeNegation = + ::Options; +pub type NoUnsafeOptionalChaining = < analyzers :: correctness :: no_unsafe_optional_chaining :: NoUnsafeOptionalChaining as biome_analyze :: Rule > :: Options ; +pub type NoUnusedImports = < semantic_analyzers :: nursery :: no_unused_imports :: NoUnusedImports as biome_analyze :: Rule > :: Options ; +pub type NoUnusedLabels = + ::Options; +pub type NoUnusedPrivateClassMembers = < analyzers :: nursery :: no_unused_private_class_members :: NoUnusedPrivateClassMembers as biome_analyze :: Rule > :: Options ; +pub type NoUnusedTemplateLiteral = < analyzers :: style :: no_unused_template_literal :: NoUnusedTemplateLiteral as biome_analyze :: Rule > :: Options ; +pub type NoUnusedVariables = < semantic_analyzers :: correctness :: no_unused_variables :: NoUnusedVariables as biome_analyze :: Rule > :: Options ; +pub type NoUselessCatch = + ::Options; +pub type NoUselessConstructor = < analyzers :: complexity :: no_useless_constructor :: NoUselessConstructor as biome_analyze :: Rule > :: Options ; +pub type NoUselessElse = + ::Options; +pub type NoUselessEmptyExport = < analyzers :: complexity :: no_useless_empty_export :: NoUselessEmptyExport as biome_analyze :: Rule > :: Options ; +pub type NoUselessFragments = < semantic_analyzers :: complexity :: no_useless_fragments :: NoUselessFragments as biome_analyze :: Rule > :: Options ; +pub type NoUselessLabel = + ::Options; +pub type NoUselessLoneBlockStatements = < analyzers :: nursery :: no_useless_lone_block_statements :: NoUselessLoneBlockStatements as biome_analyze :: Rule > :: Options ; +pub type NoUselessRename = + ::Options; +pub type NoUselessSwitchCase = < analyzers :: complexity :: no_useless_switch_case :: NoUselessSwitchCase as biome_analyze :: Rule > :: Options ; +pub type NoUselessTernary = + ::Options; +pub type NoUselessThisAlias = < semantic_analyzers :: complexity :: no_useless_this_alias :: NoUselessThisAlias as biome_analyze :: Rule > :: Options ; +pub type NoUselessTypeConstraint = < analyzers :: complexity :: no_useless_type_constraint :: NoUselessTypeConstraint as biome_analyze :: Rule > :: Options ; +pub type NoVar = ::Options; +pub type NoVoid = ::Options; +pub type NoVoidElementsWithChildren = < semantic_analyzers :: correctness :: no_void_elements_with_children :: NoVoidElementsWithChildren as biome_analyze :: Rule > :: Options ; +pub type NoVoidTypeReturn = + ::Options; +pub type NoWith = ::Options; +pub type UseAltText = ::Options; +pub type UseAnchorContent = + ::Options; +pub type UseAriaActivedescendantWithTabindex = < aria_analyzers :: a11y :: use_aria_activedescendant_with_tabindex :: UseAriaActivedescendantWithTabindex as biome_analyze :: Rule > :: Options ; +pub type UseAriaPropsForRole = < aria_analyzers :: a11y :: use_aria_props_for_role :: UseAriaPropsForRole as biome_analyze :: Rule > :: Options ; +pub type UseArrowFunction = + ::Options; +pub type UseAsConstAssertion = + ::Options; +pub type UseAwait = ::Options; +pub type UseBlockStatements = + ::Options; +pub type UseButtonType = + ::Options; +pub type UseCollapsedElseIf = + ::Options; +pub type UseConsistentArrayType = < analyzers :: nursery :: use_consistent_array_type :: UseConsistentArrayType as biome_analyze :: Rule > :: Options ; +pub type UseConst = + ::Options; +pub type UseDefaultParameterLast = < analyzers :: style :: use_default_parameter_last :: UseDefaultParameterLast as biome_analyze :: Rule > :: Options ; +pub type UseDefaultSwitchClauseLast = < analyzers :: suspicious :: use_default_switch_clause_last :: UseDefaultSwitchClauseLast as biome_analyze :: Rule > :: Options ; +pub type UseEnumInitializers = + ::Options; +pub type UseExhaustiveDependencies = < semantic_analyzers :: correctness :: use_exhaustive_dependencies :: UseExhaustiveDependencies as biome_analyze :: Rule > :: Options ; +pub type UseExponentiationOperator = < analyzers :: style :: use_exponentiation_operator :: UseExponentiationOperator as biome_analyze :: Rule > :: Options ; +pub type UseExportType = + ::Options; +pub type UseFilenamingConvention = < analyzers :: nursery :: use_filenaming_convention :: UseFilenamingConvention as biome_analyze :: Rule > :: Options ; +pub type UseFlatMap = + ::Options; +pub type UseForOf = + ::Options; +pub type UseFragmentSyntax = < semantic_analyzers :: style :: use_fragment_syntax :: UseFragmentSyntax as biome_analyze :: Rule > :: Options ; +pub type UseGetterReturn = + ::Options; +pub type UseGroupedTypeImport = < analyzers :: nursery :: use_grouped_type_import :: UseGroupedTypeImport as biome_analyze :: Rule > :: Options ; +pub type UseHeadingContent = + ::Options; +pub type UseHookAtTopLevel = < semantic_analyzers :: correctness :: use_hook_at_top_level :: UseHookAtTopLevel as biome_analyze :: Rule > :: Options ; +pub type UseHtmlLang = + ::Options; +pub type UseIframeTitle = + ::Options; +pub type UseImportRestrictions = < analyzers :: nursery :: use_import_restrictions :: UseImportRestrictions as biome_analyze :: Rule > :: Options ; +pub type UseImportType = + ::Options; +pub type UseIsArray = + ::Options; +pub type UseIsNan = + ::Options; +pub type UseKeyWithClickEvents = < analyzers :: a11y :: use_key_with_click_events :: UseKeyWithClickEvents as biome_analyze :: Rule > :: Options ; +pub type UseKeyWithMouseEvents = < analyzers :: a11y :: use_key_with_mouse_events :: UseKeyWithMouseEvents as biome_analyze :: Rule > :: Options ; +pub type UseLiteralEnumMembers = < analyzers :: style :: use_literal_enum_members :: UseLiteralEnumMembers as biome_analyze :: Rule > :: Options ; +pub type UseLiteralKeys = + ::Options; +pub type UseMediaCaption = + ::Options; +pub type UseNamespaceKeyword = < analyzers :: suspicious :: use_namespace_keyword :: UseNamespaceKeyword as biome_analyze :: Rule > :: Options ; +pub type UseNamingConvention = < semantic_analyzers :: style :: use_naming_convention :: UseNamingConvention as biome_analyze :: Rule > :: Options ; +pub type UseNodeAssertStrict = < analyzers :: nursery :: use_node_assert_strict :: UseNodeAssertStrict as biome_analyze :: Rule > :: Options ; +pub type UseNodejsImportProtocol = < analyzers :: nursery :: use_nodejs_import_protocol :: UseNodejsImportProtocol as biome_analyze :: Rule > :: Options ; +pub type UseNumberNamespace = < semantic_analyzers :: nursery :: use_number_namespace :: UseNumberNamespace as biome_analyze :: Rule > :: Options ; +pub type UseNumericLiterals = + ::Options; +pub type UseOptionalChain = + ::Options; +pub type UseRegexLiterals = + ::Options; +pub type UseSelfClosingElements = < analyzers :: style :: use_self_closing_elements :: UseSelfClosingElements as biome_analyze :: Rule > :: Options ; +pub type UseShorthandArrayType = < analyzers :: style :: use_shorthand_array_type :: UseShorthandArrayType as biome_analyze :: Rule > :: Options ; +pub type UseShorthandAssign = + ::Options; +pub type UseShorthandFunctionType = < analyzers :: nursery :: use_shorthand_function_type :: UseShorthandFunctionType as biome_analyze :: Rule > :: Options ; +pub type UseSimpleNumberKeys = < analyzers :: complexity :: use_simple_number_keys :: UseSimpleNumberKeys as biome_analyze :: Rule > :: Options ; +pub type UseSimplifiedLogicExpression = < analyzers :: complexity :: use_simplified_logic_expression :: UseSimplifiedLogicExpression as biome_analyze :: Rule > :: Options ; +pub type UseSingleCaseStatement = < analyzers :: style :: use_single_case_statement :: UseSingleCaseStatement as biome_analyze :: Rule > :: Options ; +pub type UseSingleVarDeclarator = < analyzers :: style :: use_single_var_declarator :: UseSingleVarDeclarator as biome_analyze :: Rule > :: Options ; +pub type UseSortedClasses = < semantic_analyzers :: nursery :: use_sorted_classes :: UseSortedClasses as biome_analyze :: Rule > :: Options ; +pub type UseTemplate = + ::Options; +pub type UseValidAnchor = + ::Options; +pub type UseValidAriaProps = + ::Options; +pub type UseValidAriaRole = + ::Options; +pub type UseValidAriaValues = < aria_analyzers :: a11y :: use_valid_aria_values :: UseValidAriaValues as biome_analyze :: Rule > :: Options ; +pub type UseValidForDirection = < analyzers :: correctness :: use_valid_for_direction :: UseValidForDirection as biome_analyze :: Rule > :: Options ; +pub type UseValidLang = + ::Options; +pub type UseValidTypeof = + ::Options; +pub type UseWhile = ::Options; +pub type UseYield = ::Options; diff --git a/crates/biome_js_analyze/src/react.rs b/crates/biome_js_analyze/src/react.rs index e135e8ef34b2..12580c92f4dd 100644 --- a/crates/biome_js_analyze/src/react.rs +++ b/crates/biome_js_analyze/src/react.rs @@ -19,7 +19,7 @@ pub(crate) trait ReactApiCall { /// A convenient data structure that returns the three arguments of the [React.createElement] call /// ///[React.createElement]: https://reactjs.org/docs/react-api.html#createelement -pub(crate) struct ReactCreateElementCall { +pub struct ReactCreateElementCall { /// The type of the react element pub(crate) element_type: AnyJsCallArgument, /// Optional props @@ -118,7 +118,7 @@ impl ReactApiCall for ReactCreateElementCall { } #[derive(Debug, Clone, Copy)] -pub(crate) enum ReactLibrary { +pub enum ReactLibrary { React, ReactDOM, } diff --git a/crates/biome_js_analyze/src/react/hooks.rs b/crates/biome_js_analyze/src/react/hooks.rs index 4f6970c961f9..c8799b83c8d8 100644 --- a/crates/biome_js_analyze/src/react/hooks.rs +++ b/crates/biome_js_analyze/src/react/hooks.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; /// Return result of [react_hook_with_dependency]. #[derive(Debug)] -pub(crate) struct ReactCallWithDependencyResult { +pub struct ReactCallWithDependencyResult { pub(crate) function_name_range: TextRange, pub(crate) closure_node: Option, pub(crate) dependencies_node: Option, diff --git a/crates/biome_js_analyze/src/semantic_analyzers.rs b/crates/biome_js_analyze/src/semantic_analyzers.rs index 3cdc41e70a58..a2aab6fe9980 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers.rs @@ -1,11 +1,11 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod a11y; -pub(crate) mod complexity; -pub(crate) mod correctness; -pub(crate) mod nursery; -pub(crate) mod performance; -pub(crate) mod security; -pub(crate) mod style; -pub(crate) mod suspicious; -::biome_analyze::declare_category! { pub (crate) SemanticAnalyzers { kind : Lint , groups : [self :: a11y :: A11y , self :: complexity :: Complexity , self :: correctness :: Correctness , self :: nursery :: Nursery , self :: performance :: Performance , self :: security :: Security , self :: style :: Style , self :: suspicious :: Suspicious ,] } } +pub mod a11y; +pub mod complexity; +pub mod correctness; +pub mod nursery; +pub mod performance; +pub mod security; +pub mod style; +pub mod suspicious; +::biome_analyze::declare_category! { pub SemanticAnalyzers { kind : Lint , groups : [self :: a11y :: A11y , self :: complexity :: Complexity , self :: correctness :: Correctness , self :: nursery :: Nursery , self :: performance :: Performance , self :: security :: Security , self :: style :: Style , self :: suspicious :: Suspicious ,] } } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/a11y.rs b/crates/biome_js_analyze/src/semantic_analyzers/a11y.rs index 9e2e2295e534..52801c7d2036 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/a11y.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/a11y.rs @@ -2,11 +2,11 @@ use biome_analyze::declare_group; -pub(crate) mod no_positive_tabindex; -pub(crate) mod use_button_type; +pub mod no_positive_tabindex; +pub mod use_button_type; declare_group! { - pub (crate) A11y { + pub A11y { name : "a11y" , rules : [ self :: no_positive_tabindex :: NoPositiveTabindex , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/a11y/no_positive_tabindex.rs b/crates/biome_js_analyze/src/semantic_analyzers/a11y/no_positive_tabindex.rs index c47327f38f0b..05f27733962c 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/a11y/no_positive_tabindex.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/a11y/no_positive_tabindex.rs @@ -48,7 +48,7 @@ declare_rule! { /// ```js /// React.createElement("div", { tabIndex: -1 }) /// ``` - pub(crate) NoPositiveTabindex { + pub NoPositiveTabindex { version: "1.0.0", name: "noPositiveTabindex", source: RuleSource::EslintJsxA11y("tabindex-no-positive"), @@ -58,11 +58,11 @@ declare_rule! { } declare_node_union! { - pub(crate) TabindexProp = JsxAttribute | JsPropertyObjectMember + pub TabindexProp = JsxAttribute | JsPropertyObjectMember } declare_node_union! { - pub(crate) NoPositiveTabindexQuery = AnyJsxElement | JsCallExpression + pub NoPositiveTabindexQuery = AnyJsxElement | JsCallExpression } declare_node_union! { @@ -74,7 +74,7 @@ declare_node_union! { /// - `JsNumberLiteralExpression` — `5` /// - `JsUnaryExpression` — `+5` | `-5` /// - pub(crate) AnyNumberLikeExpression = JsStringLiteralExpression | JsNumberLiteralExpression | JsUnaryExpression + pub AnyNumberLikeExpression = JsStringLiteralExpression | JsNumberLiteralExpression | JsUnaryExpression } impl NoPositiveTabindexQuery { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/a11y/use_button_type.rs b/crates/biome_js_analyze/src/semantic_analyzers/a11y/use_button_type.rs index 4c2f7746fb2b..e735ef6226b9 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/a11y/use_button_type.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/a11y/use_button_type.rs @@ -36,7 +36,7 @@ declare_rule! { /// /// /// ``` - pub(crate) UseButtonType { + pub UseButtonType { version: "1.0.0", name: "useButtonType", source: RuleSource::EslintReact("button-has-type"), @@ -47,10 +47,10 @@ declare_rule! { const ALLOWED_BUTTON_TYPES: [&str; 3] = ["submit", "button", "reset"]; declare_node_union! { - pub(crate) UseButtonTypeQuery = JsxSelfClosingElement | JsxOpeningElement | JsCallExpression + pub UseButtonTypeQuery = JsxSelfClosingElement | JsxOpeningElement | JsCallExpression } -pub(crate) struct UseButtonTypeState { +pub struct UseButtonTypeState { range: TextRange, missing_prop: bool, } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/complexity.rs b/crates/biome_js_analyze/src/semantic_analyzers/complexity.rs index aeb5cb92796d..4b2866f7dd68 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/complexity.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/complexity.rs @@ -2,13 +2,13 @@ use biome_analyze::declare_group; -pub(crate) mod no_banned_types; -pub(crate) mod no_this_in_static; -pub(crate) mod no_useless_fragments; -pub(crate) mod no_useless_this_alias; +pub mod no_banned_types; +pub mod no_this_in_static; +pub mod no_useless_fragments; +pub mod no_useless_this_alias; declare_group! { - pub (crate) Complexity { + pub Complexity { name : "complexity" , rules : [ self :: no_banned_types :: NoBannedTypes , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_banned_types.rs b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_banned_types.rs index dd6f53902afc..6f10fbe88c51 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_banned_types.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_banned_types.rs @@ -88,7 +88,7 @@ declare_rule! { /// let tuple: [boolean, string] = [false, "foo"]; /// ``` /// - pub(crate) NoBannedTypes { + pub NoBannedTypes { version: "1.0.0", name: "noBannedTypes", source: RuleSource::EslintTypeScript("ban-types"), @@ -185,7 +185,7 @@ impl Rule for NoBannedTypes { } declare_node_union! { - pub(crate) TsBannedType = TsReferenceType | TsObjectType + pub TsBannedType = TsReferenceType | TsObjectType } pub struct State { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_this_in_static.rs b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_this_in_static.rs index c3885c4b4634..1aecb591012d 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_this_in_static.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_this_in_static.rs @@ -78,7 +78,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoThisInStatic { + pub NoThisInStatic { version: "1.3.1", name: "noThisInStatic", source: RuleSource::EslintMysticatea("no-this-in-static"), @@ -180,7 +180,7 @@ impl Rule for NoThisInStatic { } declare_node_union! { - pub(crate) JsThisSuperExpression = JsSuperExpression | JsThisExpression + pub JsThisSuperExpression = JsSuperExpression | JsThisExpression } impl JsThisSuperExpression { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs index f6343f8a7b90..a3fc888a428d 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs @@ -57,7 +57,7 @@ declare_rule! { /// <>foo {bar} /// ``` /// - pub(crate) NoUselessFragments { + pub NoUselessFragments { version: "1.0.0", name: "noUselessFragments", source: RuleSource::EslintReact("jsx-no-useless-fragment"), @@ -67,13 +67,13 @@ declare_rule! { } #[derive(Debug)] -pub(crate) enum NoUselessFragmentsState { +pub enum NoUselessFragmentsState { Empty, Child(AnyJsxChild), } declare_node_union! { - pub(crate) NoUselessFragmentsQuery = JsxFragment | JsxElement + pub NoUselessFragmentsQuery = JsxFragment | JsxElement } impl NoUselessFragmentsQuery { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_this_alias.rs b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_this_alias.rs index e2865dca1c39..bfc0c5a0b3bf 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_this_alias.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/complexity/no_useless_this_alias.rs @@ -49,7 +49,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoUselessThisAlias { + pub NoUselessThisAlias { version: "1.0.0", name: "noUselessThisAlias", source: RuleSource::EslintTypeScript("no-this-alias"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness.rs index 61d61de31df3..28332187753e 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness.rs @@ -2,22 +2,22 @@ use biome_analyze::declare_group; -pub(crate) mod no_children_prop; -pub(crate) mod no_const_assign; -pub(crate) mod no_constant_condition; -pub(crate) mod no_global_object_calls; -pub(crate) mod no_invalid_new_builtin; -pub(crate) mod no_new_symbol; -pub(crate) mod no_render_return_value; -pub(crate) mod no_undeclared_variables; -pub(crate) mod no_unused_variables; -pub(crate) mod no_void_elements_with_children; -pub(crate) mod use_exhaustive_dependencies; -pub(crate) mod use_hook_at_top_level; -pub(crate) mod use_is_nan; +pub mod no_children_prop; +pub mod no_const_assign; +pub mod no_constant_condition; +pub mod no_global_object_calls; +pub mod no_invalid_new_builtin; +pub mod no_new_symbol; +pub mod no_render_return_value; +pub mod no_undeclared_variables; +pub mod no_unused_variables; +pub mod no_void_elements_with_children; +pub mod use_exhaustive_dependencies; +pub mod use_hook_at_top_level; +pub mod use_is_nan; declare_group! { - pub (crate) Correctness { + pub Correctness { name : "correctness" , rules : [ self :: no_children_prop :: NoChildrenProp , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_children_prop.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_children_prop.rs index f2b52b63a7e1..524d43a3c192 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_children_prop.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_children_prop.rs @@ -22,7 +22,7 @@ declare_rule! { /// ```js,expect_diagnostic /// React.createElement('div', { children: 'foo' }); /// ``` - pub(crate) NoChildrenProp { + pub NoChildrenProp { version: "1.0.0", name: "noChildrenProp", source: RuleSource::EslintReact("no-children-prop"), @@ -31,10 +31,10 @@ declare_rule! { } declare_node_union! { - pub(crate) NoChildrenPropQuery = JsxAttribute | JsCallExpression + pub NoChildrenPropQuery = JsxAttribute | JsCallExpression } -pub(crate) enum NoChildrenPropState { +pub enum NoChildrenPropState { JsxProp(TextRange), MemberProp(TextRange), } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_const_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_const_assign.rs index 930e7a6b99a7..2146363d3ddc 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_const_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_const_assign.rs @@ -47,7 +47,7 @@ declare_rule! { /// b = 20; /// ``` /// - pub(crate) NoConstAssign { + pub NoConstAssign { version: "1.0.0", name: "noConstAssign", source: RuleSource::Eslint("no-const-assign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_constant_condition.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_constant_condition.rs index 9fe60453fa24..de3bf25ac3dd 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_constant_condition.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_constant_condition.rs @@ -79,7 +79,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoConstantCondition { + pub NoConstantCondition { version: "1.0.0", name: "noConstantCondition", source: RuleSource::Eslint("no-constant-condition"), @@ -88,7 +88,7 @@ declare_rule! { } declare_node_union! { - pub(crate) ConditionalStatement = JsConditionalExpression | JsWhileStatement | JsDoWhileStatement | JsIfStatement | JsForStatement + pub ConditionalStatement = JsConditionalExpression | JsWhileStatement | JsDoWhileStatement | JsIfStatement | JsForStatement } impl Rule for NoConstantCondition { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_global_object_calls.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_global_object_calls.rs index 82caf68b14f8..878936576476 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_global_object_calls.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_global_object_calls.rs @@ -83,7 +83,7 @@ declare_rule! { /// var segmenterFr = new Intl.Segmenter("fr", { granularity: "word" }); /// ``` /// - pub(crate) NoGlobalObjectCalls { + pub NoGlobalObjectCalls { version: "1.0.0", name: "noGlobalObjectCalls", source: RuleSource::Eslint("no-obj-calls"), @@ -125,7 +125,7 @@ impl Rule for NoGlobalObjectCalls { declare_node_union! { /// Enum for [JsCallExpression] and [JsNewExpression] - pub(crate) QueryNode = JsNewExpression | JsCallExpression + pub QueryNode = JsNewExpression | JsCallExpression } impl QueryNode { @@ -138,7 +138,7 @@ impl QueryNode { } #[derive(Debug, Clone, Copy, Eq, PartialEq)] -pub(crate) enum NonCallableGlobals { +pub enum NonCallableGlobals { Atomics, Json, Math, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_invalid_new_builtin.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_invalid_new_builtin.rs index 1b72049f9b88..192353137a73 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_invalid_new_builtin.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_invalid_new_builtin.rs @@ -49,7 +49,7 @@ declare_rule! { /// const corge = new BigInt(9007199254740991); /// } /// ``` - pub(crate) NoInvalidNewBuiltin { + pub NoInvalidNewBuiltin { version: "1.3.0", name: "noInvalidNewBuiltin", source: RuleSource::Eslint("no-new-native-nonconstructor"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_new_symbol.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_new_symbol.rs index 7ea89dd184b8..b5deb3756f11 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_new_symbol.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_new_symbol.rs @@ -30,7 +30,7 @@ declare_rule! { /// new Symbol(); /// } /// ``` - pub(crate) NoNewSymbol { + pub NoNewSymbol { version: "1.0.0", name: "noNewSymbol", recommended: false, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_render_return_value.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_render_return_value.rs index 2be43c9e64f8..5d0efeb9d9c8 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_render_return_value.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_render_return_value.rs @@ -29,7 +29,7 @@ declare_rule! { /// ```jsx /// ReactDOM.render(
, document.body); /// ``` - pub(crate) NoRenderReturnValue { + pub NoRenderReturnValue { version: "1.0.0", name: "noRenderReturnValue", recommended: true, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_undeclared_variables.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_undeclared_variables.rs index 31f557435016..a73b5ed6bf7c 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_undeclared_variables.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_undeclared_variables.rs @@ -31,7 +31,7 @@ declare_rule! { /// ```ts /// type B = PromiseLike /// ``` - pub(crate) NoUndeclaredVariables { + pub NoUndeclaredVariables { version: "1.0.0", name: "noUndeclaredVariables", source: RuleSource::Eslint("no-undef"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs index bf141ca9fe64..c50aea99a036 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs @@ -96,7 +96,7 @@ declare_rule! { /// } /// used_overloaded(); /// ``` - pub(crate) NoUnusedVariables { + pub NoUnusedVariables { version: "1.0.0", name: "noUnusedVariables", source: RuleSource::Eslint("no-unused-vars"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_void_elements_with_children.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_void_elements_with_children.rs index 02ecbb79835a..50e91837d4db 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_void_elements_with_children.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/no_void_elements_with_children.rs @@ -30,7 +30,7 @@ declare_rule! { /// ```js,expect_diagnostic /// React.createElement('img', {}, 'child') /// ``` - pub(crate) NoVoidElementsWithChildren { + pub NoVoidElementsWithChildren { version: "1.0.0", name: "noVoidElementsWithChildren", source: RuleSource::EslintReact("void-dom-elements-no-children"), @@ -40,7 +40,7 @@ declare_rule! { } declare_node_union! { - pub(crate) NoVoidElementsWithChildrenQuery = JsxElement | JsCallExpression | JsxSelfClosingElement + pub NoVoidElementsWithChildrenQuery = JsxElement | JsCallExpression | JsxSelfClosingElement } /// Returns true if the name of the element belong to a self-closing element @@ -66,7 +66,7 @@ fn is_void_dom_element(element_name: &str) -> bool { ) } -pub(crate) enum NoVoidElementsWithChildrenCause { +pub enum NoVoidElementsWithChildrenCause { /// The cause affects React using JSX code Jsx { /// If the current element has children props in style @@ -99,7 +99,7 @@ pub(crate) enum NoVoidElementsWithChildrenCause { }, } -pub(crate) struct NoVoidElementsWithChildrenState { +pub struct NoVoidElementsWithChildrenState { /// The name of the element that triggered the rule element_name: String, /// It tracks the causes that triggers the rule diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs index 806de2c26cd1..a72db5df499f 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_exhaustive_dependencies.rs @@ -165,7 +165,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseExhaustiveDependencies { + pub UseExhaustiveDependencies { version: "1.0.0", name: "useExhaustiveDependencies", source: RuleSource::EslintReactHooks("exhaustive-deps"), @@ -474,11 +474,11 @@ impl Rule for UseExhaustiveDependencies { type Query = Semantic; type State = Fix; type Signals = Vec; - type Options = HooksOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Vec { let options = ctx.options(); - let options = ReactExtensiveDependenciesOptions::new(options.clone()); + let options = ReactExtensiveDependenciesOptions::new(options.as_ref().clone()); let mut signals = vec![]; diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_hook_at_top_level.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_hook_at_top_level.rs index dd91dfdb7011..e0c7828294e1 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_hook_at_top_level.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_hook_at_top_level.rs @@ -62,7 +62,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseHookAtTopLevel { + pub UseHookAtTopLevel { version: "1.0.0", name: "useHookAtTopLevel", source: RuleSource::EslintReactHooks("rules-of-hooks"), @@ -364,7 +364,7 @@ impl Phase for FunctionCallServices { } #[derive(Clone)] -pub(crate) struct FunctionCall(JsCallExpression); +pub struct FunctionCall(JsCallExpression); impl QueryMatch for FunctionCall { fn text_range(&self) -> TextRange { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs index daa950634fdb..8cd3e6cb16d7 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs @@ -59,7 +59,7 @@ declare_rule! { /// switch(foo) {} /// ``` /// - pub(crate) UseIsNan { + pub UseIsNan { version: "1.0.0", name: "useIsNan", source: RuleSource::Eslint("use-isnan"), @@ -69,7 +69,7 @@ declare_rule! { } declare_node_union! { - pub(crate) UseIsNanQuery = JsBinaryExpression | JsCaseClause | JsSwitchStatement + pub UseIsNanQuery = JsBinaryExpression | JsCaseClause | JsSwitchStatement } enum Message { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery.rs index 9f75fe7f0f5a..cffe034a4565 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery.rs @@ -2,22 +2,22 @@ use biome_analyze::declare_group; -pub(crate) mod no_console; -pub(crate) mod no_global_assign; -pub(crate) mod no_global_eval; -pub(crate) mod no_invalid_use_before_declaration; -pub(crate) mod no_misleading_character_class; -pub(crate) mod no_re_export_all; -pub(crate) mod no_then_property; -pub(crate) mod no_unused_imports; -pub(crate) mod use_export_type; -pub(crate) mod use_for_of; -pub(crate) mod use_import_type; -pub(crate) mod use_number_namespace; -pub(crate) mod use_sorted_classes; +pub mod no_console; +pub mod no_global_assign; +pub mod no_global_eval; +pub mod no_invalid_use_before_declaration; +pub mod no_misleading_character_class; +pub mod no_re_export_all; +pub mod no_then_property; +pub mod no_unused_imports; +pub mod use_export_type; +pub mod use_for_of; +pub mod use_import_type; +pub mod use_number_namespace; +pub mod use_sorted_classes; declare_group! { - pub (crate) Nursery { + pub Nursery { name : "nursery" , rules : [ self :: no_console :: NoConsole , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_console.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_console.rs index f89795dcba9e..307f7513af04 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_console.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_console.rs @@ -20,7 +20,7 @@ declare_rule! { /// console.error('hello world') /// ``` /// - pub(crate) NoConsole { + pub NoConsole { version: "next", name: "noConsole", source: RuleSource::Eslint("no-console"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_assign.rs index 96fdd26abbc0..7956b0660b07 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_assign.rs @@ -40,7 +40,7 @@ declare_rule! { /// let window; /// window = {}; /// ``` - pub(crate) NoGlobalAssign { + pub NoGlobalAssign { version: "1.5.0", name: "noGlobalAssign", source: RuleSource::Eslint("no-global-assign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_eval.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_eval.rs index d8b7570706b5..a67c0bbb8e90 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_eval.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_global_eval.rs @@ -49,7 +49,7 @@ declare_rule! { /// let foo = globalThis; /// foo.eval("let a = 0;"); /// ``` - pub(crate) NoGlobalEval { + pub NoGlobalEval { version: "1.5.0", name: "noGlobalEval", source: RuleSource::Eslint("no-eval"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_invalid_use_before_declaration.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_invalid_use_before_declaration.rs index a527e56738c6..53e0a0f7fea2 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_invalid_use_before_declaration.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_invalid_use_before_declaration.rs @@ -57,7 +57,7 @@ declare_rule! { /// function f() { return CONSTANT; } /// const CONSTANT = 0; /// ``` - pub(crate) NoInvalidUseBeforeDeclaration { + pub NoInvalidUseBeforeDeclaration { version: "1.5.0", name: "noInvalidUseBeforeDeclaration", source: RuleSource::EslintTypeScript("no-use-before-define"), @@ -176,14 +176,14 @@ impl Rule for NoInvalidUseBeforeDeclaration { } #[derive(Debug)] -pub(crate) struct InvalidUseBeforeDeclaration { +pub struct InvalidUseBeforeDeclaration { declaration_kind: DeclarationKind, reference_range: TextRange, binding_range: TextRange, } #[derive(Debug, Copy, Clone)] -pub(crate) enum DeclarationKind { +pub enum DeclarationKind { Parameter, Variable, } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_misleading_character_class.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_misleading_character_class.rs index a7ef5c31de1f..56954769c529 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_misleading_character_class.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_misleading_character_class.rs @@ -58,9 +58,7 @@ declare_rule! { /// /^[👍]$/u; /// /^[\q{👶🏻}]$/v; /// ``` - /// - - pub(crate) NoMisleadingCharacterClass { + pub NoMisleadingCharacterClass { version: "1.5.0", name: "noMisleadingCharacterClass", source: RuleSource::Eslint("no-misleading-character-class"), @@ -70,7 +68,7 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyRegexExpression = JsNewExpression | JsCallExpression | JsRegexLiteralExpression + pub AnyRegexExpression = JsNewExpression | JsCallExpression | JsRegexLiteralExpression } pub enum Message { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_re_export_all.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_re_export_all.rs index 7f50e6581ba5..9c7c31f6a542 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_re_export_all.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_re_export_all.rs @@ -30,7 +30,7 @@ declare_rule! { /// export { foo } from "foo"; /// ``` /// - pub(crate) NoReExportAll { + pub NoReExportAll { version: "next", name: "noReExportAll", recommended: false, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_then_property.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_then_property.rs index 5c2c45235d1c..a2e45729b6b2 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_then_property.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_then_property.rs @@ -83,7 +83,7 @@ declare_rule! { /// const foo = bar.then; /// ``` /// - pub(crate) NoThenProperty { + pub NoThenProperty { version: "1.5.0", name: "noThenProperty", source: RuleSource::EslintUnicorn("no-thenable"), @@ -92,7 +92,7 @@ declare_rule! { } declare_node_union! { - pub(crate) NoThenPropertyQuery = + pub NoThenPropertyQuery = AnyJsObjectMember | JsComputedMemberName | AnyJsClassMember | diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_unused_imports.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_unused_imports.rs index 47a4f932daaa..8725401a8604 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_unused_imports.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/no_unused_imports.rs @@ -61,7 +61,7 @@ declare_rule! { /// return new A(arg); /// } /// ``` - pub(crate) NoUnusedImports { + pub NoUnusedImports { version: "1.3.0", name: "noUnusedImports", recommended: false, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_export_type.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_export_type.rs index c696fc90cef8..31dd34d3f832 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_export_type.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_export_type.rs @@ -57,7 +57,7 @@ declare_rule! { /// ```ts,ignore /// export { TypeA } from "./mod.ts" /// ``` - pub(crate) UseExportType { + pub UseExportType { version: "1.5.0", name: "useExportType", source: RuleSource::EslintTypeScript("consistent-type-exports"), @@ -213,7 +213,7 @@ impl Rule for UseExportType { } #[derive(Debug)] -pub(crate) enum ExportTypeFix { +pub enum ExportTypeFix { /** * Group inline type exports such as `export { type A, type B }` into `export type { A, B }`. */ diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_for_of.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_for_of.rs index 3431cf65df2b..a5e67526eb58 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_for_of.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_for_of.rs @@ -40,7 +40,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) UseForOf { + pub UseForOf { version: "1.5.0", name: "useForOf", source: RuleSource::EslintTypeScript("prefer-for-of"), @@ -49,11 +49,11 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyIncrementableLike = JsPostUpdateExpression | JsPreUpdateExpression | JsAssignmentExpression + pub AnyIncrementableLike = JsPostUpdateExpression | JsPreUpdateExpression | JsAssignmentExpression } declare_node_union! { - pub(crate) AnyBindingExpression = JsPostUpdateExpression | JsPreUpdateExpression | JsIdentifierExpression | JsShorthandPropertyObjectMember + pub AnyBindingExpression = JsPostUpdateExpression | JsPreUpdateExpression | JsIdentifierExpression | JsShorthandPropertyObjectMember } impl Rule for UseForOf { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_import_type.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_import_type.rs index b649d41aa304..29ced7b254a9 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_import_type.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_import_type.rs @@ -64,7 +64,7 @@ declare_rule! { /// import { B } from "./mod.js" with {}; /// export type { B }; /// ``` - pub(crate) UseImportType { + pub UseImportType { version: "1.5.0", name: "useImportType", source: RuleSource::EslintTypeScript("consistent-type-imports"), @@ -462,7 +462,7 @@ impl Rule for UseImportType { } #[derive(Debug)] -pub(crate) enum ImportTypeFix { +pub enum ImportTypeFix { UseImportType, ExtractDefaultImportType(Vec), ExtractCombinedImportType, @@ -485,7 +485,7 @@ fn is_only_used_as_type(model: &SemanticModel, binding: &JsIdentifierBinding) -> } #[derive(Debug)] -pub(crate) enum NamedImportTypeFix { +pub enum NamedImportTypeFix { UseImportType(Vec), AddInlineTypeQualifiers(Vec), } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_number_namespace.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_number_namespace.rs index 703b5d841559..f743af1d25f5 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_number_namespace.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_number_namespace.rs @@ -65,7 +65,7 @@ declare_rule! { /// Number.NEGATIVE_INFINITY; // false /// ``` /// - pub(crate) UseNumberNamespace { + pub UseNumberNamespace { version: "1.5.0", name: "useNumberNamespace", source: RuleSource::EslintUnicorn("prefer-number-properties"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_sorted_classes.rs b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_sorted_classes.rs index ccbb91992247..a4537abea4c2 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_sorted_classes.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/nursery/use_sorted_classes.rs @@ -137,7 +137,7 @@ declare_rule! { /// /// This is a deliberate decision. We're unsure about this behavior, and would appreciate feedback on it. If this is a problem for you, please share a detailed explanation of your use case in [the GitHub issue](https://github.com/biomejs/biome/issues/1274). /// - pub(crate) UseSortedClasses { + pub UseSortedClasses { version: "next", name: "useSortedClasses", recommended: false, @@ -156,7 +156,7 @@ impl Rule for UseSortedClasses { type Query = Ast; type State = String; type Signals = Option; - type Options = UtilityClassSortingOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Option { let options = ctx.options(); diff --git a/crates/biome_js_analyze/src/semantic_analyzers/performance.rs b/crates/biome_js_analyze/src/semantic_analyzers/performance.rs index 0de72aca9752..562dbcfb186a 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/performance.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/performance.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod no_accumulating_spread; +pub mod no_accumulating_spread; declare_group! { - pub (crate) Performance { + pub Performance { name : "performance" , rules : [ self :: no_accumulating_spread :: NoAccumulatingSpread , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/performance/no_accumulating_spread.rs b/crates/biome_js_analyze/src/semantic_analyzers/performance/no_accumulating_spread.rs index 7eca61334598..1222a5923a45 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/performance/no_accumulating_spread.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/performance/no_accumulating_spread.rs @@ -45,7 +45,7 @@ declare_rule! { /// a.reduce((acc, val) => {acc.push(val); return acc}, []); /// ``` /// - pub(crate) NoAccumulatingSpread { + pub NoAccumulatingSpread { version: "1.0.0", name: "noAccumulatingSpread", recommended: true, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/security.rs b/crates/biome_js_analyze/src/semantic_analyzers/security.rs index 2f7ad8b1d7b1..9f94fd02de1e 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/security.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/security.rs @@ -2,11 +2,11 @@ use biome_analyze::declare_group; -pub(crate) mod no_dangerously_set_inner_html; -pub(crate) mod no_dangerously_set_inner_html_with_children; +pub mod no_dangerously_set_inner_html; +pub mod no_dangerously_set_inner_html_with_children; declare_group! { - pub (crate) Security { + pub Security { name : "security" , rules : [ self :: no_dangerously_set_inner_html :: NoDangerouslySetInnerHtml , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html.rs b/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html.rs index 48aef1ee8587..2841a6a64e7f 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html.rs @@ -25,7 +25,7 @@ declare_rule! { /// dangerouslySetInnerHTML: { __html: 'child' } /// }); /// ``` - pub(crate) NoDangerouslySetInnerHtml { + pub NoDangerouslySetInnerHtml { version: "1.0.0", name: "noDangerouslySetInnerHtml", source: RuleSource::EslintReact("no-danger-with-children"), @@ -34,10 +34,10 @@ declare_rule! { } declare_node_union! { - pub(crate) AnyJsCreateElement = JsxAttribute | JsCallExpression + pub AnyJsCreateElement = JsxAttribute | JsCallExpression } -pub(crate) enum NoDangerState { +pub enum NoDangerState { Attribute(TextRange), Property(TextRange), } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html_with_children.rs b/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html_with_children.rs index c7d836631f2a..03f955ce896c 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html_with_children.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/security/no_dangerously_set_inner_html_with_children.rs @@ -34,7 +34,7 @@ declare_rule! { /// ```js,expect_diagnostic /// React.createElement('div', { dangerouslySetInnerHTML: { __html: 'HTML' } }, 'children') /// ``` - pub(crate) NoDangerouslySetInnerHtmlWithChildren { + pub NoDangerouslySetInnerHtmlWithChildren { version: "1.0.0", name: "noDangerouslySetInnerHtmlWithChildren", source: RuleSource::EslintReact("no-danger"), @@ -43,7 +43,7 @@ declare_rule! { } declare_node_union! { - pub(crate) DangerousProp = JsxAttribute | JsPropertyObjectMember + pub DangerousProp = JsxAttribute | JsPropertyObjectMember } /// The kind of children enum ChildrenKind { @@ -67,7 +67,7 @@ impl ChildrenKind { } } -pub(crate) struct RuleState { +pub struct RuleState { /// The `dangerouslySetInnerHTML` prop range dangerous_prop: TextRange, @@ -76,7 +76,7 @@ pub(crate) struct RuleState { } declare_node_union! { - pub(crate) AnyJsCreateElement = JsxElement | JsxSelfClosingElement | JsCallExpression + pub AnyJsCreateElement = JsxElement | JsxSelfClosingElement | JsCallExpression } impl AnyJsCreateElement { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style.rs b/crates/biome_js_analyze/src/semantic_analyzers/style.rs index ca09c329254b..6902aa9dfa02 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style.rs @@ -2,17 +2,17 @@ use biome_analyze::declare_group; -pub(crate) mod no_arguments; -pub(crate) mod no_parameter_assign; -pub(crate) mod no_restricted_globals; -pub(crate) mod no_shouty_constants; -pub(crate) mod no_var; -pub(crate) mod use_const; -pub(crate) mod use_fragment_syntax; -pub(crate) mod use_naming_convention; +pub mod no_arguments; +pub mod no_parameter_assign; +pub mod no_restricted_globals; +pub mod no_shouty_constants; +pub mod no_var; +pub mod use_const; +pub mod use_fragment_syntax; +pub mod use_naming_convention; declare_group! { - pub (crate) Style { + pub Style { name : "style" , rules : [ self :: no_arguments :: NoArguments , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/no_arguments.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/no_arguments.rs index b7af008dc894..37305cc92afd 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/no_arguments.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/no_arguments.rs @@ -24,7 +24,7 @@ declare_rule! { /// console.log(arguments); /// } /// ``` - pub(crate) NoArguments { + pub NoArguments { version: "1.0.0", name: "noArguments", source: RuleSource::Eslint("prefer-rest-params"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/no_parameter_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/no_parameter_assign.rs index 1c6b6f18b1fc..a2a4728a8333 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/no_parameter_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/no_parameter_assign.rs @@ -53,7 +53,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoParameterAssign { + pub NoParameterAssign { version: "1.0.0", name: "noParameterAssign", source: RuleSource::Eslint("no-param-reassign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/no_restricted_globals.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/no_restricted_globals.rs index 38a6d57a00f0..96feb31e414c 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/no_restricted_globals.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/no_restricted_globals.rs @@ -45,7 +45,7 @@ declare_rule! { /// In the example above, the rule will emit a diagnostics if tried to use `$` or `MooTools` without /// creating a local variable. /// - pub(crate) NoRestrictedGlobals { + pub NoRestrictedGlobals { version: "1.0.0", name: "noRestrictedGlobals", source: RuleSource::Eslint("no-restricted-globals"), @@ -69,7 +69,7 @@ impl Rule for NoRestrictedGlobals { type Query = SemanticServices; type State = (TextRange, String); type Signals = Vec; - type Options = RestrictedGlobalsOptions; + type Options = Box; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/no_shouty_constants.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/no_shouty_constants.rs index cc5b74a518c2..a2a5480367a8 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/no_shouty_constants.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/no_shouty_constants.rs @@ -44,7 +44,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoShoutyConstants { + pub NoShoutyConstants { version: "1.0.0", name: "noShoutyConstants", recommended: false, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/no_var.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/no_var.rs index 3288fa303c88..e34ed4e5aa2a 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/no_var.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/no_var.rs @@ -34,7 +34,7 @@ declare_rule! { /// const foo = 1; /// let bar = 1; ///``` - pub(crate) NoVar { + pub NoVar { version: "1.0.0", name: "noVar", source: RuleSource::Eslint("no-var"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/use_const.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/use_const.rs index 27fc7938d767..8abaf01c25b4 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/use_const.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/use_const.rs @@ -56,7 +56,7 @@ declare_rule! { /// let a = 1, b = 2; /// b = 3; /// ``` - pub(crate) UseConst { + pub UseConst { version: "1.0.0", name: "useConst", source: RuleSource::Eslint("prefer-const"), @@ -132,7 +132,7 @@ impl Rule for UseConst { } } -pub(crate) struct ConstBindings { +pub struct ConstBindings { pub can_be_const: Vec, pub can_fix: bool, } @@ -302,7 +302,7 @@ fn with_binding_identifier( } declare_node_union! { - pub(crate) DestructuringHost = JsVariableDeclarator | JsAssignmentExpression + pub DestructuringHost = JsVariableDeclarator | JsAssignmentExpression } impl DestructuringHost { diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/use_fragment_syntax.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/use_fragment_syntax.rs index 20e6aa6516e2..fe42eeeaf365 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/use_fragment_syntax.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/use_fragment_syntax.rs @@ -27,7 +27,7 @@ declare_rule! { /// ```js,expect_diagnostic /// child /// ``` - pub(crate) UseFragmentSyntax { + pub UseFragmentSyntax { version: "1.0.0", name: "useFragmentSyntax", source: RuleSource::EslintReact("jsx-fragments"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/style/use_naming_convention.rs b/crates/biome_js_analyze/src/semantic_analyzers/style/use_naming_convention.rs index 77a2f9a11a77..d6f5448ded1f 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/style/use_naming_convention.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/style/use_naming_convention.rs @@ -281,7 +281,7 @@ declare_rule! { /// [`camelCase`]: https://en.wikipedia.org/wiki/Camel_case /// [`PascalCase`]: https://en.wikipedia.org/wiki/Camel_case /// [`CONSTANT_CASE`]: https://en.wikipedia.org/wiki/Snake_case - pub(crate) UseNamingConvention { + pub UseNamingConvention { version: "1.0.0", name: "useNamingConvention", source: RuleSource::EslintTypeScript("naming-convention"), @@ -459,7 +459,7 @@ impl Rule for UseNamingConvention { declare_node_union! { /// Ast nodes that defines a name. - pub(crate) AnyIdentifierBindingLike = + pub AnyIdentifierBindingLike = JsIdentifierBinding | JsLiteralMemberName | JsPrivateClassMemberName | @@ -490,13 +490,13 @@ impl AnyIdentifierBindingLike { } #[derive(Debug)] -pub(crate) struct State { +pub struct State { element: Named, suggestion: Suggestion, } #[derive(Debug)] -pub(crate) enum Suggestion { +pub enum Suggestion { /// No suggestion None, /// Suggest aa new name diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious.rs index 795294b2e622..901f881d123e 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious.rs @@ -2,22 +2,22 @@ use biome_analyze::declare_group; -pub(crate) mod no_array_index_key; -pub(crate) mod no_catch_assign; -pub(crate) mod no_class_assign; -pub(crate) mod no_console_log; -pub(crate) mod no_duplicate_parameters; -pub(crate) mod no_function_assign; -pub(crate) mod no_global_is_finite; -pub(crate) mod no_global_is_nan; -pub(crate) mod no_import_assign; -pub(crate) mod no_label_var; -pub(crate) mod no_redeclare; -pub(crate) mod no_unsafe_declaration_merging; -pub(crate) mod use_is_array; +pub mod no_array_index_key; +pub mod no_catch_assign; +pub mod no_class_assign; +pub mod no_console_log; +pub mod no_duplicate_parameters; +pub mod no_function_assign; +pub mod no_global_is_finite; +pub mod no_global_is_nan; +pub mod no_import_assign; +pub mod no_label_var; +pub mod no_redeclare; +pub mod no_unsafe_declaration_merging; +pub mod use_is_array; declare_group! { - pub (crate) Suspicious { + pub Suspicious { name : "suspicious" , rules : [ self :: no_array_index_key :: NoArrayIndexKey , diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_array_index_key.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_array_index_key.rs index e9b89450fb19..1255aa67f8f7 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_array_index_key.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_array_index_key.rs @@ -63,7 +63,7 @@ declare_rule! { /// }); /// ``` /// - pub(crate) NoArrayIndexKey { + pub NoArrayIndexKey { version: "1.0.0", name: "noArrayIndexKey", source: RuleSource::EslintReact("no-array-index-key"), @@ -72,7 +72,7 @@ declare_rule! { } declare_node_union! { - pub(crate) NoArrayIndexKeyQuery = JsxAttribute | JsPropertyObjectMember + pub NoArrayIndexKeyQuery = JsxAttribute | JsPropertyObjectMember } impl NoArrayIndexKeyQuery { @@ -114,7 +114,7 @@ impl NoArrayIndexKeyQuery { } } -pub(crate) struct NoArrayIndexKeyState { +pub struct NoArrayIndexKeyState { /// The incorrect prop incorrect_prop: TextRange, /// Where the incorrect prop was defined diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_catch_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_catch_assign.rs index 45c14fabf2be..694e9b8b6e59 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_catch_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_catch_assign.rs @@ -34,7 +34,7 @@ declare_rule! { /// e = 100; /// } /// ``` - pub(crate) NoCatchAssign { + pub NoCatchAssign { version: "1.0.0", name: "noCatchAssign", source: RuleSource::Eslint("no-ex-assign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_class_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_class_assign.rs index 2c88c6cac441..bd5c6bd2d966 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_class_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_class_assign.rs @@ -65,7 +65,7 @@ declare_rule! { /// } /// ``` /// - pub(crate) NoClassAssign { + pub NoClassAssign { version: "1.0.0", name: "noClassAssign", source: RuleSource::Eslint("no-class-assign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs index 5479bff1cc7a..cdae2da5c88d 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs @@ -33,7 +33,7 @@ declare_rule! { /// console.log(); /// ``` /// - pub(crate) NoConsoleLog { + pub NoConsoleLog { version: "1.0.0", name: "noConsoleLog", source: RuleSource::Eslint("no-console"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_duplicate_parameters.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_duplicate_parameters.rs index c0bc2284c0d8..cc72ebc31bf0 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_duplicate_parameters.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_duplicate_parameters.rs @@ -37,7 +37,7 @@ declare_rule! { /// function l([, l]) {} /// function foo([[a, b], [c, d]]) {} /// ``` - pub(crate) NoDuplicateParameters { + pub NoDuplicateParameters { version: "1.0.0", name: "noDuplicateParameters", source: RuleSource::Eslint("no-dupe-args"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_function_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_function_assign.rs index 9046eaeb131a..2804a9b9e855 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_function_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_function_assign.rs @@ -93,7 +93,7 @@ declare_rule! { /// var foo = bar; /// } /// ``` - pub(crate) NoFunctionAssign { + pub NoFunctionAssign { version: "1.0.0", name: "noFunctionAssign", source: RuleSource::Eslint("no-func-assign"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_finite.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_finite.rs index d824214259b0..bacd1fab8204 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_finite.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_finite.rs @@ -29,7 +29,7 @@ declare_rule! { /// ```js /// Number.isFinite(false); // false /// ``` - pub(crate) NoGlobalIsFinite { + pub NoGlobalIsFinite { version: "1.0.0", name: "noGlobalIsFinite", recommended: true, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_nan.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_nan.rs index 81701a1b7440..79a7255e1222 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_nan.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_global_is_nan.rs @@ -30,7 +30,7 @@ declare_rule! { /// Number.isNaN({}); // false /// ``` /// - pub(crate) NoGlobalIsNan { + pub NoGlobalIsNan { version: "1.0.0", name: "noGlobalIsNan", recommended: true, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_import_assign.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_import_assign.rs index 799af6f35afa..5aaf82b28a7e 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_import_assign.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_import_assign.rs @@ -49,7 +49,7 @@ declare_rule! { /// import * as e from "y"; /// e = 1; /// ``` - pub(crate) NoImportAssign { + pub NoImportAssign { version: "1.0.0", name: "noImportAssign", source: RuleSource::Eslint("no-import-assign"), @@ -126,5 +126,5 @@ impl Rule for NoImportAssign { } declare_node_union! { - pub(crate) AnyJsImportLike = JsNamedImportSpecifier | JsShorthandNamedImportSpecifier | JsNamespaceImportSpecifier | JsDefaultImportSpecifier + pub AnyJsImportLike = JsNamedImportSpecifier | JsShorthandNamedImportSpecifier | JsNamespaceImportSpecifier | JsDefaultImportSpecifier } diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_label_var.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_label_var.rs index 51f01b36ebbb..d3705034744d 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_label_var.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_label_var.rs @@ -22,7 +22,7 @@ declare_rule! { /// const x = "test"; /// z: expr; /// ``` - pub(crate) NoLabelVar { + pub NoLabelVar { version: "1.0.0", name: "noLabelVar", source: RuleSource::Eslint("no-label-var"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_redeclare.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_redeclare.rs index e3957df6ee23..c439a84e0fc8 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_redeclare.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_redeclare.rs @@ -58,7 +58,7 @@ declare_rule! { /// bar(a: A, b: B) {} /// } /// ``` - pub(crate) NoRedeclare { + pub NoRedeclare { version: "1.0.0", name: "noRedeclare", source: RuleSource::EslintTypeScript("no-redeclare"), @@ -67,7 +67,7 @@ declare_rule! { } #[derive(Debug)] -pub(crate) struct Redeclaration { +pub struct Redeclaration { name: String, declaration: TextRange, redeclaration: TextRange, diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_unsafe_declaration_merging.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_unsafe_declaration_merging.rs index a57deed43a2d..de3383a7b6bd 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_unsafe_declaration_merging.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/no_unsafe_declaration_merging.rs @@ -40,7 +40,7 @@ declare_rule! { /// namespace Baz {} /// enum Baz {} /// ``` - pub(crate) NoUnsafeDeclarationMerging { + pub NoUnsafeDeclarationMerging { version: "1.0.0", name: "noUnsafeDeclarationMerging", source: RuleSource::EslintTypeScript("no-unsafe-declaration-merging"), diff --git a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/use_is_array.rs b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/use_is_array.rs index 1c16518d5e12..f24d2256a37e 100644 --- a/crates/biome_js_analyze/src/semantic_analyzers/suspicious/use_is_array.rs +++ b/crates/biome_js_analyze/src/semantic_analyzers/suspicious/use_is_array.rs @@ -36,7 +36,7 @@ declare_rule! { /// if (Array.isArray(xs)) {} /// ``` /// - pub(crate) UseIsArray { + pub UseIsArray { version: "1.0.0", name: "useIsArray", source: RuleSource::EslintUnicorn("no-instanceof-array"), diff --git a/crates/biome_js_analyze/src/semantic_services.rs b/crates/biome_js_analyze/src/semantic_services.rs index d958ed646f47..5765f86b2904 100644 --- a/crates/biome_js_analyze/src/semantic_services.rs +++ b/crates/biome_js_analyze/src/semantic_services.rs @@ -86,7 +86,7 @@ where } } -pub(crate) struct SemanticModelBuilderVisitor { +pub struct SemanticModelBuilderVisitor { extractor: SemanticEventExtractor, builder: SemanticModelBuilder, } diff --git a/crates/biome_js_analyze/src/syntax.rs b/crates/biome_js_analyze/src/syntax.rs index 0abb85816146..2cc34ffe2df1 100644 --- a/crates/biome_js_analyze/src/syntax.rs +++ b/crates/biome_js_analyze/src/syntax.rs @@ -1,5 +1,5 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod correctness; -pub(crate) mod nursery; -::biome_analyze::declare_category! { pub (crate) Syntax { kind : Syntax , groups : [self :: correctness :: Correctness , self :: nursery :: Nursery ,] } } +pub mod correctness; +pub mod nursery; +::biome_analyze::declare_category! { pub Syntax { kind : Syntax , groups : [self :: correctness :: Correctness , self :: nursery :: Nursery ,] } } diff --git a/crates/biome_js_analyze/src/syntax/correctness.rs b/crates/biome_js_analyze/src/syntax/correctness.rs index e6d7de5915f4..18f9631b4d66 100644 --- a/crates/biome_js_analyze/src/syntax/correctness.rs +++ b/crates/biome_js_analyze/src/syntax/correctness.rs @@ -2,12 +2,12 @@ use biome_analyze::declare_group; -pub(crate) mod no_duplicate_private_class_members; -pub(crate) mod no_initializer_with_definite; -pub(crate) mod no_super_without_extends; +pub mod no_duplicate_private_class_members; +pub mod no_initializer_with_definite; +pub mod no_super_without_extends; declare_group! { - pub (crate) Correctness { + pub Correctness { name : "correctness" , rules : [ self :: no_duplicate_private_class_members :: NoDuplicatePrivateClassMembers , diff --git a/crates/biome_js_analyze/src/syntax/correctness/no_duplicate_private_class_members.rs b/crates/biome_js_analyze/src/syntax/correctness/no_duplicate_private_class_members.rs index 8ef6895082a2..8f5a8b3510bf 100644 --- a/crates/biome_js_analyze/src/syntax/correctness/no_duplicate_private_class_members.rs +++ b/crates/biome_js_analyze/src/syntax/correctness/no_duplicate_private_class_members.rs @@ -16,7 +16,7 @@ declare_rule! { /// #foo; // } /// ``` - pub(crate) NoDuplicatePrivateClassMembers { + pub NoDuplicatePrivateClassMembers { version: "1.0.0", name: "noDuplicatePrivateClassMembers", } diff --git a/crates/biome_js_analyze/src/syntax/correctness/no_initializer_with_definite.rs b/crates/biome_js_analyze/src/syntax/correctness/no_initializer_with_definite.rs index e5426ede61c6..be96a135dcb1 100644 --- a/crates/biome_js_analyze/src/syntax/correctness/no_initializer_with_definite.rs +++ b/crates/biome_js_analyze/src/syntax/correctness/no_initializer_with_definite.rs @@ -12,7 +12,7 @@ declare_rule! { /// ```js /// let foo!: string = "bar"; /// ``` - pub(crate) NoInitializerWithDefinite { + pub NoInitializerWithDefinite { version: "1.4.0", name: "noInitializerWithDefinite", } diff --git a/crates/biome_js_analyze/src/syntax/correctness/no_super_without_extends.rs b/crates/biome_js_analyze/src/syntax/correctness/no_super_without_extends.rs index d2883843bbc3..76bd943572de 100644 --- a/crates/biome_js_analyze/src/syntax/correctness/no_super_without_extends.rs +++ b/crates/biome_js_analyze/src/syntax/correctness/no_super_without_extends.rs @@ -17,7 +17,7 @@ declare_rule! { // } // } /// ``` - pub(crate) NoSuperWithoutExtends { + pub NoSuperWithoutExtends { version: "1.0.0", name: "noSuperWithoutExtends", } diff --git a/crates/biome_js_analyze/src/syntax/nursery.rs b/crates/biome_js_analyze/src/syntax/nursery.rs index 72abd41059f4..00faddee221f 100644 --- a/crates/biome_js_analyze/src/syntax/nursery.rs +++ b/crates/biome_js_analyze/src/syntax/nursery.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod no_type_only_import_attributes; +pub mod no_type_only_import_attributes; declare_group! { - pub (crate) Nursery { + pub Nursery { name : "nursery" , rules : [ self :: no_type_only_import_attributes :: NoTypeOnlyImportAttributes , diff --git a/crates/biome_js_analyze/src/syntax/nursery/no_type_only_import_attributes.rs b/crates/biome_js_analyze/src/syntax/nursery/no_type_only_import_attributes.rs index d4764d6d6b77..f700f3677aad 100644 --- a/crates/biome_js_analyze/src/syntax/nursery/no_type_only_import_attributes.rs +++ b/crates/biome_js_analyze/src/syntax/nursery/no_type_only_import_attributes.rs @@ -13,7 +13,7 @@ declare_rule! { /// ```js /// import type { A } from "./a.json" with { type: "json" }; /// ``` - pub(crate) NoTypeOnlyImportAttributes { + pub NoTypeOnlyImportAttributes { version: "1.5.0", name: "noTypeOnlyImportAttributes", } @@ -114,7 +114,7 @@ impl Rule for NoTypeOnlyImportAttributes { } #[derive(Debug)] -pub(crate) struct RuleState { +pub struct RuleState { /// Range of the first found type token type_token_range: TextRange, /// Range of import attributes diff --git a/crates/biome_js_analyze/src/utils.rs b/crates/biome_js_analyze/src/utils.rs index 42ebde61b764..a1334d60d340 100644 --- a/crates/biome_js_analyze/src/utils.rs +++ b/crates/biome_js_analyze/src/utils.rs @@ -9,7 +9,7 @@ pub mod rename; pub mod tests; #[derive(Debug, PartialEq)] -pub(crate) enum EscapeError { +pub enum EscapeError { EscapeAtEndOfString, InvalidEscapedChar(char), } @@ -72,7 +72,7 @@ pub(crate) fn is_node_equal(a_node: &JsSyntaxNode, b_node: &JsSyntaxNode) -> boo } #[derive(Debug, PartialEq)] -pub(crate) enum VariablePosition { +pub enum VariablePosition { Right, Left, } diff --git a/crates/biome_json_analyze/src/analyzers.rs b/crates/biome_json_analyze/src/analyzers.rs index 2112770ad47c..bbb3a8c7f133 100644 --- a/crates/biome_json_analyze/src/analyzers.rs +++ b/crates/biome_json_analyze/src/analyzers.rs @@ -1,4 +1,4 @@ //! Generated file, do not edit by hand, see `xtask/codegen` -pub(crate) mod nursery; -::biome_analyze::declare_category! { pub (crate) Analyzers { kind : Lint , groups : [self :: nursery :: Nursery ,] } } +pub mod nursery; +::biome_analyze::declare_category! { pub Analyzers { kind : Lint , groups : [self :: nursery :: Nursery ,] } } diff --git a/crates/biome_json_analyze/src/analyzers/nursery.rs b/crates/biome_json_analyze/src/analyzers/nursery.rs index 97fb0a5501c7..1de83c6e36d6 100644 --- a/crates/biome_json_analyze/src/analyzers/nursery.rs +++ b/crates/biome_json_analyze/src/analyzers/nursery.rs @@ -2,10 +2,10 @@ use biome_analyze::declare_group; -pub(crate) mod no_duplicate_json_keys; +pub mod no_duplicate_json_keys; declare_group! { - pub (crate) Nursery { + pub Nursery { name : "nursery" , rules : [ self :: no_duplicate_json_keys :: NoDuplicateJsonKeys , diff --git a/crates/biome_json_analyze/src/analyzers/nursery/no_duplicate_json_keys.rs b/crates/biome_json_analyze/src/analyzers/nursery/no_duplicate_json_keys.rs index 843b6e865782..d4159735b39b 100644 --- a/crates/biome_json_analyze/src/analyzers/nursery/no_duplicate_json_keys.rs +++ b/crates/biome_json_analyze/src/analyzers/nursery/no_duplicate_json_keys.rs @@ -26,14 +26,14 @@ declare_rule! { /// "secondTitle": "Second title" /// } /// ``` - pub(crate) NoDuplicateJsonKeys { + pub NoDuplicateJsonKeys { version: "1.0.0", name: "noDuplicateJsonKeys", recommended: true, } } -pub(crate) struct DuplicatedKeys { +pub struct DuplicatedKeys { /// The fist key, which should be the correct one original_key: JsonMemberName, /// The ranges where the duplicated keys are found diff --git a/crates/biome_json_analyze/src/lib.rs b/crates/biome_json_analyze/src/lib.rs index 64a808b63e25..07df5b734b92 100644 --- a/crates/biome_json_analyze/src/lib.rs +++ b/crates/biome_json_analyze/src/lib.rs @@ -1,4 +1,5 @@ mod analyzers; +pub mod options; mod registry; pub use crate::registry::visit_registry; diff --git a/crates/biome_json_analyze/src/options.rs b/crates/biome_json_analyze/src/options.rs new file mode 100644 index 000000000000..281eaf3e2748 --- /dev/null +++ b/crates/biome_json_analyze/src/options.rs @@ -0,0 +1,5 @@ +//! Generated file, do not edit by hand, see `xtask/codegen` + +use crate::analyzers; + +pub type NoDuplicateJsonKeys = < analyzers :: nursery :: no_duplicate_json_keys :: NoDuplicateJsonKeys as biome_analyze :: Rule > :: Options ; diff --git a/crates/biome_service/src/configuration/generated.rs b/crates/biome_service/src/configuration/generated.rs index 319699850680..23ed79a90d02 100644 --- a/crates/biome_service/src/configuration/generated.rs +++ b/crates/biome_service/src/configuration/generated.rs @@ -1,7 +1,7 @@ //! Generated file, do not edit by hand, see `xtask/codegen` use crate::configuration::linter::*; -use crate::{RuleConfiguration, Rules}; +use crate::Rules; use biome_analyze::{AnalyzerRules, MetadataRegistry}; pub(crate) fn push_to_analyzer_rules( rules: &Rules, @@ -10,112 +10,72 @@ pub(crate) fn push_to_analyzer_rules( ) { if let Some(rules) = rules.a11y.as_ref() { for rule_name in &A11y::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("a11y", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("a11y", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.complexity.as_ref() { for rule_name in &Complexity::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("complexity", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("complexity", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.correctness.as_ref() { for rule_name in &Correctness::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("correctness", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("correctness", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.nursery.as_ref() { for rule_name in &Nursery::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("nursery", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("nursery", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.performance.as_ref() { for rule_name in &Performance::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("performance", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("performance", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.security.as_ref() { for rule_name in &Security::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("security", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("security", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.style.as_ref() { for rule_name in &Style::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("style", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("style", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } } if let Some(rules) = rules.suspicious.as_ref() { for rule_name in &Suspicious::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule("suspicious", rule_name) { - let rule_options = possible_options.extract_option(&rule_key); - analyzer_rules.push_rule(rule_key, rule_options); - } + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule("suspicious", rule_name) { + analyzer_rules.push_rule(rule_key, rule_options); } } } diff --git a/crates/biome_service/src/configuration/linter/mod.rs b/crates/biome_service/src/configuration/linter/mod.rs index 990cdf492543..bea7d2e1716a 100644 --- a/crates/biome_service/src/configuration/linter/mod.rs +++ b/crates/biome_service/src/configuration/linter/mod.rs @@ -5,12 +5,11 @@ pub use crate::configuration::linter::rules::Rules; use crate::configuration::overrides::OverrideLinterConfiguration; use crate::settings::{to_matcher, LinterSettings}; use crate::{Matcher, WorkspaceError}; -use biome_deserialize::{ - DeserializableValue, DeserializationDiagnostic, Merge, StringSet, VisitableType, -}; +use biome_analyze::options::RuleOptions; +use biome_deserialize::{Deserializable, StringSet}; +use biome_deserialize::{DeserializableValue, DeserializationDiagnostic, Merge, VisitableType}; use biome_deserialize_macros::{Deserializable, Merge, Partial}; use biome_diagnostics::Severity; -use biome_js_analyze::options::PossibleOptions; use bpaf::Bpaf; pub use rules::*; #[cfg(feature = "schema")] @@ -98,28 +97,27 @@ impl TryFrom for LinterSettings { #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields, untagged)] -pub enum RuleConfiguration { +pub enum RuleConfiguration { Plain(RulePlainConfiguration), - WithOptions(Box), + WithOptions(RuleWithOptions), } -impl biome_deserialize::Deserializable for RuleConfiguration { +impl Deserializable for RuleConfiguration { fn deserialize( value: &impl DeserializableValue, rule_name: &str, diagnostics: &mut Vec, ) -> Option { if value.is_type(VisitableType::STR) { - biome_deserialize::Deserializable::deserialize(value, rule_name, diagnostics) - .map(Self::Plain) + Deserializable::deserialize(value, rule_name, diagnostics).map(Self::Plain) } else { - biome_deserialize::Deserializable::deserialize(value, rule_name, diagnostics) - .map(|rule| Self::WithOptions(Box::new(rule))) + Deserializable::deserialize(value, rule_name, diagnostics) + .map(|rule| Self::WithOptions(rule)) } } } -impl FromStr for RuleConfiguration { +impl FromStr for RuleConfiguration { type Err = String; fn from_str(s: &str) -> Result { @@ -128,7 +126,7 @@ impl FromStr for RuleConfiguration { } } -impl RuleConfiguration { +impl RuleConfiguration { pub fn is_err(&self) -> bool { if let Self::WithOptions(rule) = self { rule.level == RulePlainConfiguration::Error @@ -148,25 +146,24 @@ impl RuleConfiguration { pub fn is_enabled(&self) -> bool { !self.is_disabled() } -} -impl Default for RuleConfiguration { - fn default() -> Self { - Self::Plain(RulePlainConfiguration::Error) + pub fn level(&self) -> RulePlainConfiguration { + match self { + RuleConfiguration::Plain(plain) => *plain, + RuleConfiguration::WithOptions(options) => options.level, + } } } // Rule configuration has a custom [Merge] implementation so that overriding the // severity doesn't override the options. -impl Merge for RuleConfiguration { +impl Merge for RuleConfiguration { fn merge_with(&mut self, other: Self) { *self = match (&self, other) { - (Self::WithOptions(this), Self::Plain(other)) => { - Self::WithOptions(Box::new(RuleWithOptions { - level: other, - options: this.options.clone(), - })) - } + (Self::WithOptions(this), Self::Plain(other)) => Self::WithOptions(RuleWithOptions { + level: other, + options: this.options.clone(), + }), // FIXME: Rule options don't have a `NoneState`, so we can't deep // merge them yet. For now, if an override specifies options, // it will still override *all* options. @@ -175,20 +172,37 @@ impl Merge for RuleConfiguration { } } -impl From<&RuleConfiguration> for Severity { - fn from(conf: &RuleConfiguration) -> Self { +impl RuleConfiguration { + pub fn get_options(&self) -> Option { + match self { + RuleConfiguration::Plain(_) => None, + RuleConfiguration::WithOptions(options) => { + Some(RuleOptions::new(options.options.clone())) + } + } + } +} + +impl Default for RuleConfiguration { + fn default() -> Self { + Self::Plain(RulePlainConfiguration::Error) + } +} + +impl From<&RuleConfiguration> for Severity { + fn from(conf: &RuleConfiguration) -> Self { match conf { - RuleConfiguration::Plain(p) => p.into(), + RuleConfiguration::Plain(p) => (*p).into(), RuleConfiguration::WithOptions(conf) => { let level = &conf.level; - level.into() + (*level).into() } } } } -impl From<&RulePlainConfiguration> for Severity { - fn from(conf: &RulePlainConfiguration) -> Self { +impl From for Severity { + fn from(conf: RulePlainConfiguration) -> Self { match conf { RulePlainConfiguration::Warn => Severity::Warning, RulePlainConfiguration::Error => Severity::Error, @@ -197,7 +211,7 @@ impl From<&RulePlainConfiguration> for Severity { } } -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase")] pub enum RulePlainConfiguration { @@ -223,20 +237,7 @@ impl FromStr for RulePlainConfiguration { #[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct RuleWithOptions { +pub struct RuleWithOptions { pub level: RulePlainConfiguration, - - #[deserializable(passthrough_name)] - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, -} - -impl FromStr for RuleWithOptions { - type Err = String; - fn from_str(_s: &str) -> Result { - Ok(Self { - level: RulePlainConfiguration::default(), - options: None, - }) - } + pub options: T, } diff --git a/crates/biome_service/src/configuration/linter/rules.rs b/crates/biome_service/src/configuration/linter/rules.rs index 74ff2603fe41..7ea078020ad4 100644 --- a/crates/biome_service/src/configuration/linter/rules.rs +++ b/crates/biome_service/src/configuration/linter/rules.rs @@ -1,11 +1,14 @@ //! Generated file, do not edit by hand, see `xtask/codegen` +use super::RulePlainConfiguration; use crate::RuleConfiguration; -use biome_analyze::RuleFilter; +use biome_analyze::{options::RuleOptions, RuleFilter}; use biome_console::markup; use biome_deserialize::{DeserializableValidator, DeserializationDiagnostic}; use biome_deserialize_macros::{Deserializable, Merge}; use biome_diagnostics::{Category, Severity}; +use biome_js_analyze::options::*; +use biome_json_analyze::options::*; use biome_rowan::TextRange; use indexmap::IndexSet; #[cfg(feature = "schema")] @@ -100,7 +103,7 @@ impl Rules { .a11y .as_ref() .and_then(|a11y| a11y.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if A11y::is_recommended_rule(rule_name) { Severity::Error @@ -112,7 +115,7 @@ impl Rules { .complexity .as_ref() .and_then(|complexity| complexity.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Complexity::is_recommended_rule(rule_name) { Severity::Error @@ -124,7 +127,7 @@ impl Rules { .correctness .as_ref() .and_then(|correctness| correctness.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Correctness::is_recommended_rule(rule_name) { Severity::Error @@ -136,7 +139,7 @@ impl Rules { .nursery .as_ref() .and_then(|nursery| nursery.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Nursery::is_recommended_rule(rule_name) { Severity::Error @@ -148,7 +151,7 @@ impl Rules { .performance .as_ref() .and_then(|performance| performance.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Performance::is_recommended_rule(rule_name) { Severity::Error @@ -160,7 +163,7 @@ impl Rules { .security .as_ref() .and_then(|security| security.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Security::is_recommended_rule(rule_name) { Severity::Error @@ -172,7 +175,7 @@ impl Rules { .style .as_ref() .and_then(|style| style.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Style::is_recommended_rule(rule_name) { Severity::Error @@ -184,7 +187,7 @@ impl Rules { .suspicious .as_ref() .and_then(|suspicious| suspicious.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if Suspicious::is_recommended_rule(rule_name) { Severity::Error @@ -351,94 +354,97 @@ pub struct A11y { pub all: Option, #[doc = "Enforce that the accessKey attribute is not used on any HTML element."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_access_key: Option, + pub no_access_key: Option>, #[doc = "Enforce that aria-hidden=\"true\" is not set on focusable elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_aria_hidden_on_focusable: Option, + pub no_aria_hidden_on_focusable: Option>, #[doc = "Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_aria_unsupported_elements: Option, + pub no_aria_unsupported_elements: Option>, #[doc = "Enforce that autoFocus prop is not used on elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_autofocus: Option, + pub no_autofocus: Option>, #[doc = "Disallow target=\"_blank\" attribute without rel=\"noreferrer\""] #[serde(skip_serializing_if = "Option::is_none")] - pub no_blank_target: Option, + pub no_blank_target: Option>, #[doc = "Enforces that no distracting elements are used."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_distracting_elements: Option, + pub no_distracting_elements: Option>, #[doc = "The scope prop should be used only on elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_header_scope: Option, + pub no_header_scope: Option>, #[doc = "Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_interactive_element_to_noninteractive_role: Option, + pub no_interactive_element_to_noninteractive_role: + Option>, #[doc = "Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_noninteractive_element_to_interactive_role: Option, + pub no_noninteractive_element_to_interactive_role: + Option>, #[doc = "Enforce that tabIndex is not assigned to non-interactive HTML elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_noninteractive_tabindex: Option, + pub no_noninteractive_tabindex: Option>, #[doc = "Prevent the usage of positive integers on tabIndex property"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_positive_tabindex: Option, + pub no_positive_tabindex: Option>, #[doc = "Enforce img alt prop does not contain the word \"image\", \"picture\", or \"photo\"."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_redundant_alt: Option, + pub no_redundant_alt: Option>, #[doc = "Enforce explicit role property is not the same as implicit/default role property on an element."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_redundant_roles: Option, + pub no_redundant_roles: Option>, #[doc = "Enforces the usage of the title element for the svg element."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_svg_without_title: Option, + pub no_svg_without_title: Option>, #[doc = "Enforce that all elements that require alternative text have meaningful information to relay back to the end user."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_alt_text: Option, + pub use_alt_text: Option>, #[doc = "Enforce that anchors have content and that the content is accessible to screen readers."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_anchor_content: Option, + pub use_anchor_content: Option>, #[doc = "Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_aria_activedescendant_with_tabindex: Option, + pub use_aria_activedescendant_with_tabindex: + Option>, #[doc = "Enforce that elements with ARIA roles must have all required ARIA attributes for that role."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_aria_props_for_role: Option, + pub use_aria_props_for_role: Option>, #[doc = "Enforces the usage of the attribute type for the element button"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_button_type: Option, + pub use_button_type: Option>, #[doc = "Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_heading_content: Option, + pub use_heading_content: Option>, #[doc = "Enforce that html element has lang attribute."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_html_lang: Option, + pub use_html_lang: Option>, #[doc = "Enforces the usage of the attribute title for the element iframe."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_iframe_title: Option, + pub use_iframe_title: Option>, #[doc = "Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_key_with_click_events: Option, + pub use_key_with_click_events: Option>, #[doc = "Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_key_with_mouse_events: Option, + pub use_key_with_mouse_events: Option>, #[doc = "Enforces that audio and video elements must have a track for captions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_media_caption: Option, + pub use_media_caption: Option>, #[doc = "Enforce that all anchors are valid, and they are navigable elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_anchor: Option, + pub use_valid_anchor: Option>, #[doc = "Ensures that ARIA properties aria-* are all valid."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_aria_props: Option, + pub use_valid_aria_props: Option>, #[doc = "Elements with ARIA roles must use a valid, non-abstract ARIA role."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_aria_role: Option, + pub use_valid_aria_role: Option>, #[doc = "Enforce that ARIA state and property values are valid."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_aria_values: Option, + pub use_valid_aria_values: Option>, #[doc = "Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_lang: Option, + pub use_valid_lang: Option>, } impl DeserializableValidator for A11y { fn validate( @@ -937,44 +943,131 @@ impl A11y { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noAccessKey" => self.no_access_key.as_ref(), - "noAriaHiddenOnFocusable" => self.no_aria_hidden_on_focusable.as_ref(), - "noAriaUnsupportedElements" => self.no_aria_unsupported_elements.as_ref(), - "noAutofocus" => self.no_autofocus.as_ref(), - "noBlankTarget" => self.no_blank_target.as_ref(), - "noDistractingElements" => self.no_distracting_elements.as_ref(), - "noHeaderScope" => self.no_header_scope.as_ref(), - "noInteractiveElementToNoninteractiveRole" => { - self.no_interactive_element_to_noninteractive_role.as_ref() - } - "noNoninteractiveElementToInteractiveRole" => { - self.no_noninteractive_element_to_interactive_role.as_ref() - } - "noNoninteractiveTabindex" => self.no_noninteractive_tabindex.as_ref(), - "noPositiveTabindex" => self.no_positive_tabindex.as_ref(), - "noRedundantAlt" => self.no_redundant_alt.as_ref(), - "noRedundantRoles" => self.no_redundant_roles.as_ref(), - "noSvgWithoutTitle" => self.no_svg_without_title.as_ref(), - "useAltText" => self.use_alt_text.as_ref(), - "useAnchorContent" => self.use_anchor_content.as_ref(), - "useAriaActivedescendantWithTabindex" => { - self.use_aria_activedescendant_with_tabindex.as_ref() - } - "useAriaPropsForRole" => self.use_aria_props_for_role.as_ref(), - "useButtonType" => self.use_button_type.as_ref(), - "useHeadingContent" => self.use_heading_content.as_ref(), - "useHtmlLang" => self.use_html_lang.as_ref(), - "useIframeTitle" => self.use_iframe_title.as_ref(), - "useKeyWithClickEvents" => self.use_key_with_click_events.as_ref(), - "useKeyWithMouseEvents" => self.use_key_with_mouse_events.as_ref(), - "useMediaCaption" => self.use_media_caption.as_ref(), - "useValidAnchor" => self.use_valid_anchor.as_ref(), - "useValidAriaProps" => self.use_valid_aria_props.as_ref(), - "useValidAriaRole" => self.use_valid_aria_role.as_ref(), - "useValidAriaValues" => self.use_valid_aria_values.as_ref(), - "useValidLang" => self.use_valid_lang.as_ref(), + "noAccessKey" => self + .no_access_key + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noAriaHiddenOnFocusable" => self + .no_aria_hidden_on_focusable + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noAriaUnsupportedElements" => self + .no_aria_unsupported_elements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noAutofocus" => self + .no_autofocus + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noBlankTarget" => self + .no_blank_target + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDistractingElements" => self + .no_distracting_elements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noHeaderScope" => self + .no_header_scope + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInteractiveElementToNoninteractiveRole" => self + .no_interactive_element_to_noninteractive_role + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNoninteractiveElementToInteractiveRole" => self + .no_noninteractive_element_to_interactive_role + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNoninteractiveTabindex" => self + .no_noninteractive_tabindex + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noPositiveTabindex" => self + .no_positive_tabindex + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRedundantAlt" => self + .no_redundant_alt + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRedundantRoles" => self + .no_redundant_roles + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSvgWithoutTitle" => self + .no_svg_without_title + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAltText" => self + .use_alt_text + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAnchorContent" => self + .use_anchor_content + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAriaActivedescendantWithTabindex" => self + .use_aria_activedescendant_with_tabindex + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAriaPropsForRole" => self + .use_aria_props_for_role + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useButtonType" => self + .use_button_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useHeadingContent" => self + .use_heading_content + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useHtmlLang" => self + .use_html_lang + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useIframeTitle" => self + .use_iframe_title + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useKeyWithClickEvents" => self + .use_key_with_click_events + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useKeyWithMouseEvents" => self + .use_key_with_mouse_events + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useMediaCaption" => self + .use_media_caption + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidAnchor" => self + .use_valid_anchor + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidAriaProps" => self + .use_valid_aria_props + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidAriaRole" => self + .use_valid_aria_role + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidAriaValues" => self + .use_valid_aria_values + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidLang" => self + .use_valid_lang + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -993,79 +1086,81 @@ pub struct Complexity { pub all: Option, #[doc = "Disallow primitive type aliases and misleading types."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_banned_types: Option, + pub no_banned_types: Option>, #[doc = "Disallow functions that exceed a given Cognitive Complexity score."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_excessive_cognitive_complexity: Option, + pub no_excessive_cognitive_complexity: + Option>, #[doc = "Disallow unnecessary boolean casts"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_extra_boolean_cast: Option, + pub no_extra_boolean_cast: Option>, #[doc = "Prefer for...of statement instead of Array.forEach."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_for_each: Option, + pub no_for_each: Option>, #[doc = "Disallow unclear usage of consecutive space characters in regular expression literals"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_multiple_spaces_in_regular_expression_literals: Option, + pub no_multiple_spaces_in_regular_expression_literals: + Option>, #[doc = "This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_static_only_class: Option, + pub no_static_only_class: Option>, #[doc = "Disallow this and super in static contexts."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_this_in_static: Option, + pub no_this_in_static: Option>, #[doc = "Disallow unnecessary catch clauses."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_catch: Option, + pub no_useless_catch: Option>, #[doc = "Disallow unnecessary constructors."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_constructor: Option, + pub no_useless_constructor: Option>, #[doc = "Disallow empty exports that don't change anything in a module file."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_empty_export: Option, + pub no_useless_empty_export: Option>, #[doc = "Disallow unnecessary fragments"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_fragments: Option, + pub no_useless_fragments: Option>, #[doc = "Disallow unnecessary labels."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_label: Option, + pub no_useless_label: Option>, #[doc = "Disallow renaming import, export, and destructured assignments to the same name."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_rename: Option, + pub no_useless_rename: Option>, #[doc = "Disallow useless case in switch statements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_switch_case: Option, + pub no_useless_switch_case: Option>, #[doc = "Disallow useless this aliasing."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_this_alias: Option, + pub no_useless_this_alias: Option>, #[doc = "Disallow using any or unknown as type constraint."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_type_constraint: Option, + pub no_useless_type_constraint: Option>, #[doc = "Disallow the use of void operators, which is not a familiar operator."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_void: Option, + pub no_void: Option>, #[doc = "Disallow with statements in non-strict contexts."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_with: Option, + pub no_with: Option>, #[doc = "Use arrow functions over function expressions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_arrow_function: Option, + pub use_arrow_function: Option>, #[doc = "Promotes the use of .flatMap() when map().flat() are used together."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_flat_map: Option, + pub use_flat_map: Option>, #[doc = "Enforce the usage of a literal access to properties over computed property access."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_literal_keys: Option, + pub use_literal_keys: Option>, #[doc = "Enforce using concise optional chain instead of chained logical expressions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_optional_chain: Option, + pub use_optional_chain: Option>, #[doc = "Enforce the use of the regular expression literals instead of the RegExp constructor if possible."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_regex_literals: Option, + pub use_regex_literals: Option>, #[doc = "Disallow number literal object member names which are not base10 or uses underscore as separator"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_simple_number_keys: Option, + pub use_simple_number_keys: Option>, #[doc = "Discard redundant terms from logical expressions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_simplified_logic_expression: Option, + pub use_simplified_logic_expression: Option>, } impl DeserializableValidator for Complexity { fn validate( @@ -1494,35 +1589,111 @@ impl Complexity { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noBannedTypes" => self.no_banned_types.as_ref(), - "noExcessiveCognitiveComplexity" => self.no_excessive_cognitive_complexity.as_ref(), - "noExtraBooleanCast" => self.no_extra_boolean_cast.as_ref(), - "noForEach" => self.no_for_each.as_ref(), + "noBannedTypes" => self + .no_banned_types + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noExcessiveCognitiveComplexity" => self + .no_excessive_cognitive_complexity + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noExtraBooleanCast" => self + .no_extra_boolean_cast + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noForEach" => self + .no_for_each + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), "noMultipleSpacesInRegularExpressionLiterals" => self .no_multiple_spaces_in_regular_expression_literals - .as_ref(), - "noStaticOnlyClass" => self.no_static_only_class.as_ref(), - "noThisInStatic" => self.no_this_in_static.as_ref(), - "noUselessCatch" => self.no_useless_catch.as_ref(), - "noUselessConstructor" => self.no_useless_constructor.as_ref(), - "noUselessEmptyExport" => self.no_useless_empty_export.as_ref(), - "noUselessFragments" => self.no_useless_fragments.as_ref(), - "noUselessLabel" => self.no_useless_label.as_ref(), - "noUselessRename" => self.no_useless_rename.as_ref(), - "noUselessSwitchCase" => self.no_useless_switch_case.as_ref(), - "noUselessThisAlias" => self.no_useless_this_alias.as_ref(), - "noUselessTypeConstraint" => self.no_useless_type_constraint.as_ref(), - "noVoid" => self.no_void.as_ref(), - "noWith" => self.no_with.as_ref(), - "useArrowFunction" => self.use_arrow_function.as_ref(), - "useFlatMap" => self.use_flat_map.as_ref(), - "useLiteralKeys" => self.use_literal_keys.as_ref(), - "useOptionalChain" => self.use_optional_chain.as_ref(), - "useRegexLiterals" => self.use_regex_literals.as_ref(), - "useSimpleNumberKeys" => self.use_simple_number_keys.as_ref(), - "useSimplifiedLogicExpression" => self.use_simplified_logic_expression.as_ref(), + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noStaticOnlyClass" => self + .no_static_only_class + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noThisInStatic" => self + .no_this_in_static + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessCatch" => self + .no_useless_catch + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessConstructor" => self + .no_useless_constructor + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessEmptyExport" => self + .no_useless_empty_export + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessFragments" => self + .no_useless_fragments + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessLabel" => self + .no_useless_label + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessRename" => self + .no_useless_rename + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessSwitchCase" => self + .no_useless_switch_case + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessThisAlias" => self + .no_useless_this_alias + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessTypeConstraint" => self + .no_useless_type_constraint + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noVoid" => self + .no_void + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noWith" => self + .no_with + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useArrowFunction" => self + .use_arrow_function + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useFlatMap" => self + .use_flat_map + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useLiteralKeys" => self + .use_literal_keys + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useOptionalChain" => self + .use_optional_chain + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useRegexLiterals" => self + .use_regex_literals + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSimpleNumberKeys" => self + .use_simple_number_keys + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSimplifiedLogicExpression" => self + .use_simplified_logic_expression + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -1541,103 +1712,103 @@ pub struct Correctness { pub all: Option, #[doc = "Prevent passing of children as props."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_children_prop: Option, + pub no_children_prop: Option>, #[doc = "Prevents from having const variables being re-assigned."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_const_assign: Option, + pub no_const_assign: Option>, #[doc = "Disallow constant expressions in conditions"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_constant_condition: Option, + pub no_constant_condition: Option>, #[doc = "Disallow returning a value from a constructor."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_constructor_return: Option, + pub no_constructor_return: Option>, #[doc = "Disallow empty character classes in regular expression literals."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_character_class_in_regex: Option, + pub no_empty_character_class_in_regex: Option>, #[doc = "Disallows empty destructuring patterns."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_pattern: Option, + pub no_empty_pattern: Option>, #[doc = "Disallow calling global object properties as functions"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_object_calls: Option, + pub no_global_object_calls: Option>, #[doc = "Disallow function and var declarations that are accessible outside their block."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_inner_declarations: Option, + pub no_inner_declarations: Option>, #[doc = "Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_constructor_super: Option, + pub no_invalid_constructor_super: Option>, #[doc = "Disallow new operators with global non-constructor functions."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_new_builtin: Option, + pub no_invalid_new_builtin: Option>, #[doc = "Disallow new operators with the Symbol object."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_new_symbol: Option, + pub no_new_symbol: Option>, #[doc = "Disallow \\8 and \\9 escape sequences in string literals."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_nonoctal_decimal_escape: Option, + pub no_nonoctal_decimal_escape: Option>, #[doc = "Disallow literal numbers that lose precision"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_precision_loss: Option, + pub no_precision_loss: Option>, #[doc = "Prevent the usage of the return value of React.render."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_render_return_value: Option, + pub no_render_return_value: Option>, #[doc = "Disallow assignments where both sides are exactly the same."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_self_assign: Option, + pub no_self_assign: Option>, #[doc = "Disallow returning a value from a setter"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_setter_return: Option, + pub no_setter_return: Option>, #[doc = "Disallow comparison of expressions modifying the string case with non-compliant value."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_string_case_mismatch: Option, + pub no_string_case_mismatch: Option>, #[doc = "Disallow lexical declarations in switch clauses."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_switch_declarations: Option, + pub no_switch_declarations: Option>, #[doc = "Prevents the usage of variables that haven't been declared inside the document."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_undeclared_variables: Option, + pub no_undeclared_variables: Option>, #[doc = "Avoid using unnecessary continue."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unnecessary_continue: Option, + pub no_unnecessary_continue: Option>, #[doc = "Disallow unreachable code"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unreachable: Option, + pub no_unreachable: Option>, #[doc = "Ensures the super() constructor is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unreachable_super: Option, + pub no_unreachable_super: Option>, #[doc = "Disallow control flow statements in finally blocks."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_finally: Option, + pub no_unsafe_finally: Option>, #[doc = "Disallow the use of optional chaining in contexts where the undefined value is not allowed."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_optional_chaining: Option, + pub no_unsafe_optional_chaining: Option>, #[doc = "Disallow unused labels."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_labels: Option, + pub no_unused_labels: Option>, #[doc = "Disallow unused variables."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_variables: Option, + pub no_unused_variables: Option>, #[doc = "This rules prevents void elements (AKA self-closing elements) from having children."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_void_elements_with_children: Option, + pub no_void_elements_with_children: Option>, #[doc = "Disallow returning a value from a function with the return type 'void'"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_void_type_return: Option, + pub no_void_type_return: Option>, #[doc = "Enforce all dependencies are correctly specified in a React hook."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_exhaustive_dependencies: Option, + pub use_exhaustive_dependencies: Option>, #[doc = "Enforce that all React hooks are being called from the Top Level component functions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_hook_at_top_level: Option, + pub use_hook_at_top_level: Option>, #[doc = "Require calls to isNaN() when checking for NaN."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_is_nan: Option, + pub use_is_nan: Option>, #[doc = "Enforce \"for\" loop update clause moving the counter in the right direction."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_for_direction: Option, + pub use_valid_for_direction: Option>, #[doc = "Require generator functions to contain yield."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_yield: Option, + pub use_yield: Option>, } impl DeserializableValidator for Correctness { fn validate( @@ -2170,41 +2341,143 @@ impl Correctness { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noChildrenProp" => self.no_children_prop.as_ref(), - "noConstAssign" => self.no_const_assign.as_ref(), - "noConstantCondition" => self.no_constant_condition.as_ref(), - "noConstructorReturn" => self.no_constructor_return.as_ref(), - "noEmptyCharacterClassInRegex" => self.no_empty_character_class_in_regex.as_ref(), - "noEmptyPattern" => self.no_empty_pattern.as_ref(), - "noGlobalObjectCalls" => self.no_global_object_calls.as_ref(), - "noInnerDeclarations" => self.no_inner_declarations.as_ref(), - "noInvalidConstructorSuper" => self.no_invalid_constructor_super.as_ref(), - "noInvalidNewBuiltin" => self.no_invalid_new_builtin.as_ref(), - "noNewSymbol" => self.no_new_symbol.as_ref(), - "noNonoctalDecimalEscape" => self.no_nonoctal_decimal_escape.as_ref(), - "noPrecisionLoss" => self.no_precision_loss.as_ref(), - "noRenderReturnValue" => self.no_render_return_value.as_ref(), - "noSelfAssign" => self.no_self_assign.as_ref(), - "noSetterReturn" => self.no_setter_return.as_ref(), - "noStringCaseMismatch" => self.no_string_case_mismatch.as_ref(), - "noSwitchDeclarations" => self.no_switch_declarations.as_ref(), - "noUndeclaredVariables" => self.no_undeclared_variables.as_ref(), - "noUnnecessaryContinue" => self.no_unnecessary_continue.as_ref(), - "noUnreachable" => self.no_unreachable.as_ref(), - "noUnreachableSuper" => self.no_unreachable_super.as_ref(), - "noUnsafeFinally" => self.no_unsafe_finally.as_ref(), - "noUnsafeOptionalChaining" => self.no_unsafe_optional_chaining.as_ref(), - "noUnusedLabels" => self.no_unused_labels.as_ref(), - "noUnusedVariables" => self.no_unused_variables.as_ref(), - "noVoidElementsWithChildren" => self.no_void_elements_with_children.as_ref(), - "noVoidTypeReturn" => self.no_void_type_return.as_ref(), - "useExhaustiveDependencies" => self.use_exhaustive_dependencies.as_ref(), - "useHookAtTopLevel" => self.use_hook_at_top_level.as_ref(), - "useIsNan" => self.use_is_nan.as_ref(), - "useValidForDirection" => self.use_valid_for_direction.as_ref(), - "useYield" => self.use_yield.as_ref(), + "noChildrenProp" => self + .no_children_prop + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConstAssign" => self + .no_const_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConstantCondition" => self + .no_constant_condition + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConstructorReturn" => self + .no_constructor_return + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noEmptyCharacterClassInRegex" => self + .no_empty_character_class_in_regex + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noEmptyPattern" => self + .no_empty_pattern + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noGlobalObjectCalls" => self + .no_global_object_calls + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInnerDeclarations" => self + .no_inner_declarations + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInvalidConstructorSuper" => self + .no_invalid_constructor_super + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInvalidNewBuiltin" => self + .no_invalid_new_builtin + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNewSymbol" => self + .no_new_symbol + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNonoctalDecimalEscape" => self + .no_nonoctal_decimal_escape + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noPrecisionLoss" => self + .no_precision_loss + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRenderReturnValue" => self + .no_render_return_value + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSelfAssign" => self + .no_self_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSetterReturn" => self + .no_setter_return + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noStringCaseMismatch" => self + .no_string_case_mismatch + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSwitchDeclarations" => self + .no_switch_declarations + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUndeclaredVariables" => self + .no_undeclared_variables + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnnecessaryContinue" => self + .no_unnecessary_continue + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnreachable" => self + .no_unreachable + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnreachableSuper" => self + .no_unreachable_super + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnsafeFinally" => self + .no_unsafe_finally + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnsafeOptionalChaining" => self + .no_unsafe_optional_chaining + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnusedLabels" => self + .no_unused_labels + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnusedVariables" => self + .no_unused_variables + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noVoidElementsWithChildren" => self + .no_void_elements_with_children + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noVoidTypeReturn" => self + .no_void_type_return + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useExhaustiveDependencies" => self + .use_exhaustive_dependencies + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useHookAtTopLevel" => self + .use_hook_at_top_level + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useIsNan" => self + .use_is_nan + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidForDirection" => self + .use_valid_for_direction + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useYield" => self + .use_yield + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -2223,103 +2496,103 @@ pub struct Nursery { pub all: Option, #[doc = "Disallow the use of console."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_console: Option, + pub no_console: Option>, #[doc = "Disallow two keys with the same name inside a JSON object."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_json_keys: Option, + pub no_duplicate_json_keys: Option>, #[doc = "Disallow empty block statements and static blocks."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_block_statements: Option, + pub no_empty_block_statements: Option>, #[doc = "Disallow empty type parameters in type aliases and interfaces."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_type_parameters: Option, + pub no_empty_type_parameters: Option>, #[doc = "Disallow focused tests."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_focused_tests: Option, + pub no_focused_tests: Option>, #[doc = "Disallow assignments to native objects and read-only global variables."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_assign: Option, + pub no_global_assign: Option>, #[doc = "Disallow the use of global eval()."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_eval: Option, + pub no_global_eval: Option>, #[doc = "Disallow the use of variables and function parameters before their declaration"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_use_before_declaration: Option, + pub no_invalid_use_before_declaration: Option>, #[doc = "Disallow characters made with multiple code points in character class syntax."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_misleading_character_class: Option, + pub no_misleading_character_class: Option>, #[doc = "Disallow the use of namespace imports."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_namespace_import: Option, + pub no_namespace_import: Option>, #[doc = "Forbid the use of Node.js builtin modules."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_nodejs_modules: Option, + pub no_nodejs_modules: Option>, #[doc = "Avoid re-export all."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_re_export_all: Option, + pub no_re_export_all: Option>, #[doc = "Disallow specified modules when loaded by import or require."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_restricted_imports: Option, + pub no_restricted_imports: Option>, #[doc = "Disallow disabled tests."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_skipped_tests: Option, + pub no_skipped_tests: Option>, #[doc = "Disallow then property."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_then_property: Option, + pub no_then_property: Option>, #[doc = "Disallow the use of dependencies that aren't specified in the package.json."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_undeclared_dependencies: Option, + pub no_undeclared_dependencies: Option>, #[doc = "Disallow unused imports."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_imports: Option, + pub no_unused_imports: Option>, #[doc = "Disallow unused private class members"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_private_class_members: Option, + pub no_unused_private_class_members: Option>, #[doc = "Disallow unnecessary nested block statements."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_lone_block_statements: Option, + pub no_useless_lone_block_statements: Option>, #[doc = "Disallow ternary operators when simpler alternatives exist."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_ternary: Option, + pub no_useless_ternary: Option>, #[doc = "Ensure async functions utilize await."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_await: Option, + pub use_await: Option>, #[doc = "Require consistently using either T[] or Array"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_array_type: Option, + pub use_consistent_array_type: Option>, #[doc = "Promotes the use of export type for types."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_export_type: Option, + pub use_export_type: Option>, #[doc = "Enforce naming conventions for JavaScript and TypeScript filenames."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_filenaming_convention: Option, + pub use_filenaming_convention: Option>, #[doc = "This rule recommends a for-of loop when in a for loop, the index used to extract an item from the iterated array."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_for_of: Option, + pub use_for_of: Option>, #[doc = "Enforce the use of import type when an import only has specifiers with type qualifier."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_grouped_type_import: Option, + pub use_grouped_type_import: Option>, #[doc = "Disallows package private imports."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_import_restrictions: Option, + pub use_import_restrictions: Option>, #[doc = "Promotes the use of import type for types."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_import_type: Option, + pub use_import_type: Option>, #[doc = "Promotes the usage of node:assert/strict over node:assert."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_node_assert_strict: Option, + pub use_node_assert_strict: Option>, #[doc = "Enforces using the node: protocol for Node.js builtin modules."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_nodejs_import_protocol: Option, + pub use_nodejs_import_protocol: Option>, #[doc = "Use the Number properties instead of global ones."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_number_namespace: Option, + pub use_number_namespace: Option>, #[doc = "Enforce using function types instead of object type with call signatures."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_shorthand_function_type: Option, + pub use_shorthand_function_type: Option>, #[doc = "Enforce the sorting of CSS utility classes."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_sorted_classes: Option, + pub use_sorted_classes: Option>, } impl DeserializableValidator for Nursery { fn validate( @@ -2818,41 +3091,143 @@ impl Nursery { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noConsole" => self.no_console.as_ref(), - "noDuplicateJsonKeys" => self.no_duplicate_json_keys.as_ref(), - "noEmptyBlockStatements" => self.no_empty_block_statements.as_ref(), - "noEmptyTypeParameters" => self.no_empty_type_parameters.as_ref(), - "noFocusedTests" => self.no_focused_tests.as_ref(), - "noGlobalAssign" => self.no_global_assign.as_ref(), - "noGlobalEval" => self.no_global_eval.as_ref(), - "noInvalidUseBeforeDeclaration" => self.no_invalid_use_before_declaration.as_ref(), - "noMisleadingCharacterClass" => self.no_misleading_character_class.as_ref(), - "noNamespaceImport" => self.no_namespace_import.as_ref(), - "noNodejsModules" => self.no_nodejs_modules.as_ref(), - "noReExportAll" => self.no_re_export_all.as_ref(), - "noRestrictedImports" => self.no_restricted_imports.as_ref(), - "noSkippedTests" => self.no_skipped_tests.as_ref(), - "noThenProperty" => self.no_then_property.as_ref(), - "noUndeclaredDependencies" => self.no_undeclared_dependencies.as_ref(), - "noUnusedImports" => self.no_unused_imports.as_ref(), - "noUnusedPrivateClassMembers" => self.no_unused_private_class_members.as_ref(), - "noUselessLoneBlockStatements" => self.no_useless_lone_block_statements.as_ref(), - "noUselessTernary" => self.no_useless_ternary.as_ref(), - "useAwait" => self.use_await.as_ref(), - "useConsistentArrayType" => self.use_consistent_array_type.as_ref(), - "useExportType" => self.use_export_type.as_ref(), - "useFilenamingConvention" => self.use_filenaming_convention.as_ref(), - "useForOf" => self.use_for_of.as_ref(), - "useGroupedTypeImport" => self.use_grouped_type_import.as_ref(), - "useImportRestrictions" => self.use_import_restrictions.as_ref(), - "useImportType" => self.use_import_type.as_ref(), - "useNodeAssertStrict" => self.use_node_assert_strict.as_ref(), - "useNodejsImportProtocol" => self.use_nodejs_import_protocol.as_ref(), - "useNumberNamespace" => self.use_number_namespace.as_ref(), - "useShorthandFunctionType" => self.use_shorthand_function_type.as_ref(), - "useSortedClasses" => self.use_sorted_classes.as_ref(), + "noConsole" => self + .no_console + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateJsonKeys" => self + .no_duplicate_json_keys + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noEmptyBlockStatements" => self + .no_empty_block_statements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noEmptyTypeParameters" => self + .no_empty_type_parameters + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noFocusedTests" => self + .no_focused_tests + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noGlobalAssign" => self + .no_global_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noGlobalEval" => self + .no_global_eval + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInvalidUseBeforeDeclaration" => self + .no_invalid_use_before_declaration + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noMisleadingCharacterClass" => self + .no_misleading_character_class + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNamespaceImport" => self + .no_namespace_import + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNodejsModules" => self + .no_nodejs_modules + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noReExportAll" => self + .no_re_export_all + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRestrictedImports" => self + .no_restricted_imports + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSkippedTests" => self + .no_skipped_tests + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noThenProperty" => self + .no_then_property + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUndeclaredDependencies" => self + .no_undeclared_dependencies + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnusedImports" => self + .no_unused_imports + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnusedPrivateClassMembers" => self + .no_unused_private_class_members + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessLoneBlockStatements" => self + .no_useless_lone_block_statements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessTernary" => self + .no_useless_ternary + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAwait" => self + .use_await + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useConsistentArrayType" => self + .use_consistent_array_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useExportType" => self + .use_export_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useFilenamingConvention" => self + .use_filenaming_convention + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useForOf" => self + .use_for_of + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useGroupedTypeImport" => self + .use_grouped_type_import + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useImportRestrictions" => self + .use_import_restrictions + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useImportType" => self + .use_import_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNodeAssertStrict" => self + .use_node_assert_strict + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNodejsImportProtocol" => self + .use_nodejs_import_protocol + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNumberNamespace" => self + .use_number_namespace + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useShorthandFunctionType" => self + .use_shorthand_function_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSortedClasses" => self + .use_sorted_classes + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -2871,10 +3246,10 @@ pub struct Performance { pub all: Option, #[doc = "Disallow the use of spread (...) syntax on accumulators."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_accumulating_spread: Option, + pub no_accumulating_spread: Option>, #[doc = "Disallow the use of the delete operator."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_delete: Option, + pub no_delete: Option>, } impl DeserializableValidator for Performance { fn validate( @@ -2975,10 +3350,19 @@ impl Performance { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noAccumulatingSpread" => self.no_accumulating_spread.as_ref(), - "noDelete" => self.no_delete.as_ref(), + "noAccumulatingSpread" => self + .no_accumulating_spread + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDelete" => self + .no_delete + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -2997,10 +3381,11 @@ pub struct Security { pub all: Option, #[doc = "Prevent the usage of dangerous JSX props"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_dangerously_set_inner_html: Option, + pub no_dangerously_set_inner_html: Option>, #[doc = "Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_dangerously_set_inner_html_with_children: Option, + pub no_dangerously_set_inner_html_with_children: + Option>, } impl DeserializableValidator for Security { fn validate( @@ -3107,12 +3492,19 @@ impl Security { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noDangerouslySetInnerHtml" => self.no_dangerously_set_inner_html.as_ref(), - "noDangerouslySetInnerHtmlWithChildren" => { - self.no_dangerously_set_inner_html_with_children.as_ref() - } + "noDangerouslySetInnerHtml" => self + .no_dangerously_set_inner_html + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDangerouslySetInnerHtmlWithChildren" => self + .no_dangerously_set_inner_html_with_children + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -3131,103 +3523,103 @@ pub struct Style { pub all: Option, #[doc = "Disallow the use of arguments."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_arguments: Option, + pub no_arguments: Option>, #[doc = "Disallow comma operator."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_comma_operator: Option, + pub no_comma_operator: Option>, #[doc = "Disallow default exports."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_default_export: Option, + pub no_default_export: Option>, #[doc = "Disallow implicit true values on JSX boolean attributes"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_implicit_boolean: Option, + pub no_implicit_boolean: Option>, #[doc = "Disallow type annotations for variables, parameters, and class properties initialized with a literal expression."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_inferrable_types: Option, + pub no_inferrable_types: Option>, #[doc = "Disallow the use of TypeScript's namespaces."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_namespace: Option, + pub no_namespace: Option>, #[doc = "Disallow negation in the condition of an if statement if it has an else clause."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_negation_else: Option, + pub no_negation_else: Option>, #[doc = "Disallow non-null assertions using the ! postfix operator."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_non_null_assertion: Option, + pub no_non_null_assertion: Option>, #[doc = "Disallow reassigning function parameters."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_parameter_assign: Option, + pub no_parameter_assign: Option>, #[doc = "Disallow the use of parameter properties in class constructors."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_parameter_properties: Option, + pub no_parameter_properties: Option>, #[doc = "This rule allows you to specify global variable names that you don’t want to use in your application."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_restricted_globals: Option, + pub no_restricted_globals: Option>, #[doc = "Disallow the use of constants which its value is the upper-case version of its name."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_shouty_constants: Option, + pub no_shouty_constants: Option>, #[doc = "Disallow template literals if interpolation and special-character handling are not needed"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_template_literal: Option, + pub no_unused_template_literal: Option>, #[doc = "Disallow else block when the if block breaks early."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_else: Option, + pub no_useless_else: Option>, #[doc = "Disallow the use of var"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_var: Option, + pub no_var: Option>, #[doc = "Enforce the use of as const over literal type and type annotation."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_as_const_assertion: Option, + pub use_as_const_assertion: Option>, #[doc = "Requires following curly brace conventions."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_block_statements: Option, + pub use_block_statements: Option>, #[doc = "Enforce using else if instead of nested if in else clauses."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_collapsed_else_if: Option, + pub use_collapsed_else_if: Option>, #[doc = "Require const declarations for variables that are never reassigned after declared."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_const: Option, + pub use_const: Option>, #[doc = "Enforce default function parameters and optional function parameters to be last."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_default_parameter_last: Option, + pub use_default_parameter_last: Option>, #[doc = "Require that each enum member value be explicitly initialized."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_enum_initializers: Option, + pub use_enum_initializers: Option>, #[doc = "Disallow the use of Math.pow in favor of the ** operator."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_exponentiation_operator: Option, + pub use_exponentiation_operator: Option>, #[doc = "This rule enforces the use of <>... over ...."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_fragment_syntax: Option, + pub use_fragment_syntax: Option>, #[doc = "Require all enum members to be literal values."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_literal_enum_members: Option, + pub use_literal_enum_members: Option>, #[doc = "Enforce naming conventions for everything across a codebase."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_naming_convention: Option, + pub use_naming_convention: Option>, #[doc = "Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_numeric_literals: Option, + pub use_numeric_literals: Option>, #[doc = "Prevent extra closing tags for components without children"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_self_closing_elements: Option, + pub use_self_closing_elements: Option>, #[doc = "When expressing array types, this rule promotes the usage of T[] shorthand instead of Array."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_shorthand_array_type: Option, + pub use_shorthand_array_type: Option>, #[doc = "Require assignment operator shorthand where possible."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_shorthand_assign: Option, + pub use_shorthand_assign: Option>, #[doc = "Enforces switch clauses have a single statement, emits a quick fix wrapping the statements in a block."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_single_case_statement: Option, + pub use_single_case_statement: Option>, #[doc = "Disallow multiple variable declarations in the same variable statement"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_single_var_declarator: Option, + pub use_single_var_declarator: Option>, #[doc = "Prefer template literals over string concatenation."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_template: Option, + pub use_template: Option>, #[doc = "Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_while: Option, + pub use_while: Option>, } impl DeserializableValidator for Style { fn validate( @@ -3740,41 +4132,143 @@ impl Style { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noArguments" => self.no_arguments.as_ref(), - "noCommaOperator" => self.no_comma_operator.as_ref(), - "noDefaultExport" => self.no_default_export.as_ref(), - "noImplicitBoolean" => self.no_implicit_boolean.as_ref(), - "noInferrableTypes" => self.no_inferrable_types.as_ref(), - "noNamespace" => self.no_namespace.as_ref(), - "noNegationElse" => self.no_negation_else.as_ref(), - "noNonNullAssertion" => self.no_non_null_assertion.as_ref(), - "noParameterAssign" => self.no_parameter_assign.as_ref(), - "noParameterProperties" => self.no_parameter_properties.as_ref(), - "noRestrictedGlobals" => self.no_restricted_globals.as_ref(), - "noShoutyConstants" => self.no_shouty_constants.as_ref(), - "noUnusedTemplateLiteral" => self.no_unused_template_literal.as_ref(), - "noUselessElse" => self.no_useless_else.as_ref(), - "noVar" => self.no_var.as_ref(), - "useAsConstAssertion" => self.use_as_const_assertion.as_ref(), - "useBlockStatements" => self.use_block_statements.as_ref(), - "useCollapsedElseIf" => self.use_collapsed_else_if.as_ref(), - "useConst" => self.use_const.as_ref(), - "useDefaultParameterLast" => self.use_default_parameter_last.as_ref(), - "useEnumInitializers" => self.use_enum_initializers.as_ref(), - "useExponentiationOperator" => self.use_exponentiation_operator.as_ref(), - "useFragmentSyntax" => self.use_fragment_syntax.as_ref(), - "useLiteralEnumMembers" => self.use_literal_enum_members.as_ref(), - "useNamingConvention" => self.use_naming_convention.as_ref(), - "useNumericLiterals" => self.use_numeric_literals.as_ref(), - "useSelfClosingElements" => self.use_self_closing_elements.as_ref(), - "useShorthandArrayType" => self.use_shorthand_array_type.as_ref(), - "useShorthandAssign" => self.use_shorthand_assign.as_ref(), - "useSingleCaseStatement" => self.use_single_case_statement.as_ref(), - "useSingleVarDeclarator" => self.use_single_var_declarator.as_ref(), - "useTemplate" => self.use_template.as_ref(), - "useWhile" => self.use_while.as_ref(), + "noArguments" => self + .no_arguments + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noCommaOperator" => self + .no_comma_operator + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDefaultExport" => self + .no_default_export + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noImplicitBoolean" => self + .no_implicit_boolean + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noInferrableTypes" => self + .no_inferrable_types + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNamespace" => self + .no_namespace + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNegationElse" => self + .no_negation_else + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noNonNullAssertion" => self + .no_non_null_assertion + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noParameterAssign" => self + .no_parameter_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noParameterProperties" => self + .no_parameter_properties + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRestrictedGlobals" => self + .no_restricted_globals + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noShoutyConstants" => self + .no_shouty_constants + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnusedTemplateLiteral" => self + .no_unused_template_literal + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUselessElse" => self + .no_useless_else + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noVar" => self + .no_var + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useAsConstAssertion" => self + .use_as_const_assertion + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useBlockStatements" => self + .use_block_statements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useCollapsedElseIf" => self + .use_collapsed_else_if + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useConst" => self + .use_const + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useDefaultParameterLast" => self + .use_default_parameter_last + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useEnumInitializers" => self + .use_enum_initializers + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useExponentiationOperator" => self + .use_exponentiation_operator + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useFragmentSyntax" => self + .use_fragment_syntax + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useLiteralEnumMembers" => self + .use_literal_enum_members + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNamingConvention" => self + .use_naming_convention + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNumericLiterals" => self + .use_numeric_literals + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSelfClosingElements" => self + .use_self_closing_elements + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useShorthandArrayType" => self + .use_shorthand_array_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useShorthandAssign" => self + .use_shorthand_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSingleCaseStatement" => self + .use_single_case_statement + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useSingleVarDeclarator" => self + .use_single_var_declarator + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useTemplate" => self + .use_template + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useWhile" => self + .use_while + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } @@ -3793,139 +4287,141 @@ pub struct Suspicious { pub all: Option, #[doc = "Use standard constants instead of approximated literals."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_approximative_numeric_constant: Option, + pub no_approximative_numeric_constant: + Option>, #[doc = "Discourage the usage of Array index in keys."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_array_index_key: Option, + pub no_array_index_key: Option>, #[doc = "Disallow assignments in expressions."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_assign_in_expressions: Option, + pub no_assign_in_expressions: Option>, #[doc = "Disallows using an async function as a Promise executor."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_async_promise_executor: Option, + pub no_async_promise_executor: Option>, #[doc = "Disallow reassigning exceptions in catch clauses."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_catch_assign: Option, + pub no_catch_assign: Option>, #[doc = "Disallow reassigning class members."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_class_assign: Option, + pub no_class_assign: Option>, #[doc = "Prevent comments from being inserted as text nodes"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_comment_text: Option, + pub no_comment_text: Option>, #[doc = "Disallow comparing against -0"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_compare_neg_zero: Option, + pub no_compare_neg_zero: Option>, #[doc = "Disallow labeled statements that are not loops."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_confusing_labels: Option, + pub no_confusing_labels: Option>, #[doc = "Disallow void type outside of generic or return types."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_confusing_void_type: Option, + pub no_confusing_void_type: Option>, #[doc = "Disallow the use of console.log"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_console_log: Option, + pub no_console_log: Option>, #[doc = "Disallow TypeScript const enum"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_const_enum: Option, + pub no_const_enum: Option>, #[doc = "Prevents from having control characters and some escape sequences that match control characters in regular expressions."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_control_characters_in_regex: Option, + pub no_control_characters_in_regex: Option>, #[doc = "Disallow the use of debugger"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_debugger: Option, + pub no_debugger: Option>, #[doc = "Require the use of === and !=="] #[serde(skip_serializing_if = "Option::is_none")] - pub no_double_equals: Option, + pub no_double_equals: Option>, #[doc = "Disallow duplicate case labels."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_case: Option, + pub no_duplicate_case: Option>, #[doc = "Disallow duplicate class members."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_class_members: Option, + pub no_duplicate_class_members: Option>, #[doc = "Prevents JSX properties to be assigned multiple times."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_jsx_props: Option, + pub no_duplicate_jsx_props: Option>, #[doc = "Prevents object literals having more than one property declaration for the same name."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_object_keys: Option, + pub no_duplicate_object_keys: Option>, #[doc = "Disallow duplicate function parameter name."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_parameters: Option, + pub no_duplicate_parameters: Option>, #[doc = "Disallow the declaration of empty interfaces."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_interface: Option, + pub no_empty_interface: Option>, #[doc = "Disallow the any type usage."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_explicit_any: Option, + pub no_explicit_any: Option>, #[doc = "Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_extra_non_null_assertion: Option, + pub no_extra_non_null_assertion: Option>, #[doc = "Disallow fallthrough of switch clauses."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_fallthrough_switch_clause: Option, + pub no_fallthrough_switch_clause: Option>, #[doc = "Disallow reassigning function declarations."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_function_assign: Option, + pub no_function_assign: Option>, #[doc = "Use Number.isFinite instead of global isFinite."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_is_finite: Option, + pub no_global_is_finite: Option>, #[doc = "Use Number.isNaN instead of global isNaN."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_is_nan: Option, + pub no_global_is_nan: Option>, #[doc = "Disallow use of implicit any type on variable declarations."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_implicit_any_let: Option, + pub no_implicit_any_let: Option>, #[doc = "Disallow assigning to imported bindings"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_import_assign: Option, + pub no_import_assign: Option>, #[doc = "Disallow labels that share a name with a variable"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_label_var: Option, + pub no_label_var: Option>, #[doc = "Enforce proper usage of new and constructor."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_misleading_instantiator: Option, + pub no_misleading_instantiator: Option>, #[doc = "Disallow shorthand assign when variable appears on both sides."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_misrefactored_shorthand_assign: Option, + pub no_misrefactored_shorthand_assign: + Option>, #[doc = "Disallow direct use of Object.prototype builtins."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_prototype_builtins: Option, + pub no_prototype_builtins: Option>, #[doc = "Disallow variable, function, class, and type redeclarations in the same scope."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_redeclare: Option, + pub no_redeclare: Option>, #[doc = "Prevents from having redundant \"use strict\"."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_redundant_use_strict: Option, + pub no_redundant_use_strict: Option>, #[doc = "Disallow comparisons where both sides are exactly the same."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_self_compare: Option, + pub no_self_compare: Option>, #[doc = "Disallow identifiers from shadowing restricted names."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_shadow_restricted_names: Option, + pub no_shadow_restricted_names: Option>, #[doc = "Disallow sparse arrays"] #[serde(skip_serializing_if = "Option::is_none")] - pub no_sparse_array: Option, + pub no_sparse_array: Option>, #[doc = "Disallow unsafe declaration merging between interfaces and classes."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_declaration_merging: Option, + pub no_unsafe_declaration_merging: Option>, #[doc = "Disallow using unsafe negation."] #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_negation: Option, + pub no_unsafe_negation: Option>, #[doc = "Enforce default clauses in switch statements to be last"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_default_switch_clause_last: Option, + pub use_default_switch_clause_last: Option>, #[doc = "Enforce get methods to always return a value."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_getter_return: Option, + pub use_getter_return: Option>, #[doc = "Use Array.isArray() instead of instanceof Array."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_is_array: Option, + pub use_is_array: Option>, #[doc = "Require using the namespace keyword over the module keyword to declare TypeScript namespaces."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_namespace_keyword: Option, + pub use_namespace_keyword: Option>, #[doc = "This rule verifies the result of typeof $expr unary expressions is being compared to valid values, either string literals containing valid type names or other typeof expressions"] #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_typeof: Option, + pub use_valid_typeof: Option>, } impl DeserializableValidator for Suspicious { fn validate( @@ -4628,53 +5124,191 @@ impl Suspicious { disabled_rules.extend(Self::recommended_rules_as_filters()); } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration( + &self, + rule_name: &str, + ) -> Option<(RulePlainConfiguration, Option)> { match rule_name { - "noApproximativeNumericConstant" => self.no_approximative_numeric_constant.as_ref(), - "noArrayIndexKey" => self.no_array_index_key.as_ref(), - "noAssignInExpressions" => self.no_assign_in_expressions.as_ref(), - "noAsyncPromiseExecutor" => self.no_async_promise_executor.as_ref(), - "noCatchAssign" => self.no_catch_assign.as_ref(), - "noClassAssign" => self.no_class_assign.as_ref(), - "noCommentText" => self.no_comment_text.as_ref(), - "noCompareNegZero" => self.no_compare_neg_zero.as_ref(), - "noConfusingLabels" => self.no_confusing_labels.as_ref(), - "noConfusingVoidType" => self.no_confusing_void_type.as_ref(), - "noConsoleLog" => self.no_console_log.as_ref(), - "noConstEnum" => self.no_const_enum.as_ref(), - "noControlCharactersInRegex" => self.no_control_characters_in_regex.as_ref(), - "noDebugger" => self.no_debugger.as_ref(), - "noDoubleEquals" => self.no_double_equals.as_ref(), - "noDuplicateCase" => self.no_duplicate_case.as_ref(), - "noDuplicateClassMembers" => self.no_duplicate_class_members.as_ref(), - "noDuplicateJsxProps" => self.no_duplicate_jsx_props.as_ref(), - "noDuplicateObjectKeys" => self.no_duplicate_object_keys.as_ref(), - "noDuplicateParameters" => self.no_duplicate_parameters.as_ref(), - "noEmptyInterface" => self.no_empty_interface.as_ref(), - "noExplicitAny" => self.no_explicit_any.as_ref(), - "noExtraNonNullAssertion" => self.no_extra_non_null_assertion.as_ref(), - "noFallthroughSwitchClause" => self.no_fallthrough_switch_clause.as_ref(), - "noFunctionAssign" => self.no_function_assign.as_ref(), - "noGlobalIsFinite" => self.no_global_is_finite.as_ref(), - "noGlobalIsNan" => self.no_global_is_nan.as_ref(), - "noImplicitAnyLet" => self.no_implicit_any_let.as_ref(), - "noImportAssign" => self.no_import_assign.as_ref(), - "noLabelVar" => self.no_label_var.as_ref(), - "noMisleadingInstantiator" => self.no_misleading_instantiator.as_ref(), - "noMisrefactoredShorthandAssign" => self.no_misrefactored_shorthand_assign.as_ref(), - "noPrototypeBuiltins" => self.no_prototype_builtins.as_ref(), - "noRedeclare" => self.no_redeclare.as_ref(), - "noRedundantUseStrict" => self.no_redundant_use_strict.as_ref(), - "noSelfCompare" => self.no_self_compare.as_ref(), - "noShadowRestrictedNames" => self.no_shadow_restricted_names.as_ref(), - "noSparseArray" => self.no_sparse_array.as_ref(), - "noUnsafeDeclarationMerging" => self.no_unsafe_declaration_merging.as_ref(), - "noUnsafeNegation" => self.no_unsafe_negation.as_ref(), - "useDefaultSwitchClauseLast" => self.use_default_switch_clause_last.as_ref(), - "useGetterReturn" => self.use_getter_return.as_ref(), - "useIsArray" => self.use_is_array.as_ref(), - "useNamespaceKeyword" => self.use_namespace_keyword.as_ref(), - "useValidTypeof" => self.use_valid_typeof.as_ref(), + "noApproximativeNumericConstant" => self + .no_approximative_numeric_constant + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noArrayIndexKey" => self + .no_array_index_key + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noAssignInExpressions" => self + .no_assign_in_expressions + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noAsyncPromiseExecutor" => self + .no_async_promise_executor + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noCatchAssign" => self + .no_catch_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noClassAssign" => self + .no_class_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noCommentText" => self + .no_comment_text + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noCompareNegZero" => self + .no_compare_neg_zero + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConfusingLabels" => self + .no_confusing_labels + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConfusingVoidType" => self + .no_confusing_void_type + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConsoleLog" => self + .no_console_log + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noConstEnum" => self + .no_const_enum + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noControlCharactersInRegex" => self + .no_control_characters_in_regex + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDebugger" => self + .no_debugger + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDoubleEquals" => self + .no_double_equals + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateCase" => self + .no_duplicate_case + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateClassMembers" => self + .no_duplicate_class_members + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateJsxProps" => self + .no_duplicate_jsx_props + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateObjectKeys" => self + .no_duplicate_object_keys + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noDuplicateParameters" => self + .no_duplicate_parameters + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noEmptyInterface" => self + .no_empty_interface + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noExplicitAny" => self + .no_explicit_any + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noExtraNonNullAssertion" => self + .no_extra_non_null_assertion + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noFallthroughSwitchClause" => self + .no_fallthrough_switch_clause + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noFunctionAssign" => self + .no_function_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noGlobalIsFinite" => self + .no_global_is_finite + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noGlobalIsNan" => self + .no_global_is_nan + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noImplicitAnyLet" => self + .no_implicit_any_let + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noImportAssign" => self + .no_import_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noLabelVar" => self + .no_label_var + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noMisleadingInstantiator" => self + .no_misleading_instantiator + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noMisrefactoredShorthandAssign" => self + .no_misrefactored_shorthand_assign + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noPrototypeBuiltins" => self + .no_prototype_builtins + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRedeclare" => self + .no_redeclare + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noRedundantUseStrict" => self + .no_redundant_use_strict + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSelfCompare" => self + .no_self_compare + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noShadowRestrictedNames" => self + .no_shadow_restricted_names + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noSparseArray" => self + .no_sparse_array + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnsafeDeclarationMerging" => self + .no_unsafe_declaration_merging + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "noUnsafeNegation" => self + .no_unsafe_negation + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useDefaultSwitchClauseLast" => self + .use_default_switch_clause_last + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useGetterReturn" => self + .use_getter_return + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useIsArray" => self + .use_is_array + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useNamespaceKeyword" => self + .use_namespace_keyword + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), + "useValidTypeof" => self + .use_valid_typeof + .as_ref() + .map(|conf| (conf.level(), conf.get_options())), _ => None, } } diff --git a/crates/biome_service/src/configuration/parse/json/linter.rs b/crates/biome_service/src/configuration/parse/json/linter.rs new file mode 100644 index 000000000000..f2578251db6f --- /dev/null +++ b/crates/biome_service/src/configuration/parse/json/linter.rs @@ -0,0 +1,160 @@ +use std::marker::PhantomData; + +use crate::configuration::linter::{RulePlainConfiguration, RuleWithOptions}; +use crate::configuration::LinterConfiguration; +use crate::RuleConfiguration; +use biome_deserialize::{ + Deserializable, DeserializableValue, DeserializationDiagnostic, DeserializationVisitor, Text, + VisitableType, +}; +use biome_rowan::TextRange; + +impl Deserializable for LinterConfiguration { + fn deserialize( + value: &impl DeserializableValue, + name: &str, + diagnostics: &mut Vec, + ) -> Option { + value.deserialize(LinterConfigurationVisitor, name, diagnostics) + } +} + +struct LinterConfigurationVisitor; +impl DeserializationVisitor for LinterConfigurationVisitor { + type Output = LinterConfiguration; + + const EXPECTED_TYPE: VisitableType = VisitableType::MAP; + + fn visit_map( + self, + members: impl Iterator>, + _range: biome_rowan::TextRange, + _name: &str, + diagnostics: &mut Vec, + ) -> Option { + const ALLOWED_KEYS: &[&str] = &["enabled", "rules", "include", "ignore"]; + let mut result = Self::Output::default(); + for (key, value) in members.flatten() { + let Some(key_text) = Text::deserialize(&key, "", diagnostics) else { + continue; + }; + match key_text.text() { + "ignore" => { + result.ignore = Deserializable::deserialize(&value, &key_text, diagnostics); + } + "include" => { + result.include = Deserializable::deserialize(&value, &key_text, diagnostics); + } + "enabled" => { + result.enabled = Deserializable::deserialize(&value, &key_text, diagnostics); + } + "rules" => { + result.rules = Deserializable::deserialize(&value, &key_text, diagnostics); + } + unknown_key => diagnostics.push(DeserializationDiagnostic::new_unknown_key( + unknown_key, + key.range(), + ALLOWED_KEYS, + )), + } + } + Some(result) + } +} + +impl Deserializable for RuleConfiguration { + fn deserialize( + value: &impl DeserializableValue, + rule_name: &str, + diagnostics: &mut Vec, + ) -> Option { + value.deserialize( + RuleConfigurationVisitor(PhantomData), + rule_name, + diagnostics, + ) + } +} + +struct RuleConfigurationVisitor(PhantomData); +impl DeserializationVisitor for RuleConfigurationVisitor { + type Output = RuleConfiguration; + + const EXPECTED_TYPE: VisitableType = VisitableType::STR.union(VisitableType::MAP); + + fn visit_str( + self, + value: Text, + range: TextRange, + _rule_name: &str, + diagnostics: &mut Vec, + ) -> Option { + RulePlainConfiguration::deserialize_from_str(value, range, diagnostics) + .map(RuleConfiguration::Plain) + } + + fn visit_map( + self, + members: impl Iterator>, + _range: biome_rowan::TextRange, + rule_name: &str, + diagnostics: &mut Vec, + ) -> Option { + const ALLOWED_KEYS: &[&str] = &["level", "options"]; + let mut result = RuleWithOptions::default(); + for (key, value) in members.flatten() { + let Some(key_text) = Text::deserialize(&key, "", diagnostics) else { + continue; + }; + match key_text.text() { + "level" => { + result.level = Deserializable::deserialize(&value, &key_text, diagnostics)?; + } + "options" => { + if let Some(options) = + Deserializable::deserialize(&value, rule_name, diagnostics) + { + result.options = options; + } + } + unknown_key => diagnostics.push(DeserializationDiagnostic::new_unknown_key( + unknown_key, + key.range(), + ALLOWED_KEYS, + )), + } + } + Some(RuleConfiguration::WithOptions(result)) + } +} + +impl RulePlainConfiguration { + fn deserialize_from_str( + value: Text, + range: TextRange, + diagnostics: &mut Vec, + ) -> Option { + const ALLOWED_VARIANTS: &[&str] = &["error", "warn", "off"]; + if let Ok(value) = value.text().parse::() { + Some(value) + } else { + diagnostics.push(DeserializationDiagnostic::new_unknown_value( + value.text(), + range, + ALLOWED_VARIANTS, + )); + None + } + } +} + +impl Deserializable for RulePlainConfiguration { + fn deserialize( + value: &impl DeserializableValue, + name: &str, + diagnostics: &mut Vec, + ) -> Option { + let value_text = Text::deserialize(value, name, diagnostics)?; + Self::deserialize_from_str(value_text, value.range(), diagnostics) + } +} diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts index af224ee2fb01..f00ef035abe3 100644 --- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts +++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts @@ -475,59 +475,59 @@ export interface A11y { /** * Enforce that the accessKey attribute is not used on any HTML element. */ - noAccessKey?: RuleConfiguration; + noAccessKey?: RuleConfiguration_for_Null; /** * Enforce that aria-hidden="true" is not set on focusable elements. */ - noAriaHiddenOnFocusable?: RuleConfiguration; + noAriaHiddenOnFocusable?: RuleConfiguration_for_Null; /** * Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. */ - noAriaUnsupportedElements?: RuleConfiguration; + noAriaUnsupportedElements?: RuleConfiguration_for_Null; /** * Enforce that autoFocus prop is not used on elements. */ - noAutofocus?: RuleConfiguration; + noAutofocus?: RuleConfiguration_for_Null; /** * Disallow target="_blank" attribute without rel="noreferrer" */ - noBlankTarget?: RuleConfiguration; + noBlankTarget?: RuleConfiguration_for_Null; /** * Enforces that no distracting elements are used. */ - noDistractingElements?: RuleConfiguration; + noDistractingElements?: RuleConfiguration_for_Null; /** * The scope prop should be used only on elements. */ - noHeaderScope?: RuleConfiguration; + noHeaderScope?: RuleConfiguration_for_Null; /** * Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements. */ - noInteractiveElementToNoninteractiveRole?: RuleConfiguration; + noInteractiveElementToNoninteractiveRole?: RuleConfiguration_for_Null; /** * Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements. */ - noNoninteractiveElementToInteractiveRole?: RuleConfiguration; + noNoninteractiveElementToInteractiveRole?: RuleConfiguration_for_Null; /** * Enforce that tabIndex is not assigned to non-interactive HTML elements. */ - noNoninteractiveTabindex?: RuleConfiguration; + noNoninteractiveTabindex?: RuleConfiguration_for_Null; /** * Prevent the usage of positive integers on tabIndex property */ - noPositiveTabindex?: RuleConfiguration; + noPositiveTabindex?: RuleConfiguration_for_Null; /** * Enforce img alt prop does not contain the word "image", "picture", or "photo". */ - noRedundantAlt?: RuleConfiguration; + noRedundantAlt?: RuleConfiguration_for_Null; /** * Enforce explicit role property is not the same as implicit/default role property on an element. */ - noRedundantRoles?: RuleConfiguration; + noRedundantRoles?: RuleConfiguration_for_Null; /** * Enforces the usage of the title element for the svg element. */ - noSvgWithoutTitle?: RuleConfiguration; + noSvgWithoutTitle?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -535,67 +535,67 @@ export interface A11y { /** * Enforce that all elements that require alternative text have meaningful information to relay back to the end user. */ - useAltText?: RuleConfiguration; + useAltText?: RuleConfiguration_for_Null; /** * Enforce that anchors have content and that the content is accessible to screen readers. */ - useAnchorContent?: RuleConfiguration; + useAnchorContent?: RuleConfiguration_for_Null; /** * Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant. */ - useAriaActivedescendantWithTabindex?: RuleConfiguration; + useAriaActivedescendantWithTabindex?: RuleConfiguration_for_Null; /** * Enforce that elements with ARIA roles must have all required ARIA attributes for that role. */ - useAriaPropsForRole?: RuleConfiguration; + useAriaPropsForRole?: RuleConfiguration_for_Null; /** * Enforces the usage of the attribute type for the element button */ - useButtonType?: RuleConfiguration; + useButtonType?: RuleConfiguration_for_Null; /** * Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop. */ - useHeadingContent?: RuleConfiguration; + useHeadingContent?: RuleConfiguration_for_Null; /** * Enforce that html element has lang attribute. */ - useHtmlLang?: RuleConfiguration; + useHtmlLang?: RuleConfiguration_for_Null; /** * Enforces the usage of the attribute title for the element iframe. */ - useIframeTitle?: RuleConfiguration; + useIframeTitle?: RuleConfiguration_for_Null; /** * Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress. */ - useKeyWithClickEvents?: RuleConfiguration; + useKeyWithClickEvents?: RuleConfiguration_for_Null; /** * Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur. */ - useKeyWithMouseEvents?: RuleConfiguration; + useKeyWithMouseEvents?: RuleConfiguration_for_Null; /** * Enforces that audio and video elements must have a track for captions. */ - useMediaCaption?: RuleConfiguration; + useMediaCaption?: RuleConfiguration_for_Null; /** * Enforce that all anchors are valid, and they are navigable elements. */ - useValidAnchor?: RuleConfiguration; + useValidAnchor?: RuleConfiguration_for_Null; /** * Ensures that ARIA properties aria-* are all valid. */ - useValidAriaProps?: RuleConfiguration; + useValidAriaProps?: RuleConfiguration_for_Null; /** * Elements with ARIA roles must use a valid, non-abstract ARIA role. */ - useValidAriaRole?: RuleConfiguration; + useValidAriaRole?: RuleConfiguration_for_ValidAriaRoleOptions; /** * Enforce that ARIA state and property values are valid. */ - useValidAriaValues?: RuleConfiguration; + useValidAriaValues?: RuleConfiguration_for_Null; /** * Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country. */ - useValidLang?: RuleConfiguration; + useValidLang?: RuleConfiguration_for_Null; } /** * A list of rules that belong to this group @@ -608,75 +608,75 @@ export interface Complexity { /** * Disallow primitive type aliases and misleading types. */ - noBannedTypes?: RuleConfiguration; + noBannedTypes?: RuleConfiguration_for_Null; /** * Disallow functions that exceed a given Cognitive Complexity score. */ - noExcessiveCognitiveComplexity?: RuleConfiguration; + noExcessiveCognitiveComplexity?: RuleConfiguration_for_ComplexityOptions; /** * Disallow unnecessary boolean casts */ - noExtraBooleanCast?: RuleConfiguration; + noExtraBooleanCast?: RuleConfiguration_for_Null; /** * Prefer for...of statement instead of Array.forEach. */ - noForEach?: RuleConfiguration; + noForEach?: RuleConfiguration_for_Null; /** * Disallow unclear usage of consecutive space characters in regular expression literals */ - noMultipleSpacesInRegularExpressionLiterals?: RuleConfiguration; + noMultipleSpacesInRegularExpressionLiterals?: RuleConfiguration_for_Null; /** * This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace. */ - noStaticOnlyClass?: RuleConfiguration; + noStaticOnlyClass?: RuleConfiguration_for_Null; /** * Disallow this and super in static contexts. */ - noThisInStatic?: RuleConfiguration; + noThisInStatic?: RuleConfiguration_for_Null; /** * Disallow unnecessary catch clauses. */ - noUselessCatch?: RuleConfiguration; + noUselessCatch?: RuleConfiguration_for_Null; /** * Disallow unnecessary constructors. */ - noUselessConstructor?: RuleConfiguration; + noUselessConstructor?: RuleConfiguration_for_Null; /** * Disallow empty exports that don't change anything in a module file. */ - noUselessEmptyExport?: RuleConfiguration; + noUselessEmptyExport?: RuleConfiguration_for_Null; /** * Disallow unnecessary fragments */ - noUselessFragments?: RuleConfiguration; + noUselessFragments?: RuleConfiguration_for_Null; /** * Disallow unnecessary labels. */ - noUselessLabel?: RuleConfiguration; + noUselessLabel?: RuleConfiguration_for_Null; /** * Disallow renaming import, export, and destructured assignments to the same name. */ - noUselessRename?: RuleConfiguration; + noUselessRename?: RuleConfiguration_for_Null; /** * Disallow useless case in switch statements. */ - noUselessSwitchCase?: RuleConfiguration; + noUselessSwitchCase?: RuleConfiguration_for_Null; /** * Disallow useless this aliasing. */ - noUselessThisAlias?: RuleConfiguration; + noUselessThisAlias?: RuleConfiguration_for_Null; /** * Disallow using any or unknown as type constraint. */ - noUselessTypeConstraint?: RuleConfiguration; + noUselessTypeConstraint?: RuleConfiguration_for_Null; /** * Disallow the use of void operators, which is not a familiar operator. */ - noVoid?: RuleConfiguration; + noVoid?: RuleConfiguration_for_Null; /** * Disallow with statements in non-strict contexts. */ - noWith?: RuleConfiguration; + noWith?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -684,31 +684,31 @@ export interface Complexity { /** * Use arrow functions over function expressions. */ - useArrowFunction?: RuleConfiguration; + useArrowFunction?: RuleConfiguration_for_Null; /** * Promotes the use of .flatMap() when map().flat() are used together. */ - useFlatMap?: RuleConfiguration; + useFlatMap?: RuleConfiguration_for_Null; /** * Enforce the usage of a literal access to properties over computed property access. */ - useLiteralKeys?: RuleConfiguration; + useLiteralKeys?: RuleConfiguration_for_Null; /** * Enforce using concise optional chain instead of chained logical expressions. */ - useOptionalChain?: RuleConfiguration; + useOptionalChain?: RuleConfiguration_for_Null; /** * Enforce the use of the regular expression literals instead of the RegExp constructor if possible. */ - useRegexLiterals?: RuleConfiguration; + useRegexLiterals?: RuleConfiguration_for_Null; /** * Disallow number literal object member names which are not base10 or uses underscore as separator */ - useSimpleNumberKeys?: RuleConfiguration; + useSimpleNumberKeys?: RuleConfiguration_for_Null; /** * Discard redundant terms from logical expressions. */ - useSimplifiedLogicExpression?: RuleConfiguration; + useSimplifiedLogicExpression?: RuleConfiguration_for_Null; } /** * A list of rules that belong to this group @@ -721,115 +721,115 @@ export interface Correctness { /** * Prevent passing of children as props. */ - noChildrenProp?: RuleConfiguration; + noChildrenProp?: RuleConfiguration_for_Null; /** * Prevents from having const variables being re-assigned. */ - noConstAssign?: RuleConfiguration; + noConstAssign?: RuleConfiguration_for_Null; /** * Disallow constant expressions in conditions */ - noConstantCondition?: RuleConfiguration; + noConstantCondition?: RuleConfiguration_for_Null; /** * Disallow returning a value from a constructor. */ - noConstructorReturn?: RuleConfiguration; + noConstructorReturn?: RuleConfiguration_for_Null; /** * Disallow empty character classes in regular expression literals. */ - noEmptyCharacterClassInRegex?: RuleConfiguration; + noEmptyCharacterClassInRegex?: RuleConfiguration_for_Null; /** * Disallows empty destructuring patterns. */ - noEmptyPattern?: RuleConfiguration; + noEmptyPattern?: RuleConfiguration_for_Null; /** * Disallow calling global object properties as functions */ - noGlobalObjectCalls?: RuleConfiguration; + noGlobalObjectCalls?: RuleConfiguration_for_Null; /** * Disallow function and var declarations that are accessible outside their block. */ - noInnerDeclarations?: RuleConfiguration; + noInnerDeclarations?: RuleConfiguration_for_Null; /** * Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors. */ - noInvalidConstructorSuper?: RuleConfiguration; + noInvalidConstructorSuper?: RuleConfiguration_for_Null; /** * Disallow new operators with global non-constructor functions. */ - noInvalidNewBuiltin?: RuleConfiguration; + noInvalidNewBuiltin?: RuleConfiguration_for_Null; /** * Disallow new operators with the Symbol object. */ - noNewSymbol?: RuleConfiguration; + noNewSymbol?: RuleConfiguration_for_Null; /** * Disallow \8 and \9 escape sequences in string literals. */ - noNonoctalDecimalEscape?: RuleConfiguration; + noNonoctalDecimalEscape?: RuleConfiguration_for_Null; /** * Disallow literal numbers that lose precision */ - noPrecisionLoss?: RuleConfiguration; + noPrecisionLoss?: RuleConfiguration_for_Null; /** * Prevent the usage of the return value of React.render. */ - noRenderReturnValue?: RuleConfiguration; + noRenderReturnValue?: RuleConfiguration_for_Null; /** * Disallow assignments where both sides are exactly the same. */ - noSelfAssign?: RuleConfiguration; + noSelfAssign?: RuleConfiguration_for_Null; /** * Disallow returning a value from a setter */ - noSetterReturn?: RuleConfiguration; + noSetterReturn?: RuleConfiguration_for_Null; /** * Disallow comparison of expressions modifying the string case with non-compliant value. */ - noStringCaseMismatch?: RuleConfiguration; + noStringCaseMismatch?: RuleConfiguration_for_Null; /** * Disallow lexical declarations in switch clauses. */ - noSwitchDeclarations?: RuleConfiguration; + noSwitchDeclarations?: RuleConfiguration_for_Null; /** * Prevents the usage of variables that haven't been declared inside the document. */ - noUndeclaredVariables?: RuleConfiguration; + noUndeclaredVariables?: RuleConfiguration_for_Null; /** * Avoid using unnecessary continue. */ - noUnnecessaryContinue?: RuleConfiguration; + noUnnecessaryContinue?: RuleConfiguration_for_Null; /** * Disallow unreachable code */ - noUnreachable?: RuleConfiguration; + noUnreachable?: RuleConfiguration_for_Null; /** * Ensures the super() constructor is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass */ - noUnreachableSuper?: RuleConfiguration; + noUnreachableSuper?: RuleConfiguration_for_Null; /** * Disallow control flow statements in finally blocks. */ - noUnsafeFinally?: RuleConfiguration; + noUnsafeFinally?: RuleConfiguration_for_Null; /** * Disallow the use of optional chaining in contexts where the undefined value is not allowed. */ - noUnsafeOptionalChaining?: RuleConfiguration; + noUnsafeOptionalChaining?: RuleConfiguration_for_Null; /** * Disallow unused labels. */ - noUnusedLabels?: RuleConfiguration; + noUnusedLabels?: RuleConfiguration_for_Null; /** * Disallow unused variables. */ - noUnusedVariables?: RuleConfiguration; + noUnusedVariables?: RuleConfiguration_for_Null; /** * This rules prevents void elements (AKA self-closing elements) from having children. */ - noVoidElementsWithChildren?: RuleConfiguration; + noVoidElementsWithChildren?: RuleConfiguration_for_Null; /** * Disallow returning a value from a function with the return type 'void' */ - noVoidTypeReturn?: RuleConfiguration; + noVoidTypeReturn?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -837,23 +837,23 @@ export interface Correctness { /** * Enforce all dependencies are correctly specified in a React hook. */ - useExhaustiveDependencies?: RuleConfiguration; + useExhaustiveDependencies?: RuleConfiguration_for_HooksOptions; /** * Enforce that all React hooks are being called from the Top Level component functions. */ - useHookAtTopLevel?: RuleConfiguration; + useHookAtTopLevel?: RuleConfiguration_for_DeprecatedHooksOptions; /** * Require calls to isNaN() when checking for NaN. */ - useIsNan?: RuleConfiguration; + useIsNan?: RuleConfiguration_for_Null; /** * Enforce "for" loop update clause moving the counter in the right direction. */ - useValidForDirection?: RuleConfiguration; + useValidForDirection?: RuleConfiguration_for_Null; /** * Require generator functions to contain yield. */ - useYield?: RuleConfiguration; + useYield?: RuleConfiguration_for_Null; } /** * A list of rules that belong to this group @@ -866,83 +866,83 @@ export interface Nursery { /** * Disallow the use of console. */ - noConsole?: RuleConfiguration; + noConsole?: RuleConfiguration_for_Null; /** * Disallow two keys with the same name inside a JSON object. */ - noDuplicateJsonKeys?: RuleConfiguration; + noDuplicateJsonKeys?: RuleConfiguration_for_Null; /** * Disallow empty block statements and static blocks. */ - noEmptyBlockStatements?: RuleConfiguration; + noEmptyBlockStatements?: RuleConfiguration_for_Null; /** * Disallow empty type parameters in type aliases and interfaces. */ - noEmptyTypeParameters?: RuleConfiguration; + noEmptyTypeParameters?: RuleConfiguration_for_Null; /** * Disallow focused tests. */ - noFocusedTests?: RuleConfiguration; + noFocusedTests?: RuleConfiguration_for_Null; /** * Disallow assignments to native objects and read-only global variables. */ - noGlobalAssign?: RuleConfiguration; + noGlobalAssign?: RuleConfiguration_for_Null; /** * Disallow the use of global eval(). */ - noGlobalEval?: RuleConfiguration; + noGlobalEval?: RuleConfiguration_for_Null; /** * Disallow the use of variables and function parameters before their declaration */ - noInvalidUseBeforeDeclaration?: RuleConfiguration; + noInvalidUseBeforeDeclaration?: RuleConfiguration_for_Null; /** * Disallow characters made with multiple code points in character class syntax. */ - noMisleadingCharacterClass?: RuleConfiguration; + noMisleadingCharacterClass?: RuleConfiguration_for_Null; /** * Disallow the use of namespace imports. */ - noNamespaceImport?: RuleConfiguration; + noNamespaceImport?: RuleConfiguration_for_Null; /** * Forbid the use of Node.js builtin modules. */ - noNodejsModules?: RuleConfiguration; + noNodejsModules?: RuleConfiguration_for_Null; /** * Avoid re-export all. */ - noReExportAll?: RuleConfiguration; + noReExportAll?: RuleConfiguration_for_Null; /** * Disallow specified modules when loaded by import or require. */ - noRestrictedImports?: RuleConfiguration; + noRestrictedImports?: RuleConfiguration_for_RestrictedImportsOptions; /** * Disallow disabled tests. */ - noSkippedTests?: RuleConfiguration; + noSkippedTests?: RuleConfiguration_for_Null; /** * Disallow then property. */ - noThenProperty?: RuleConfiguration; + noThenProperty?: RuleConfiguration_for_Null; /** * Disallow the use of dependencies that aren't specified in the package.json. */ - noUndeclaredDependencies?: RuleConfiguration; + noUndeclaredDependencies?: RuleConfiguration_for_Null; /** * Disallow unused imports. */ - noUnusedImports?: RuleConfiguration; + noUnusedImports?: RuleConfiguration_for_Null; /** * Disallow unused private class members */ - noUnusedPrivateClassMembers?: RuleConfiguration; + noUnusedPrivateClassMembers?: RuleConfiguration_for_Null; /** * Disallow unnecessary nested block statements. */ - noUselessLoneBlockStatements?: RuleConfiguration; + noUselessLoneBlockStatements?: RuleConfiguration_for_Null; /** * Disallow ternary operators when simpler alternatives exist. */ - noUselessTernary?: RuleConfiguration; + noUselessTernary?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -950,55 +950,55 @@ export interface Nursery { /** * Ensure async functions utilize await. */ - useAwait?: RuleConfiguration; + useAwait?: RuleConfiguration_for_Null; /** * Require consistently using either T[] or Array */ - useConsistentArrayType?: RuleConfiguration; + useConsistentArrayType?: RuleConfiguration_for_ConsistentArrayTypeOptions; /** * Promotes the use of export type for types. */ - useExportType?: RuleConfiguration; + useExportType?: RuleConfiguration_for_Null; /** * Enforce naming conventions for JavaScript and TypeScript filenames. */ - useFilenamingConvention?: RuleConfiguration; + useFilenamingConvention?: RuleConfiguration_for_FilenamingConventionOptions; /** * This rule recommends a for-of loop when in a for loop, the index used to extract an item from the iterated array. */ - useForOf?: RuleConfiguration; + useForOf?: RuleConfiguration_for_Null; /** * Enforce the use of import type when an import only has specifiers with type qualifier. */ - useGroupedTypeImport?: RuleConfiguration; + useGroupedTypeImport?: RuleConfiguration_for_Null; /** * Disallows package private imports. */ - useImportRestrictions?: RuleConfiguration; + useImportRestrictions?: RuleConfiguration_for_Null; /** * Promotes the use of import type for types. */ - useImportType?: RuleConfiguration; + useImportType?: RuleConfiguration_for_Null; /** * Promotes the usage of node:assert/strict over node:assert. */ - useNodeAssertStrict?: RuleConfiguration; + useNodeAssertStrict?: RuleConfiguration_for_Null; /** * Enforces using the node: protocol for Node.js builtin modules. */ - useNodejsImportProtocol?: RuleConfiguration; + useNodejsImportProtocol?: RuleConfiguration_for_Null; /** * Use the Number properties instead of global ones. */ - useNumberNamespace?: RuleConfiguration; + useNumberNamespace?: RuleConfiguration_for_Null; /** * Enforce using function types instead of object type with call signatures. */ - useShorthandFunctionType?: RuleConfiguration; + useShorthandFunctionType?: RuleConfiguration_for_Null; /** * Enforce the sorting of CSS utility classes. */ - useSortedClasses?: RuleConfiguration; + useSortedClasses?: RuleConfiguration_for_UtilityClassSortingOptions; } /** * A list of rules that belong to this group @@ -1011,11 +1011,11 @@ export interface Performance { /** * Disallow the use of spread (...) syntax on accumulators. */ - noAccumulatingSpread?: RuleConfiguration; + noAccumulatingSpread?: RuleConfiguration_for_Null; /** * Disallow the use of the delete operator. */ - noDelete?: RuleConfiguration; + noDelete?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -1032,11 +1032,11 @@ export interface Security { /** * Prevent the usage of dangerous JSX props */ - noDangerouslySetInnerHtml?: RuleConfiguration; + noDangerouslySetInnerHtml?: RuleConfiguration_for_Null; /** * Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop. */ - noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration; + noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -1053,63 +1053,63 @@ export interface Style { /** * Disallow the use of arguments. */ - noArguments?: RuleConfiguration; + noArguments?: RuleConfiguration_for_Null; /** * Disallow comma operator. */ - noCommaOperator?: RuleConfiguration; + noCommaOperator?: RuleConfiguration_for_Null; /** * Disallow default exports. */ - noDefaultExport?: RuleConfiguration; + noDefaultExport?: RuleConfiguration_for_Null; /** * Disallow implicit true values on JSX boolean attributes */ - noImplicitBoolean?: RuleConfiguration; + noImplicitBoolean?: RuleConfiguration_for_Null; /** * Disallow type annotations for variables, parameters, and class properties initialized with a literal expression. */ - noInferrableTypes?: RuleConfiguration; + noInferrableTypes?: RuleConfiguration_for_Null; /** * Disallow the use of TypeScript's namespaces. */ - noNamespace?: RuleConfiguration; + noNamespace?: RuleConfiguration_for_Null; /** * Disallow negation in the condition of an if statement if it has an else clause. */ - noNegationElse?: RuleConfiguration; + noNegationElse?: RuleConfiguration_for_Null; /** * Disallow non-null assertions using the ! postfix operator. */ - noNonNullAssertion?: RuleConfiguration; + noNonNullAssertion?: RuleConfiguration_for_Null; /** * Disallow reassigning function parameters. */ - noParameterAssign?: RuleConfiguration; + noParameterAssign?: RuleConfiguration_for_Null; /** * Disallow the use of parameter properties in class constructors. */ - noParameterProperties?: RuleConfiguration; + noParameterProperties?: RuleConfiguration_for_Null; /** * This rule allows you to specify global variable names that you don’t want to use in your application. */ - noRestrictedGlobals?: RuleConfiguration; + noRestrictedGlobals?: RuleConfiguration_for_RestrictedGlobalsOptions; /** * Disallow the use of constants which its value is the upper-case version of its name. */ - noShoutyConstants?: RuleConfiguration; + noShoutyConstants?: RuleConfiguration_for_Null; /** * Disallow template literals if interpolation and special-character handling are not needed */ - noUnusedTemplateLiteral?: RuleConfiguration; + noUnusedTemplateLiteral?: RuleConfiguration_for_Null; /** * Disallow else block when the if block breaks early. */ - noUselessElse?: RuleConfiguration; + noUselessElse?: RuleConfiguration_for_Null; /** * Disallow the use of var */ - noVar?: RuleConfiguration; + noVar?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -1117,75 +1117,75 @@ export interface Style { /** * Enforce the use of as const over literal type and type annotation. */ - useAsConstAssertion?: RuleConfiguration; + useAsConstAssertion?: RuleConfiguration_for_Null; /** * Requires following curly brace conventions. */ - useBlockStatements?: RuleConfiguration; + useBlockStatements?: RuleConfiguration_for_Null; /** * Enforce using else if instead of nested if in else clauses. */ - useCollapsedElseIf?: RuleConfiguration; + useCollapsedElseIf?: RuleConfiguration_for_Null; /** * Require const declarations for variables that are never reassigned after declared. */ - useConst?: RuleConfiguration; + useConst?: RuleConfiguration_for_Null; /** * Enforce default function parameters and optional function parameters to be last. */ - useDefaultParameterLast?: RuleConfiguration; + useDefaultParameterLast?: RuleConfiguration_for_Null; /** * Require that each enum member value be explicitly initialized. */ - useEnumInitializers?: RuleConfiguration; + useEnumInitializers?: RuleConfiguration_for_Null; /** * Disallow the use of Math.pow in favor of the ** operator. */ - useExponentiationOperator?: RuleConfiguration; + useExponentiationOperator?: RuleConfiguration_for_Null; /** * This rule enforces the use of <>... over .... */ - useFragmentSyntax?: RuleConfiguration; + useFragmentSyntax?: RuleConfiguration_for_Null; /** * Require all enum members to be literal values. */ - useLiteralEnumMembers?: RuleConfiguration; + useLiteralEnumMembers?: RuleConfiguration_for_Null; /** * Enforce naming conventions for everything across a codebase. */ - useNamingConvention?: RuleConfiguration; + useNamingConvention?: RuleConfiguration_for_NamingConventionOptions; /** * Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals */ - useNumericLiterals?: RuleConfiguration; + useNumericLiterals?: RuleConfiguration_for_Null; /** * Prevent extra closing tags for components without children */ - useSelfClosingElements?: RuleConfiguration; + useSelfClosingElements?: RuleConfiguration_for_Null; /** * When expressing array types, this rule promotes the usage of T[] shorthand instead of Array. */ - useShorthandArrayType?: RuleConfiguration; + useShorthandArrayType?: RuleConfiguration_for_Null; /** * Require assignment operator shorthand where possible. */ - useShorthandAssign?: RuleConfiguration; + useShorthandAssign?: RuleConfiguration_for_Null; /** * Enforces switch clauses have a single statement, emits a quick fix wrapping the statements in a block. */ - useSingleCaseStatement?: RuleConfiguration; + useSingleCaseStatement?: RuleConfiguration_for_Null; /** * Disallow multiple variable declarations in the same variable statement */ - useSingleVarDeclarator?: RuleConfiguration; + useSingleVarDeclarator?: RuleConfiguration_for_Null; /** * Prefer template literals over string concatenation. */ - useTemplate?: RuleConfiguration; + useTemplate?: RuleConfiguration_for_Null; /** * Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed. */ - useWhile?: RuleConfiguration; + useWhile?: RuleConfiguration_for_Null; } /** * A list of rules that belong to this group @@ -1198,163 +1198,163 @@ export interface Suspicious { /** * Use standard constants instead of approximated literals. */ - noApproximativeNumericConstant?: RuleConfiguration; + noApproximativeNumericConstant?: RuleConfiguration_for_Null; /** * Discourage the usage of Array index in keys. */ - noArrayIndexKey?: RuleConfiguration; + noArrayIndexKey?: RuleConfiguration_for_Null; /** * Disallow assignments in expressions. */ - noAssignInExpressions?: RuleConfiguration; + noAssignInExpressions?: RuleConfiguration_for_Null; /** * Disallows using an async function as a Promise executor. */ - noAsyncPromiseExecutor?: RuleConfiguration; + noAsyncPromiseExecutor?: RuleConfiguration_for_Null; /** * Disallow reassigning exceptions in catch clauses. */ - noCatchAssign?: RuleConfiguration; + noCatchAssign?: RuleConfiguration_for_Null; /** * Disallow reassigning class members. */ - noClassAssign?: RuleConfiguration; + noClassAssign?: RuleConfiguration_for_Null; /** * Prevent comments from being inserted as text nodes */ - noCommentText?: RuleConfiguration; + noCommentText?: RuleConfiguration_for_Null; /** * Disallow comparing against -0 */ - noCompareNegZero?: RuleConfiguration; + noCompareNegZero?: RuleConfiguration_for_Null; /** * Disallow labeled statements that are not loops. */ - noConfusingLabels?: RuleConfiguration; + noConfusingLabels?: RuleConfiguration_for_Null; /** * Disallow void type outside of generic or return types. */ - noConfusingVoidType?: RuleConfiguration; + noConfusingVoidType?: RuleConfiguration_for_Null; /** * Disallow the use of console.log */ - noConsoleLog?: RuleConfiguration; + noConsoleLog?: RuleConfiguration_for_Null; /** * Disallow TypeScript const enum */ - noConstEnum?: RuleConfiguration; + noConstEnum?: RuleConfiguration_for_Null; /** * Prevents from having control characters and some escape sequences that match control characters in regular expressions. */ - noControlCharactersInRegex?: RuleConfiguration; + noControlCharactersInRegex?: RuleConfiguration_for_Null; /** * Disallow the use of debugger */ - noDebugger?: RuleConfiguration; + noDebugger?: RuleConfiguration_for_Null; /** * Require the use of === and !== */ - noDoubleEquals?: RuleConfiguration; + noDoubleEquals?: RuleConfiguration_for_Null; /** * Disallow duplicate case labels. */ - noDuplicateCase?: RuleConfiguration; + noDuplicateCase?: RuleConfiguration_for_Null; /** * Disallow duplicate class members. */ - noDuplicateClassMembers?: RuleConfiguration; + noDuplicateClassMembers?: RuleConfiguration_for_Null; /** * Prevents JSX properties to be assigned multiple times. */ - noDuplicateJsxProps?: RuleConfiguration; + noDuplicateJsxProps?: RuleConfiguration_for_Null; /** * Prevents object literals having more than one property declaration for the same name. */ - noDuplicateObjectKeys?: RuleConfiguration; + noDuplicateObjectKeys?: RuleConfiguration_for_Null; /** * Disallow duplicate function parameter name. */ - noDuplicateParameters?: RuleConfiguration; + noDuplicateParameters?: RuleConfiguration_for_Null; /** * Disallow the declaration of empty interfaces. */ - noEmptyInterface?: RuleConfiguration; + noEmptyInterface?: RuleConfiguration_for_Null; /** * Disallow the any type usage. */ - noExplicitAny?: RuleConfiguration; + noExplicitAny?: RuleConfiguration_for_Null; /** * Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files. */ - noExtraNonNullAssertion?: RuleConfiguration; + noExtraNonNullAssertion?: RuleConfiguration_for_Null; /** * Disallow fallthrough of switch clauses. */ - noFallthroughSwitchClause?: RuleConfiguration; + noFallthroughSwitchClause?: RuleConfiguration_for_Null; /** * Disallow reassigning function declarations. */ - noFunctionAssign?: RuleConfiguration; + noFunctionAssign?: RuleConfiguration_for_Null; /** * Use Number.isFinite instead of global isFinite. */ - noGlobalIsFinite?: RuleConfiguration; + noGlobalIsFinite?: RuleConfiguration_for_Null; /** * Use Number.isNaN instead of global isNaN. */ - noGlobalIsNan?: RuleConfiguration; + noGlobalIsNan?: RuleConfiguration_for_Null; /** * Disallow use of implicit any type on variable declarations. */ - noImplicitAnyLet?: RuleConfiguration; + noImplicitAnyLet?: RuleConfiguration_for_Null; /** * Disallow assigning to imported bindings */ - noImportAssign?: RuleConfiguration; + noImportAssign?: RuleConfiguration_for_Null; /** * Disallow labels that share a name with a variable */ - noLabelVar?: RuleConfiguration; + noLabelVar?: RuleConfiguration_for_Null; /** * Enforce proper usage of new and constructor. */ - noMisleadingInstantiator?: RuleConfiguration; + noMisleadingInstantiator?: RuleConfiguration_for_Null; /** * Disallow shorthand assign when variable appears on both sides. */ - noMisrefactoredShorthandAssign?: RuleConfiguration; + noMisrefactoredShorthandAssign?: RuleConfiguration_for_Null; /** * Disallow direct use of Object.prototype builtins. */ - noPrototypeBuiltins?: RuleConfiguration; + noPrototypeBuiltins?: RuleConfiguration_for_Null; /** * Disallow variable, function, class, and type redeclarations in the same scope. */ - noRedeclare?: RuleConfiguration; + noRedeclare?: RuleConfiguration_for_Null; /** * Prevents from having redundant "use strict". */ - noRedundantUseStrict?: RuleConfiguration; + noRedundantUseStrict?: RuleConfiguration_for_Null; /** * Disallow comparisons where both sides are exactly the same. */ - noSelfCompare?: RuleConfiguration; + noSelfCompare?: RuleConfiguration_for_Null; /** * Disallow identifiers from shadowing restricted names. */ - noShadowRestrictedNames?: RuleConfiguration; + noShadowRestrictedNames?: RuleConfiguration_for_Null; /** * Disallow sparse arrays */ - noSparseArray?: RuleConfiguration; + noSparseArray?: RuleConfiguration_for_Null; /** * Disallow unsafe declaration merging between interfaces and classes. */ - noUnsafeDeclarationMerging?: RuleConfiguration; + noUnsafeDeclarationMerging?: RuleConfiguration_for_Null; /** * Disallow using unsafe negation. */ - noUnsafeNegation?: RuleConfiguration; + noUnsafeNegation?: RuleConfiguration_for_Null; /** * It enables the recommended rules for this group */ @@ -1362,23 +1362,23 @@ export interface Suspicious { /** * Enforce default clauses in switch statements to be last */ - useDefaultSwitchClauseLast?: RuleConfiguration; + useDefaultSwitchClauseLast?: RuleConfiguration_for_Null; /** * Enforce get methods to always return a value. */ - useGetterReturn?: RuleConfiguration; + useGetterReturn?: RuleConfiguration_for_Null; /** * Use Array.isArray() instead of instanceof Array. */ - useIsArray?: RuleConfiguration; + useIsArray?: RuleConfiguration_for_Null; /** * Require using the namespace keyword over the module keyword to declare TypeScript namespaces. */ - useNamespaceKeyword?: RuleConfiguration; + useNamespaceKeyword?: RuleConfiguration_for_Null; /** * This rule verifies the result of typeof $expr unary expressions is being compared to valid values, either string literals containing valid type names or other typeof expressions */ - useValidTypeof?: RuleConfiguration; + useValidTypeof?: RuleConfiguration_for_Null; } export interface OverrideFormatterConfiguration { /** @@ -1427,23 +1427,88 @@ export interface OverrideOrganizeImportsConfiguration { */ enabled?: boolean; } -export type RuleConfiguration = RulePlainConfiguration | RuleWithOptions; +export type RuleConfiguration_for_Null = + | RulePlainConfiguration + | RuleWithOptions_for_Null; +export type RuleConfiguration_for_ValidAriaRoleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_ValidAriaRoleOptions; +export type RuleConfiguration_for_ComplexityOptions = + | RulePlainConfiguration + | RuleWithOptions_for_ComplexityOptions; +export type RuleConfiguration_for_HooksOptions = + | RulePlainConfiguration + | RuleWithOptions_for_HooksOptions; +export type RuleConfiguration_for_DeprecatedHooksOptions = + | RulePlainConfiguration + | RuleWithOptions_for_DeprecatedHooksOptions; +export type RuleConfiguration_for_RestrictedImportsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_RestrictedImportsOptions; +export type RuleConfiguration_for_ConsistentArrayTypeOptions = + | RulePlainConfiguration + | RuleWithOptions_for_ConsistentArrayTypeOptions; +export type RuleConfiguration_for_FilenamingConventionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_FilenamingConventionOptions; +export type RuleConfiguration_for_UtilityClassSortingOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UtilityClassSortingOptions; +export type RuleConfiguration_for_RestrictedGlobalsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_RestrictedGlobalsOptions; +export type RuleConfiguration_for_NamingConventionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NamingConventionOptions; export type RulePlainConfiguration = "warn" | "error" | "off"; -export interface RuleWithOptions { +export interface RuleWithOptions_for_Null { level: RulePlainConfiguration; - options?: PossibleOptions; -} -export type PossibleOptions = - | ComplexityOptions - | ConsistentArrayTypeOptions - | FilenamingConventionOptions - | HooksOptions - | DeprecatedHooksOptions - | NamingConventionOptions - | RestrictedGlobalsOptions - | RestrictedImportsOptions - | ValidAriaRoleOptions - | UtilityClassSortingOptions; + options: null; +} +export interface RuleWithOptions_for_ValidAriaRoleOptions { + level: RulePlainConfiguration; + options: ValidAriaRoleOptions; +} +export interface RuleWithOptions_for_ComplexityOptions { + level: RulePlainConfiguration; + options: ComplexityOptions; +} +export interface RuleWithOptions_for_HooksOptions { + level: RulePlainConfiguration; + options: HooksOptions; +} +export interface RuleWithOptions_for_DeprecatedHooksOptions { + level: RulePlainConfiguration; + options: DeprecatedHooksOptions; +} +export interface RuleWithOptions_for_RestrictedImportsOptions { + level: RulePlainConfiguration; + options: RestrictedImportsOptions; +} +export interface RuleWithOptions_for_ConsistentArrayTypeOptions { + level: RulePlainConfiguration; + options: ConsistentArrayTypeOptions; +} +export interface RuleWithOptions_for_FilenamingConventionOptions { + level: RulePlainConfiguration; + options: FilenamingConventionOptions; +} +export interface RuleWithOptions_for_UtilityClassSortingOptions { + level: RulePlainConfiguration; + options: UtilityClassSortingOptions; +} +export interface RuleWithOptions_for_RestrictedGlobalsOptions { + level: RulePlainConfiguration; + options: RestrictedGlobalsOptions; +} +export interface RuleWithOptions_for_NamingConventionOptions { + level: RulePlainConfiguration; + options: NamingConventionOptions; +} +export interface ValidAriaRoleOptions { + allowInvalidRoles: string[]; + ignoreNonDom: boolean; +} /** * Options for the rule `noExcessiveCognitiveComplexity`. */ @@ -1453,26 +1518,6 @@ export interface ComplexityOptions { */ maxAllowedComplexity: number; } -export interface ConsistentArrayTypeOptions { - syntax: ConsistentArrayType; -} -/** - * Rule's options. - */ -export interface FilenamingConventionOptions { - /** - * Allowed cases for _TypeScript_ `enum` member names. - */ - filenameCases: FilenameCases; - /** - * If `false`, then non-ASCII characters are allowed. - */ - requireAscii: boolean; - /** - * If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case]. - */ - strictCase: boolean; -} /** * Options for the rule `useExhaustiveDependencies` */ @@ -1486,14 +1531,26 @@ export interface HooksOptions { * Options for the `useHookAtTopLevel` rule have been deprecated, since we now use the React hook naming convention to determine whether a function is a hook. */ export interface DeprecatedHooksOptions {} +/** + * Options for the rule `noRestrictedImports`. + */ +export interface RestrictedImportsOptions { + /** + * A list of names that should trigger the rule + */ + paths: {}; +} +export interface ConsistentArrayTypeOptions { + syntax: ConsistentArrayType; +} /** * Rule's options. */ -export interface NamingConventionOptions { +export interface FilenamingConventionOptions { /** * Allowed cases for _TypeScript_ `enum` member names. */ - enumMemberCase: EnumMemberCase; + filenameCases: FilenameCases; /** * If `false`, then non-ASCII characters are allowed. */ @@ -1503,6 +1560,16 @@ export interface NamingConventionOptions { */ strictCase: boolean; } +export interface UtilityClassSortingOptions { + /** + * Additional attributes that will be sorted. + */ + attributes?: string[]; + /** + * Names of the functions or tagged templates that will be sorted. + */ + functions?: string[]; +} /** * Options for the rule `noRestrictedGlobals`. */ @@ -1513,30 +1580,22 @@ export interface RestrictedGlobalsOptions { deniedGlobals: string[]; } /** - * Options for the rule `noRestrictedImports`. + * Rule's options. */ -export interface RestrictedImportsOptions { +export interface NamingConventionOptions { /** - * A list of names that should trigger the rule + * Allowed cases for _TypeScript_ `enum` member names. */ - paths: {}; -} -export interface ValidAriaRoleOptions { - allowInvalidRoles: string[]; - ignoreNonDom: boolean; -} -export interface UtilityClassSortingOptions { + enumMemberCase: EnumMemberCase; /** - * Additional attributes that will be sorted. + * If `false`, then non-ASCII characters are allowed. */ - attributes?: string[]; + requireAscii: boolean; /** - * Names of the functions or tagged templates that will be sorted. + * If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case]. */ - functions?: string[]; + strictCase: boolean; } -export type ConsistentArrayType = "shorthand" | "generic"; -export type FilenameCases = FilenameCase[]; export interface Hooks { /** * The "position" of the closure function, starting from zero. @@ -1553,6 +1612,8 @@ export interface Hooks { */ name: string; } +export type ConsistentArrayType = "shorthand" | "generic"; +export type FilenameCases = FilenameCase[]; /** * Supported cases for TypeScript `enum` member names. */ diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json index 2ad8b0985fc8..69820a99f6c9 100644 --- a/packages/@biomejs/biome/configuration_schema.json +++ b/packages/@biomejs/biome/configuration_schema.json @@ -276,7 +276,7 @@ "useValidAriaRole": { "description": "Elements with ARIA roles must use a valid, non-abstract ARIA role.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/ValidAriaRoleConfiguration" }, { "type": "null" } ] }, @@ -316,7 +316,7 @@ "noExcessiveCognitiveComplexity": { "description": "Disallow functions that exceed a given Cognitive Complexity score.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/ComplexityConfiguration" }, { "type": "null" } ] }, @@ -487,6 +487,12 @@ } } }, + "ComplexityConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithComplexityOptions" } + ] + }, "ComplexityOptions": { "description": "Options for the rule `noExcessiveCognitiveComplexity`.", "type": "object", @@ -515,6 +521,12 @@ } ] }, + "ConsistentArrayTypeConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithConsistentArrayTypeOptions" } + ] + }, "ConsistentArrayTypeOptions": { "type": "object", "required": ["syntax"], @@ -734,14 +746,14 @@ "useExhaustiveDependencies": { "description": "Enforce all dependencies are correctly specified in a React hook.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/HooksConfiguration" }, { "type": "null" } ] }, "useHookAtTopLevel": { "description": "Enforce that all React hooks are being called from the Top Level component functions.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/DeprecatedHooksConfiguration" }, { "type": "null" } ] }, @@ -837,6 +849,12 @@ }, "additionalProperties": false }, + "DeprecatedHooksConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithDeprecatedHooksOptions" } + ] + }, "DeprecatedHooksOptions": { "description": "Options for the `useHookAtTopLevel` rule have been deprecated, since we now use the React hook naming convention to determine whether a function is a hook.", "type": "object", @@ -889,6 +907,12 @@ "items": { "$ref": "#/definitions/FilenameCase" }, "uniqueItems": true }, + "FilenamingConventionConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithFilenamingConventionOptions" } + ] + }, "FilenamingConventionOptions": { "description": "Rule's options.", "type": "object", @@ -1007,6 +1031,12 @@ }, "additionalProperties": false }, + "HooksConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithHooksOptions" } + ] + }, "HooksOptions": { "description": "Options for the rule `useExhaustiveDependencies`", "type": "object", @@ -1269,6 +1299,12 @@ }, "additionalProperties": false }, + "NamingConventionConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithNamingConventionOptions" } + ] + }, "NamingConventionOptions": { "description": "Rule's options.", "type": "object", @@ -1383,7 +1419,7 @@ "noRestrictedImports": { "description": "Disallow specified modules when loaded by import or require.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/RestrictedImportsConfiguration" }, { "type": "null" } ] }, @@ -1450,7 +1486,7 @@ "useConsistentArrayType": { "description": "Require consistently using either T[] or Array", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/ConsistentArrayTypeConfiguration" }, { "type": "null" } ] }, @@ -1464,7 +1500,7 @@ "useFilenamingConvention": { "description": "Enforce naming conventions for JavaScript and TypeScript filenames.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/FilenamingConventionConfiguration" }, { "type": "null" } ] }, @@ -1527,7 +1563,7 @@ "useSortedClasses": { "description": "Enforce the sorting of CSS utility classes.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UtilityClassSortingConfiguration" }, { "type": "null" } ] } @@ -1717,52 +1753,14 @@ { "description": "Space", "type": "string", "enum": ["space"] } ] }, - "PossibleOptions": { + "QuoteProperties": { "type": "string", "enum": ["asNeeded", "preserve"] }, + "QuoteStyle": { "type": "string", "enum": ["double", "single"] }, + "RestrictedGlobalsConfiguration": { "anyOf": [ - { - "description": "Options for `noExcessiveComplexity` rule", - "allOf": [{ "$ref": "#/definitions/ComplexityOptions" }] - }, - { - "description": "Options for `useConsistentArrayType` rule", - "allOf": [{ "$ref": "#/definitions/ConsistentArrayTypeOptions" }] - }, - { - "description": "Options for `useFilenamingConvention` rule", - "allOf": [{ "$ref": "#/definitions/FilenamingConventionOptions" }] - }, - { - "description": "Options for `useExhaustiveDependencies` rule", - "allOf": [{ "$ref": "#/definitions/HooksOptions" }] - }, - { - "description": "Deprecated options for `useHookAtTopLevel` rule", - "allOf": [{ "$ref": "#/definitions/DeprecatedHooksOptions" }] - }, - { - "description": "Options for `useNamingConvention` rule", - "allOf": [{ "$ref": "#/definitions/NamingConventionOptions" }] - }, - { - "description": "Options for `noRestrictedGlobals` rule", - "allOf": [{ "$ref": "#/definitions/RestrictedGlobalsOptions" }] - }, - { - "description": "Options for `noRestrictedImports` rule", - "allOf": [{ "$ref": "#/definitions/RestrictedImportsOptions" }] - }, - { - "description": "Options for `useValidAriaRole` rule", - "allOf": [{ "$ref": "#/definitions/ValidAriaRoleOptions" }] - }, - { - "description": "Options for `useSortedClasses` rule", - "allOf": [{ "$ref": "#/definitions/UtilityClassSortingOptions" }] - } + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithRestrictedGlobalsOptions" } ] }, - "QuoteProperties": { "type": "string", "enum": ["asNeeded", "preserve"] }, - "QuoteStyle": { "type": "string", "enum": ["double", "single"] }, "RestrictedGlobalsOptions": { "description": "Options for the rule `noRestrictedGlobals`.", "type": "object", @@ -1776,6 +1774,12 @@ }, "additionalProperties": false }, + "RestrictedImportsConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithRestrictedImportsOptions" } + ] + }, "RestrictedImportsOptions": { "description": "Options for the rule `noRestrictedImports`.", "type": "object", @@ -1792,24 +1796,109 @@ "RuleConfiguration": { "anyOf": [ { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithOptions" } + { "$ref": "#/definitions/RuleWithNoOptions" } ] }, "RulePlainConfiguration": { "type": "string", "enum": ["warn", "error", "off"] }, - "RuleWithOptions": { + "RuleWithComplexityOptions": { "type": "object", - "required": ["level"], + "required": ["level", "options"], "properties": { "level": { "$ref": "#/definitions/RulePlainConfiguration" }, - "options": { - "anyOf": [ - { "$ref": "#/definitions/PossibleOptions" }, - { "type": "null" } - ] - } + "options": { "$ref": "#/definitions/ComplexityOptions" } + }, + "additionalProperties": false + }, + "RuleWithConsistentArrayTypeOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/ConsistentArrayTypeOptions" } + }, + "additionalProperties": false + }, + "RuleWithDeprecatedHooksOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/DeprecatedHooksOptions" } + }, + "additionalProperties": false + }, + "RuleWithFilenamingConventionOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/FilenamingConventionOptions" } + }, + "additionalProperties": false + }, + "RuleWithHooksOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/HooksOptions" } + }, + "additionalProperties": false + }, + "RuleWithNamingConventionOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/NamingConventionOptions" } + }, + "additionalProperties": false + }, + "RuleWithNoOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "type": "null" } + }, + "additionalProperties": false + }, + "RuleWithRestrictedGlobalsOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/RestrictedGlobalsOptions" } + }, + "additionalProperties": false + }, + "RuleWithRestrictedImportsOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/RestrictedImportsOptions" } + }, + "additionalProperties": false + }, + "RuleWithUtilityClassSortingOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/UtilityClassSortingOptions" } + }, + "additionalProperties": false + }, + "RuleWithValidAriaRoleOptions": { + "type": "object", + "required": ["level", "options"], + "properties": { + "level": { "$ref": "#/definitions/RulePlainConfiguration" }, + "options": { "$ref": "#/definitions/ValidAriaRoleOptions" } }, "additionalProperties": false }, @@ -1966,7 +2055,7 @@ "noRestrictedGlobals": { "description": "This rule allows you to specify global variable names that you don’t want to use in your application.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/RestrictedGlobalsConfiguration" }, { "type": "null" } ] }, @@ -2068,7 +2157,7 @@ "useNamingConvention": { "description": "Enforce naming conventions for everything across a codebase.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NamingConventionConfiguration" }, { "type": "null" } ] }, @@ -2479,6 +2568,12 @@ } ] }, + "UtilityClassSortingConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithUtilityClassSortingOptions" } + ] + }, "UtilityClassSortingOptions": { "type": "object", "properties": { @@ -2495,6 +2590,12 @@ }, "additionalProperties": false }, + "ValidAriaRoleConfiguration": { + "anyOf": [ + { "$ref": "#/definitions/RulePlainConfiguration" }, + { "$ref": "RuleWithValidAriaRoleOptions" } + ] + }, "ValidAriaRoleOptions": { "type": "object", "required": ["allowInvalidRoles", "ignoreNonDom"], diff --git a/xtask/codegen/src/ast.rs b/xtask/codegen/src/ast.rs index 6b1900ba2770..8dba434c3324 100644 --- a/xtask/codegen/src/ast.rs +++ b/xtask/codegen/src/ast.rs @@ -491,7 +491,7 @@ fn handle_comma_list<'a>(grammar: &'a Grammar, rules: &[Rule]) -> Option return None, }; - // Does the repeat match (token node)) + // Does the repeat match (token) let comma = match repeat.as_slice() { [comma, Rule::Node(n)] => { let separator_matches_trailing = if let Some(trailing) = trailing_separator { diff --git a/xtask/codegen/src/generate_analyzer.rs b/xtask/codegen/src/generate_analyzer.rs index d69c88205c4f..2de65ae1e8d6 100644 --- a/xtask/codegen/src/generate_analyzer.rs +++ b/xtask/codegen/src/generate_analyzer.rs @@ -1,12 +1,13 @@ -use std::collections::BTreeMap; use std::path::PathBuf; +use std::{collections::BTreeMap, path::Path}; use anyhow::{Context, Ok, Result}; -use case::CaseExt; use proc_macro2::{Punct, Spacing, TokenStream}; use quote::{format_ident, quote}; use xtask::{glue::fs2, project_root}; +use crate::to_pascal_case; + pub fn generate_analyzer() -> Result<()> { generate_js_analyzer()?; generate_json_analyzer()?; @@ -17,23 +18,24 @@ pub fn generate_analyzer() -> Result<()> { fn generate_js_analyzer() -> Result<()> { let base_path = project_root().join("crates/biome_js_analyze/src"); let mut analyzers = BTreeMap::new(); - generate_category("analyzers", &mut analyzers, base_path.clone())?; + generate_category("analyzers", &mut analyzers, &base_path)?; let mut semantic_analyzers = BTreeMap::new(); - generate_category( - "semantic_analyzers", - &mut semantic_analyzers, - base_path.clone(), - )?; + generate_category("semantic_analyzers", &mut semantic_analyzers, &base_path)?; let mut aria_analyzers = BTreeMap::new(); - generate_category("aria_analyzers", &mut aria_analyzers, base_path.clone())?; + generate_category("aria_analyzers", &mut aria_analyzers, &base_path)?; let mut assists = BTreeMap::new(); - generate_category("assists", &mut assists, base_path.clone())?; + generate_category("assists", &mut assists, &base_path)?; let mut syntax = BTreeMap::new(); - generate_category("syntax", &mut syntax, base_path)?; + generate_category("syntax", &mut syntax, &base_path)?; + + generate_options( + &["aria_analyzers", "analyzers", "semantic_analyzers"], + &base_path, + )?; update_js_registry_builder( analyzers, @@ -45,12 +47,11 @@ fn generate_js_analyzer() -> Result<()> { } fn generate_json_analyzer() -> Result<()> { + let base_path = project_root().join("crates/biome_json_analyze/src"); let mut analyzers = BTreeMap::new(); - generate_category( - "analyzers", - &mut analyzers, - project_root().join("crates/biome_json_analyze/src"), - )?; + generate_category("analyzers", &mut analyzers, &base_path)?; + + generate_options(&["analyzers"], &base_path)?; update_css_registry_builder(analyzers) } @@ -60,16 +61,47 @@ fn generate_css_analyzer() -> Result<()> { generate_category( "analyzers", &mut analyzers, - project_root().join("crates/biome_css_analyze/src"), + &(project_root().join("crates/biome_css_analyze/src")), )?; update_json_registry_builder(analyzers) } +fn generate_options(categories: &[&str], base_path: &Path) -> Result<()> { + let mut category_names = Vec::with_capacity(categories.len()); + let mut rules_options = BTreeMap::new(); + let nl = Punct::new('\n', Spacing::Alone); + for category in categories { + let category_path = base_path.join(category); + let category_name = format_ident!("{}", filename(&category_path)?); + category_names.push(category_name.clone()); + for group_path in list_entry_paths(&category_path)?.filter(|path| path.is_dir()) { + let group_name = format_ident!("{}", filename(&group_path)?.to_string()); + for rule_path in list_entry_paths(&group_path)?.filter(|path| !path.is_dir()) { + let rule_filename = filename(&rule_path)?; + let rule_name = to_pascal_case(rule_filename); + let rule_module_name = format_ident!("{}", rule_filename); + let rule_name = format_ident!("{}", rule_name); + rules_options.insert(rule_filename.to_string(), quote! { + pub type #rule_name = <#category_name::#group_name::#rule_module_name::#rule_name as biome_analyze::Rule>::Options; + }); + } + } + } + let rules_options = rules_options.values(); + let tokens = xtask::reformat(quote! { + #( use crate::#category_names; )* #nl #nl + + #( #rules_options )* + })?; + fs2::write(base_path.join("options.rs"), tokens)?; + Ok(()) +} + fn generate_category( name: &'static str, entries: &mut BTreeMap<&'static str, TokenStream>, - base_path: PathBuf, + base_path: &Path, ) -> Result<()> { let path = base_path.join(name); @@ -87,16 +119,16 @@ fn generate_category( .to_str() .context("could not convert file name to string")?; - generate_group(name, file_name, base_path.clone())?; + generate_group(name, file_name, base_path)?; let module_name = format_ident!("{}", file_name); - let group_name = format_ident!("{}", to_pascal_case(file_name)?); + let group_name = format_ident!("{}", to_pascal_case(file_name)); groups.insert( file_name.to_string(), ( quote! { - pub(crate) mod #module_name; + pub mod #module_name; }, quote! { self::#module_name::#group_name @@ -108,7 +140,7 @@ fn generate_category( let key = name; let module_name = format_ident!("{name}"); - let category_name = to_pascal_case(name).unwrap(); + let category_name = to_pascal_case(name); let category_name = format_ident!("{category_name}"); let kind = match name { @@ -129,7 +161,7 @@ fn generate_category( let tokens = xtask::reformat(quote! { #( #modules )* ::biome_analyze::declare_category! { - pub(crate) #category_name { + pub #category_name { kind: #kind, groups: [ #( #paths, )* @@ -143,7 +175,7 @@ fn generate_category( Ok(()) } -fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Result<()> { +fn generate_group(category: &'static str, group: &str, base_path: &Path) -> Result<()> { let path = base_path.join(category).join(group); let mut rules = BTreeMap::new(); @@ -155,7 +187,7 @@ fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Re .to_str() .context("could not convert file name to string")?; - let rule_type = file_name.to_camel(); + let rule_type = to_pascal_case(file_name); let key = rule_type.clone(); let module_name = format_ident!("{}", file_name); @@ -165,7 +197,7 @@ fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Re key, ( quote! { - pub(crate) mod #module_name; + pub mod #module_name; }, quote! { self::#module_name::#rule_type @@ -174,7 +206,7 @@ fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Re ); } - let group_name = format_ident!("{}", to_pascal_case(group)?); + let group_name = format_ident!("{}", to_pascal_case(group)); let (rule_imports, rule_names): (Vec<_>, Vec<_>) = rules.into_values().unzip(); @@ -187,7 +219,7 @@ fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Re #( #rule_imports )* #nl #nl declare_group! { #nl - #sp4 pub(crate) #group_name { #nl + #sp4 pub #group_name { #nl #sp4 #sp4 name: #group, #nl #sp4 #sp4 rules: [ #nl #( #sp4 #sp4 #sp4 #rule_names, #nl )* @@ -201,26 +233,6 @@ fn generate_group(category: &'static str, group: &str, base_path: PathBuf) -> Re Ok(()) } -fn to_pascal_case(input: &str) -> Result { - let mut result = String::new(); - let mut chars = input.char_indices(); - - while let Some((index, mut char)) = chars.next() { - if index == 0 { - char = char.to_ascii_uppercase(); - } - - if char == '_' { - let (_, next_char) = chars.next().context("iterator is empty")?; - char = next_char.to_ascii_uppercase(); - } - - result.push(char); - } - - Ok(result) -} - fn update_js_registry_builder( analyzers: BTreeMap<&'static str, TokenStream>, semantic_analyzers: BTreeMap<&'static str, TokenStream>, @@ -270,6 +282,7 @@ fn update_json_registry_builder(analyzers: BTreeMap<&'static str, TokenStream>) Ok(()) } + fn update_css_registry_builder(analyzers: BTreeMap<&'static str, TokenStream>) -> Result<()> { let path = project_root().join("crates/biome_css_analyze/src/registry.rs"); @@ -288,3 +301,19 @@ fn update_css_registry_builder(analyzers: BTreeMap<&'static str, TokenStream>) - Ok(()) } + +/// Returns file paths of the given directory. +fn list_entry_paths(dir: &Path) -> Result> { + Ok(fs2::read_dir(dir) + .context("A directory is expected")? + .filter_map(|entry| entry.ok()) + .map(|entry| entry.path())) +} + +/// Returns filename if any. +fn filename(file: &Path) -> Result<&str> { + file.file_stem() + .context("path has no file name")? + .to_str() + .context("could not convert file name to string") +} diff --git a/xtask/codegen/src/generate_bindings.rs b/xtask/codegen/src/generate_bindings.rs index f503cf3a0f93..9439fb16d8ef 100644 --- a/xtask/codegen/src/generate_bindings.rs +++ b/xtask/codegen/src/generate_bindings.rs @@ -10,7 +10,7 @@ use biome_js_syntax::{ use biome_rowan::AstNode; use biome_service::workspace_types::{generate_type, methods, ModuleQueue}; use xtask::{project_root, Mode, Result}; -use xtask_codegen::{to_camel_case, update}; +use xtask_codegen::{to_lower_camel_case, update}; pub(crate) fn generate_workspace_bindings(mode: Mode) -> Result<()> { let bindings_path = project_root().join("packages/@biomejs/backend-jsonrpc/src/workspace.ts"); @@ -25,7 +25,7 @@ pub(crate) fn generate_workspace_bindings(mode: Mode) -> Result<()> { let params = generate_type(&mut declarations, &mut queue, &method.params); let result = generate_type(&mut declarations, &mut queue, &method.result); - let camel_case = to_camel_case(method.name); + let camel_case = to_lower_camel_case(method.name); member_definitions.push(AnyTsTypeMember::TsMethodSignatureTypeMember( make::ts_method_signature_type_member( diff --git a/xtask/codegen/src/generate_configuration.rs b/xtask/codegen/src/generate_configuration.rs index e0e3ab7b0e2e..b221fc5bb257 100644 --- a/xtask/codegen/src/generate_configuration.rs +++ b/xtask/codegen/src/generate_configuration.rs @@ -3,13 +3,12 @@ use biome_analyze::{ }; use biome_js_syntax::JsLanguage; use biome_json_syntax::JsonLanguage; -use case::CaseExt; use proc_macro2::{Ident, Literal, Span, TokenStream}; use pulldown_cmark::{Event, Parser, Tag}; use quote::quote; use std::collections::BTreeMap; use xtask::*; -use xtask_codegen::{to_lower_snake_case, update}; +use xtask_codegen::{to_capitalized, to_lower_snake_case, update}; pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { let config_root = project_root().join("crates/biome_service/src/configuration/linter"); @@ -77,7 +76,7 @@ pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { for (group, rules) in groups { group_name_list.push(group); let property_group_name = Ident::new(&to_lower_snake_case(group), Span::call_site()); - let group_struct_name = Ident::new(&group.to_capitalized(), Span::call_site()); + let group_struct_name = Ident::new(&to_capitalized(group), Span::call_site()); let group_name_string_literal = Literal::string(group); struct_groups.push(generate_struct(group, &rules)); @@ -116,7 +115,7 @@ pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { .#property_group_name .as_ref() .and_then(|#property_group_name| #property_group_name.get_rule_configuration(rule_name)) - .map(|rule_setting| rule_setting.into()) + .map(|(level, _)| level.into()) .unwrap_or_else(|| { if #group_struct_name::is_recommended_rule(rule_name) { Severity::Error @@ -132,17 +131,21 @@ pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { let groups = quote! { use crate::RuleConfiguration; - use biome_analyze::RuleFilter; + use biome_analyze::{options::RuleOptions, RuleFilter}; use biome_console::markup; use biome_deserialize::{DeserializableValidator, DeserializationDiagnostic}; use biome_deserialize_macros::{Deserializable, Merge}; use biome_diagnostics::{Category, Severity}; + use biome_js_analyze::options::*; + use biome_json_analyze::options::*; use biome_rowan::TextRange; use indexmap::IndexSet; use serde::{Deserialize, Serialize}; #[cfg(feature = "schema")] use schemars::JsonSchema; + use super::RulePlainConfiguration; + #[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, Merge, PartialEq, Serialize)] #[deserializable(with_validator)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -255,7 +258,7 @@ pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { let push_rules = quote! { use crate::configuration::linter::*; - use crate::{RuleConfiguration, Rules}; + use crate::Rules; use biome_analyze::{AnalyzerRules, MetadataRegistry}; pub(crate) fn push_to_analyzer_rules( @@ -289,7 +292,6 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> let mut lines_recommended_rule = Vec::new(); let mut lines_recommended_rule_as_filter = Vec::new(); let mut lines_all_rule_as_filter = Vec::new(); - let mut declarations = Vec::new(); let mut lines_rule = Vec::new(); let mut schema_lines_rules = Vec::new(); let mut rule_enabled_check_line = Vec::new(); @@ -344,11 +346,7 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> let rule_position = Literal::u8_unsuffixed(index as u8); let rule_identifier = Ident::new(&to_lower_snake_case(rule), Span::call_site()); - let declaration = quote! { - #[serde(skip_serializing_if = "RuleConfiguration::is_err")] - pub #rule_identifier: RuleConfiguration - }; - declarations.push(declaration); + let rule_name = Ident::new(&to_capitalized(rule), Span::call_site()); if metadata.recommended { lines_recommended_rule_as_filter.push(quote! { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[#rule_position]) @@ -368,7 +366,7 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> schema_lines_rules.push(quote! { #[doc = #summary] #[serde(skip_serializing_if = "Option::is_none")] - pub #rule_identifier: Option + pub #rule_identifier: Option> }); rule_enabled_check_line.push(quote! { @@ -393,11 +391,11 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> }); get_rule_configuration_line.push(quote! { - #rule => self.#rule_identifier.as_ref() + #rule => self.#rule_identifier.as_ref().map(|conf| (conf.level(), conf.get_options())) }); } - let group_struct_name = Ident::new(&group.to_capitalized(), Span::call_site()); + let group_struct_name = Ident::new(&to_capitalized(group), Span::call_site()); let number_of_recommended_rules = Literal::u8_unsuffixed(number_of_recommended_rules); let (group_recommended, parent_parameter) = if group == "nursery" { @@ -536,7 +534,7 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> } } - pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { + pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<(RulePlainConfiguration, Option)> { match rule_name { #( #get_rule_configuration_line ),*, _ => None @@ -547,19 +545,14 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) -> } fn generate_push_to_analyzer_rules(group: &str) -> TokenStream { - let group_struct_name = Ident::new(&group.to_capitalized(), Span::call_site()); + let group_struct_name = Ident::new(&to_capitalized(group), Span::call_site()); let group_identifier = Ident::new(group, Span::call_site()); quote! { if let Some(rules) = rules.#group_identifier.as_ref() { for rule_name in &#group_struct_name::GROUP_RULES { - if let Some(RuleConfiguration::WithOptions(rule_options)) = - rules.get_rule_configuration(rule_name) - { - if let Some(possible_options) = &rule_options.options { - if let Some(rule_key) = metadata.find_rule(#group, rule_name) { - let rule_options = possible_options.extract_option(&rule_key); + if let Some((_, Some(rule_options))) = rules.get_rule_configuration(rule_name) { + if let Some(rule_key) = metadata.find_rule(#group, rule_name) { analyzer_rules.push_rule(rule_key, rule_options); - } } } } diff --git a/xtask/codegen/src/generate_new_lintrule.rs b/xtask/codegen/src/generate_new_lintrule.rs index c0a2efa41ec2..69c81d883fe6 100644 --- a/xtask/codegen/src/generate_new_lintrule.rs +++ b/xtask/codegen/src/generate_new_lintrule.rs @@ -51,7 +51,7 @@ declare_rule! {{ /// var a = 1; /// ``` /// - pub(crate) {rule_name_upper_camel} {{ + pub {rule_name_upper_camel} {{ version: "next", name: "{rule_name_lower_camel}", recommended: false, diff --git a/xtask/codegen/src/generate_node_factory.rs b/xtask/codegen/src/generate_node_factory.rs index e0a4a2a43cf1..3ed856343f0b 100644 --- a/xtask/codegen/src/generate_node_factory.rs +++ b/xtask/codegen/src/generate_node_factory.rs @@ -1,6 +1,5 @@ use super::js_kinds_src::AstSrc; -use crate::to_lower_snake_case; -use crate::{js_kinds_src::Field, to_upper_snake_case, LanguageKind}; +use crate::{js_kinds_src::Field, to_lower_snake_case, to_upper_snake_case, LanguageKind}; use quote::{format_ident, quote}; use xtask::Result; diff --git a/xtask/codegen/src/generate_nodes.rs b/xtask/codegen/src/generate_nodes.rs index 3302a7e9138e..d2c483436656 100644 --- a/xtask/codegen/src/generate_nodes.rs +++ b/xtask/codegen/src/generate_nodes.rs @@ -347,7 +347,7 @@ pub fn generate_nodes(ast: &AstSrc, language_kind: LanguageKind) -> Result Option<&#variant_name> { match &self { diff --git a/xtask/codegen/src/generate_schema.rs b/xtask/codegen/src/generate_schema.rs index 8f4cf52e2f21..3b4eab196561 100644 --- a/xtask/codegen/src/generate_schema.rs +++ b/xtask/codegen/src/generate_schema.rs @@ -31,12 +31,21 @@ pub(crate) fn generate_configuration_schema(mode: Mode) -> Result<()> { /// since it should be just an implementation detail. fn rename_partial_references_in_schema(mut schema: RootSchema) -> RootSchema { if let Some(meta) = schema.schema.metadata.as_mut() { - if let Some(stripped_title) = meta - .title - .as_mut() - .and_then(|title| title.strip_prefix("Partial")) - { - meta.title = Some(stripped_title.to_owned()); + if let Some(title) = meta.title.as_ref() { + if let Some(stripped) = title.strip_prefix("Partial") { + meta.title = Some(stripped.to_string()); + } else if title == "RuleWithOptions_for_Null" { + meta.title = Some("RuleWithNoOptions".to_string()); + } else if title == "RuleConfiguration_for_Null" { + meta.title = Some("RuleConfiguration".to_string()); + } else if let Some(stripped) = title.strip_prefix("RuleWithOptions_for_") { + meta.title = Some(format!("RuleWith{stripped}")); + } else if let Some(stripped) = title + .strip_prefix("RuleConfiguration_for_") + .map(|x| x.strip_suffix("Options").unwrap_or(x)) + { + meta.title = Some(format!("{stripped}Configuration")); + } } } @@ -46,8 +55,19 @@ fn rename_partial_references_in_schema(mut schema: RootSchema) -> RootSchema { .definitions .into_iter() .map(|(mut key, mut schema)| { - if let Some(stripped_key) = key.strip_prefix("Partial") { - key = stripped_key.to_owned(); + if let Some(stripped) = key.strip_prefix("Partial") { + key = stripped.to_string(); + } else if key == "RuleWithOptions_for_Null" { + key = "RuleWithNoOptions".to_string(); + } else if key == "RuleConfiguration_for_Null" { + key = "RuleConfiguration".to_string(); + } else if let Some(stripped) = key.strip_prefix("RuleWithOptions_for_") { + key = format!("RuleWith{stripped}"); + } else if let Some(stripped) = key + .strip_prefix("RuleConfiguration_for_") + .map(|x| x.strip_suffix("Options").unwrap_or(x)) + { + key = format!("{stripped}Configuration"); } if let Schema::Object(object) = &mut schema { @@ -71,8 +91,20 @@ fn rename_partial_references_in_schema_object(object: &mut SchemaObject) { } if let Some(reference) = &mut object.reference { - if let Some(stripped_ref) = reference.strip_prefix("#/definitions/Partial") { - *reference = format!("#/definitions/{stripped_ref}"); + if let Some(stripped) = reference.strip_prefix("#/definitions/Partial") { + *reference = format!("#/definitions/{stripped}"); + } else if reference == "#/definitions/RuleWithOptions_for_Null" { + *reference = "#/definitions/RuleWithNoOptions".to_string(); + } else if reference == "#/definitions/RuleConfiguration_for_Null" { + *reference = "#/definitions/RuleConfiguration".to_string(); + } else if let Some(stripped) = reference.strip_prefix("#/definitions/RuleWithOptions_for_") + { + *reference = format!("RuleWith{stripped}"); + } else if let Some(stripped) = reference + .strip_prefix("#/definitions/RuleConfiguration_for_") + .map(|x| x.strip_suffix("Options").unwrap_or(x)) + { + *reference = format!("#/definitions/{stripped}Configuration"); } } diff --git a/xtask/codegen/src/lib.rs b/xtask/codegen/src/lib.rs index d51f0aa0d6c5..d3f3fda75b7a 100644 --- a/xtask/codegen/src/lib.rs +++ b/xtask/codegen/src/lib.rs @@ -197,9 +197,25 @@ pub fn update(path: &Path, contents: &str, mode: &Mode) -> Result Ok(UpdateResult::Updated) } -pub fn to_camel_case(s: &str) -> String { +pub fn to_capitalized(s: &str) -> String { + let mut c = s.chars(); + match c.next() { + None => String::new(), + Some(f) => f.to_uppercase().collect::() + c.as_str(), + } +} + +pub fn to_lower_camel_case(s: &str) -> String { + to_pascal_camel_case(s, false) +} + +pub fn to_pascal_case(s: &str) -> String { + to_pascal_camel_case(s, true) +} + +fn to_pascal_camel_case(s: &str, is_ascal: bool) -> String { let mut buf = String::with_capacity(s.len()); - let mut prev = false; + let mut prev = is_ascal; for c in s.chars() { if c == '_' { prev = true;