diff --git a/Cargo.lock b/Cargo.lock index 250a5f91b18f..94e24118ac6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,6 +166,7 @@ dependencies = [ "biome_migrate", "biome_resolver", "biome_rowan", + "biome_rule_options", "biome_service", "biome_text_edit", "bpaf", @@ -198,26 +199,21 @@ version = "0.0.1" dependencies = [ "biome_analyze", "biome_console", - "biome_css_analyze", - "biome_css_syntax", "biome_deserialize", "biome_deserialize_macros", "biome_diagnostics", "biome_flags", "biome_formatter", "biome_glob", - "biome_graphql_analyze", - "biome_graphql_syntax", "biome_html_formatter", "biome_html_syntax", - "biome_js_analyze", "biome_js_formatter", - "biome_json_analyze", "biome_json_formatter", "biome_json_parser", "biome_json_syntax", "biome_resolver", "biome_rowan", + "biome_rule_options", "bpaf", "camino", "codspeed-criterion-compat", @@ -269,6 +265,7 @@ dependencies = [ "biome_fs", "biome_plugin_loader", "biome_rowan", + "biome_rule_options", "biome_string_case", "biome_suppression", "biome_test_utils", @@ -537,6 +534,7 @@ dependencies = [ "biome_graphql_parser", "biome_graphql_syntax", "biome_rowan", + "biome_rule_options", "biome_string_case", "biome_suppression", "biome_test_utils", @@ -814,6 +812,7 @@ dependencies = [ "biome_project_layout", "biome_resolver", "biome_rowan", + "biome_rule_options", "biome_string_case", "biome_suppression", "biome_test_utils", @@ -1010,6 +1009,7 @@ dependencies = [ "biome_json_parser", "biome_json_syntax", "biome_rowan", + "biome_rule_options", "biome_string_case", "biome_suppression", "biome_test_utils", @@ -1365,6 +1365,27 @@ dependencies = [ "serde_json", ] +[[package]] +name = "biome_rule_options" +version = "0.0.1" +dependencies = [ + "biome_console", + "biome_deserialize", + "biome_deserialize_macros", + "biome_diagnostics", + "biome_glob", + "biome_resolver", + "biome_rowan", + "biome_string_case", + "camino", + "enumflags2", + "regex", + "rustc-hash 2.1.1", + "schemars", + "serde", + "smallvec", +] + [[package]] name = "biome_service" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index f1db4c318ba4..a9c524ae2c4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -156,6 +156,7 @@ biome_module_graph = { version = "0.0.1", path = "./crates/biome_modul biome_plugin_loader = { version = "0.0.1", path = "./crates/biome_plugin_loader" } biome_project_layout = { version = "0.0.1", path = "./crates/biome_project_layout" } biome_resolver = { version = "0.1.0", path = "./crates/biome_resolver" } +biome_rule_options = { version = "0.0.1", path = "./crates/biome_rule_options" } biome_ungrammar = { version = "0.3.1", path = "./crates/biome_ungrammar" } biome_yaml_factory = { version = "0.0.1", path = "./crates/biome_yaml_factory" } biome_yaml_parser = { version = "0.0.1", path = "./crates/biome_yaml_parser" } diff --git a/crates/biome_cli/Cargo.toml b/crates/biome_cli/Cargo.toml index 276b9ce2ae8b..c4d2fef8eaf7 100644 --- a/crates/biome_cli/Cargo.toml +++ b/crates/biome_cli/Cargo.toml @@ -46,6 +46,7 @@ biome_lsp = { workspace = true } biome_migrate = { workspace = true } biome_resolver = { workspace = true } biome_rowan = { workspace = true } +biome_rule_options = { workspace = true } biome_service = { workspace = true } biome_text_edit = { workspace = true } bpaf = { workspace = true, features = ["bright-color"] } diff --git a/crates/biome_cli/src/execute/migrate/eslint_eslint.rs b/crates/biome_cli/src/execute/migrate/eslint_eslint.rs index 6c8c0808e3f9..cffc28c8d6dd 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_eslint.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_eslint.rs @@ -599,7 +599,7 @@ pub struct NoConsoleOptions { /// Allowed calls on the console object. pub allow: Box<[Box]>, } -impl From for biome_js_analyze::lint::suspicious::no_console::NoConsoleOptions { +impl From for biome_rule_options::no_console::NoConsoleOptions { fn from(val: NoConsoleOptions) -> Self { Self { allow: val.allow } } diff --git a/crates/biome_cli/src/execute/migrate/eslint_jsxa11y.rs b/crates/biome_cli/src/execute/migrate/eslint_jsxa11y.rs index ae050331cff0..478ae01710e2 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_jsxa11y.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_jsxa11y.rs @@ -3,7 +3,7 @@ /// /// Also, the module includes implementation to convert rule options to Biome's rule options. use biome_deserialize_macros::Deserializable; -use biome_js_analyze::lint::a11y::use_valid_aria_role; +use biome_rule_options::use_valid_aria_role; #[derive(Debug, Default, Deserializable)] pub(crate) struct AriaRoleOptions { @@ -11,7 +11,7 @@ pub(crate) struct AriaRoleOptions { #[deserializable(rename = "ignoreNonDOM")] ignore_non_dom: bool, } -impl From for use_valid_aria_role::ValidAriaRoleOptions { +impl From for use_valid_aria_role::UseValidAriaRoleOptions { fn from(val: AriaRoleOptions) -> Self { Self { allow_invalid_roles: val.allowed_invalid_roles, diff --git a/crates/biome_cli/src/execute/migrate/eslint_to_biome.rs b/crates/biome_cli/src/execute/migrate/eslint_to_biome.rs index 244d2f4e6214..8f1ea17a9637 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_to_biome.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_to_biome.rs @@ -6,7 +6,7 @@ use biome_configuration::{self as biome_config}; use biome_console::markup; use biome_deserialize::Merge; use biome_diagnostics::Location; -use biome_js_analyze::lint::style::no_restricted_globals; +use biome_rule_options::no_restricted_globals; use rustc_hash::FxHashMap; /// This modules includes implementations for converting an ESLint config to a Biome config. @@ -489,7 +489,7 @@ fn migrate_eslint_rule( biome_config::RuleWithFixOptions { level: severity.into(), fix: None, - options: Box::new((*rule_options).into()), + options: *Box::new((*rule_options).into()), }, )); } @@ -516,8 +516,8 @@ fn migrate_eslint_rule( Some(biome_config::RuleConfiguration::WithOptions( biome_config::RuleWithOptions { level: severity.into(), - options: Box::new( - no_restricted_globals::RestrictedGlobalsOptions { + options: *Box::new( + no_restricted_globals::NoRestrictedGlobalsOptions { denied_globals: globals.collect::>(), }, ), @@ -536,7 +536,7 @@ fn migrate_eslint_rule( biome_config::RuleWithFixOptions { level: severity.into(), fix: None, - options: Box::new((*rule_options).into()), + options: *Box::new((*rule_options).into()), }, )); } @@ -620,7 +620,7 @@ fn migrate_eslint_rule( Some(biome_config::RuleConfiguration::WithOptions( biome_config::RuleWithOptions { level: conf.severity().into(), - options: Box::new(conf.option_or_default().into()), + options: conf.option_or_default().into(), }, )); } diff --git a/crates/biome_cli/src/execute/migrate/eslint_typescript.rs b/crates/biome_cli/src/execute/migrate/eslint_typescript.rs index bb79a60c173e..af1935bb9cf9 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_typescript.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_typescript.rs @@ -1,26 +1,23 @@ use std::{cmp::Ordering, str::FromStr}; +use super::eslint_eslint; /// Configuration related to [TypeScript Eslint](https://typescript-eslint.io/). /// /// Also, the module includes implementation to convert rule options to Biome's rule options. use biome_deserialize::Deserializable; use biome_deserialize_macros::Deserializable; -use biome_js_analyze::{ - lint::{ - style::use_consistent_member_accessibility, - style::{use_consistent_array_type, use_import_type, use_naming_convention}, - }, - utils::restricted_regex::RestrictedRegex, +use biome_rule_options::restricted_regex::RestrictedRegex; +use biome_rule_options::{ + use_consistent_array_type, use_consistent_member_accessibility, use_import_type, + use_naming_convention, }; -use super::eslint_eslint; - #[derive(Debug, Default, Deserializable)] pub(crate) struct ArrayTypeOptions { default: ArrayType, readonly: Option, } -impl From for use_consistent_array_type::ConsistentArrayTypeOptions { +impl From for use_consistent_array_type::UseConsistentArrayTypeOptions { fn from(val: ArrayTypeOptions) -> Self { Self { syntax: val.default.into(), @@ -51,7 +48,7 @@ pub(crate) struct ConsistentTypeImportsOptions { #[deserializable(rename = "fixStyle")] fix_style: Option, } -impl From for use_import_type::ImportTypeOptions { +impl From for use_import_type::UseImportTypeOptions { fn from(val: ConsistentTypeImportsOptions) -> Self { Self { style: val @@ -83,7 +80,7 @@ pub(crate) struct ExplicitMemberAccessibilityOptions { accessibility: Option, } impl From - for use_consistent_member_accessibility::ConsistentMemberAccessibilityOptions + for use_consistent_member_accessibility::UseConsistentMemberAccessibilityOptions { fn from(value: ExplicitMemberAccessibilityOptions) -> Self { Self { @@ -119,7 +116,7 @@ impl NamingConventionOptions { Self(inner) } } -impl From for use_naming_convention::NamingConventionOptions { +impl From for use_naming_convention::UseNamingConventionOptions { fn from(val: NamingConventionOptions) -> Self { let mut conventions = Vec::new(); for selection in val.0 { @@ -234,7 +231,7 @@ impl NamingConventionSelection { fn selectors(&self) -> Vec { let mut result = Vec::new(); - let modifiers: use_naming_convention::Modifiers = self + let modifiers: use_naming_convention::RestrictedModifiers = self .modifiers .iter() .flatten() diff --git a/crates/biome_cli/src/execute/migrate/eslint_unicorn.rs b/crates/biome_cli/src/execute/migrate/eslint_unicorn.rs index 1a676e80180d..a2799e14d3f1 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_unicorn.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_unicorn.rs @@ -3,7 +3,7 @@ /// /// ALso, the module includes implementation to convert rule options to Biome's rule options. use biome_deserialize_macros::Deserializable; -use biome_js_analyze::lint::style::use_filenaming_convention; +use biome_rule_options::use_filenaming_convention; use smallvec::SmallVec; #[derive(Clone, Debug, Default, Deserializable)] @@ -13,7 +13,7 @@ pub(crate) struct FilenameCaseOptions { ignore: Vec, multiple_file_extensions: bool, } -impl From for use_filenaming_convention::FilenamingConventionOptions { +impl From for use_filenaming_convention::UseFilenamingConventionOptions { fn from(val: FilenameCaseOptions) -> Self { let filename_cases: Option = val.cases.into(); Self { diff --git a/crates/biome_configuration/Cargo.toml b/crates/biome_configuration/Cargo.toml index d51f3090eeec..7de5292bce83 100644 --- a/crates/biome_configuration/Cargo.toml +++ b/crates/biome_configuration/Cargo.toml @@ -15,26 +15,21 @@ version = "0.0.1" [dependencies] biome_analyze = { workspace = true, features = ["serde"] } biome_console = { workspace = true } -biome_css_analyze = { workspace = true } -biome_css_syntax = { workspace = true } biome_deserialize = { workspace = true } biome_deserialize_macros = { workspace = true } biome_diagnostics = { workspace = true } biome_flags = { workspace = true } biome_formatter = { workspace = true, features = ["serde"] } -biome_glob = { workspace = true } -biome_graphql_analyze = { workspace = true } -biome_graphql_syntax = { workspace = true } +biome_glob = { workspace = true, features = ["schema"] } biome_html_formatter = { workspace = true, features = ["serde"] } biome_html_syntax = { workspace = true } -biome_js_analyze = { workspace = true } biome_js_formatter = { workspace = true, features = ["serde"] } -biome_json_analyze = { workspace = true } biome_json_formatter = { workspace = true, features = ["serde"] } biome_json_parser = { workspace = true } biome_json_syntax = { workspace = true } biome_resolver = { workspace = true } biome_rowan = { workspace = true, features = ["serde"] } +biome_rule_options = { workspace = true } bpaf = { workspace = true } camino = { workspace = true } regex = { workspace = true } @@ -45,17 +40,14 @@ serde = { workspace = true, features = ["derive"] } [features] schema = [ "dep:schemars", - "biome_js_analyze/schema", - "biome_css_analyze/schema", "biome_formatter/schema", "biome_json_syntax/schema", - "biome_css_syntax/schema", - "biome_graphql_syntax/schema", "biome_html_formatter/schema", "biome_html_syntax/schema", "biome_analyze/schema", "biome_json_formatter/schema", "biome_js_formatter/schema", + "biome_rule_options/schema", ] [dev-dependencies] diff --git a/crates/biome_configuration/src/analyzer/assist/actions.rs b/crates/biome_configuration/src/analyzer/assist/actions.rs index a0b2111c646b..02ca46338c2d 100644 --- a/crates/biome_configuration/src/analyzer/assist/actions.rs +++ b/crates/biome_configuration/src/analyzer/assist/actions.rs @@ -183,20 +183,27 @@ pub struct Source { pub recommended: Option, #[doc = "Provides a code action to sort the imports and exports in the file using a built-in or custom order."] #[serde(skip_serializing_if = "Option::is_none")] - pub organize_imports: - Option>, + pub organize_imports: Option< + RuleAssistConfiguration, + >, #[doc = "Enforce attribute sorting in JSX elements."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_sorted_attributes: - Option>, + pub use_sorted_attributes: Option< + RuleAssistConfiguration< + biome_rule_options::use_sorted_attributes::UseSortedAttributesOptions, + >, + >, #[doc = "Sorts the keys of a JSON object in natural order"] #[serde(skip_serializing_if = "Option::is_none")] pub use_sorted_keys: - Option>, + Option>, #[doc = "Enforce ordering of CSS properties and nested rules."] #[serde(skip_serializing_if = "Option::is_none")] - pub use_sorted_properties: - Option>, + pub use_sorted_properties: Option< + RuleAssistConfiguration< + biome_rule_options::use_sorted_properties::UseSortedPropertiesOptions, + >, + >, } impl Source { const GROUP_NAME: &'static str = "source"; diff --git a/crates/biome_configuration/src/analyzer/assists/mod.rs b/crates/biome_configuration/src/analyzer/assists/mod.rs deleted file mode 100644 index a98a1c49280a..000000000000 --- a/crates/biome_configuration/src/analyzer/assists/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -mod actions; - -pub use crate::analyzer::assists::actions::*; -use biome_deserialize::StringSet; -use biome_deserialize_macros::{Deserializable, Merge, Partial}; -use bpaf::Bpaf; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, Deserialize, Eq, Partial, PartialEq, Serialize)] -#[partial(derive(Bpaf, Clone, Deserializable, Eq, Merge, PartialEq))] -#[partial(cfg_attr(feature = "schema", derive(schemars::JsonSchema)))] -#[partial(serde(deny_unknown_fields, rename_all = "camelCase"))] -pub struct AssistsConfiguration { - /// Whether Biome should enable assists via LSP. - #[partial(bpaf(long("assists-enabled"), argument("true|false")))] - pub enabled: bool, - - /// Whether Biome should fail in CLI if the assists were not applied to the code. - #[partial(bpaf(pure(Default::default()), optional, hide))] - pub actions: Actions, - - /// A list of glob patterns. Biome will include files/folders that will - /// match these patterns. - #[partial(bpaf(pure(Default::default()), hide))] - pub includes: Vec, -} - -impl Default for AssistsConfiguration { - fn default() -> Self { - Self { - enabled: true, - actions: Actions::default(), - includes: Default::default(), - } - } -} diff --git a/crates/biome_configuration/src/analyzer/linter/mod.rs b/crates/biome_configuration/src/analyzer/linter/mod.rs index 109459577eda..fb6cc04677d0 100644 --- a/crates/biome_configuration/src/analyzer/linter/mod.rs +++ b/crates/biome_configuration/src/analyzer/linter/mod.rs @@ -1,4 +1,3 @@ -#[rustfmt::skip] mod rules; use crate::bool::Bool; diff --git a/crates/biome_configuration/src/analyzer/linter/rules.rs b/crates/biome_configuration/src/analyzer/linter/rules.rs index 8f821da250b3..d87a10134a7f 100644 --- a/crates/biome_configuration/src/analyzer/linter/rules.rs +++ b/crates/biome_configuration/src/analyzer/linter/rules.rs @@ -1736,147 +1736,7 @@ impl Rules { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct A11y { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: 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>, - #[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>, - #[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>, - #[doc = "Enforce that autoFocus prop is not used on elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_autofocus: Option>, - #[doc = "Enforces that no distracting elements are used."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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< - RuleFixConfiguration, - >, - #[doc = "Enforce that a label element or component has a text label and an associated input."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_label_without_control: - 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< - RuleFixConfiguration, - >, - #[doc = "Enforce that tabIndex is not assigned to non-interactive HTML elements."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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>, - #[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>, - #[doc = "Enforce that static, visible elements (such as \\
) that have click handlers use the valid role attribute."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_static_element_interactions: - 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>, - #[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>, - #[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>, - #[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< - RuleFixConfiguration, - >, - #[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>, - #[doc = "Enforce that ARIA properties are valid for the roles that are supported by the element."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_aria_props_supported_by_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>, - #[doc = "Elements with an interactive role and interaction handlers must be focusable."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_focusable_interactive: - Option>, - #[doc = "Disallow a missing generic family keyword within font families."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_generic_font_names: - 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>, - #[doc = "Enforce that html element has lang attribute."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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>, - #[doc = "Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "It detects the use of role attributes in JSX elements and suggests using semantic elements instead."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_semantic_elements: - 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>, - #[doc = "Ensures that ARIA properties aria-* are all valid."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Enforce that ARIA state and property values are valid."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_aria_values: - Option>, - #[doc = "Use valid values for the autocomplete attribute on input elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_autocomplete: - 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 struct A11y { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [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 < RuleFixConfiguration < biome_rule_options :: no_access_key :: NoAccessKeyOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_aria_hidden_on_focusable :: NoAriaHiddenOnFocusableOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_aria_unsupported_elements :: NoAriaUnsupportedElementsOptions >> , # [doc = "Enforce that autoFocus prop is not used on elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_autofocus : Option < RuleFixConfiguration < biome_rule_options :: no_autofocus :: NoAutofocusOptions >> , # [doc = "Enforces that no distracting elements are used."] # [serde (skip_serializing_if = "Option::is_none")] pub no_distracting_elements : Option < RuleFixConfiguration < biome_rule_options :: no_distracting_elements :: NoDistractingElementsOptions >> , # [doc = "The scope prop should be used only on \\ elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_header_scope : Option < RuleFixConfiguration < biome_rule_options :: no_header_scope :: NoHeaderScopeOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_interactive_element_to_noninteractive_role :: NoInteractiveElementToNoninteractiveRoleOptions >> , # [doc = "Enforce that a label element or component has a text label and an associated input."] # [serde (skip_serializing_if = "Option::is_none")] pub no_label_without_control : Option < RuleConfiguration < biome_rule_options :: no_label_without_control :: NoLabelWithoutControlOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_noninteractive_element_to_interactive_role :: NoNoninteractiveElementToInteractiveRoleOptions >> , # [doc = "Enforce that tabIndex is not assigned to non-interactive HTML elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_noninteractive_tabindex : Option < RuleFixConfiguration < biome_rule_options :: no_noninteractive_tabindex :: NoNoninteractiveTabindexOptions >> , # [doc = "Prevent the usage of positive integers on tabIndex property"] # [serde (skip_serializing_if = "Option::is_none")] pub no_positive_tabindex : Option < RuleFixConfiguration < biome_rule_options :: no_positive_tabindex :: NoPositiveTabindexOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_redundant_alt :: NoRedundantAltOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_redundant_roles :: NoRedundantRolesOptions >> , # [doc = "Enforce that static, visible elements (such as \\
) that have click handlers use the valid role attribute."] # [serde (skip_serializing_if = "Option::is_none")] pub no_static_element_interactions : Option < RuleConfiguration < biome_rule_options :: no_static_element_interactions :: NoStaticElementInteractionsOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_svg_without_title :: NoSvgWithoutTitleOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_alt_text :: UseAltTextOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_anchor_content :: UseAnchorContentOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_aria_activedescendant_with_tabindex :: UseAriaActivedescendantWithTabindexOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_aria_props_for_role :: UseAriaPropsForRoleOptions >> , # [doc = "Enforce that ARIA properties are valid for the roles that are supported by the element."] # [serde (skip_serializing_if = "Option::is_none")] pub use_aria_props_supported_by_role : Option < RuleConfiguration < biome_rule_options :: use_aria_props_supported_by_role :: UseAriaPropsSupportedByRoleOptions >> , # [doc = "Enforces the usage of the attribute type for the element button"] # [serde (skip_serializing_if = "Option::is_none")] pub use_button_type : Option < RuleConfiguration < biome_rule_options :: use_button_type :: UseButtonTypeOptions >> , # [doc = "Elements with an interactive role and interaction handlers must be focusable."] # [serde (skip_serializing_if = "Option::is_none")] pub use_focusable_interactive : Option < RuleConfiguration < biome_rule_options :: use_focusable_interactive :: UseFocusableInteractiveOptions >> , # [doc = "Disallow a missing generic family keyword within font families."] # [serde (skip_serializing_if = "Option::is_none")] pub use_generic_font_names : Option < RuleConfiguration < biome_rule_options :: use_generic_font_names :: UseGenericFontNamesOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_heading_content :: UseHeadingContentOptions >> , # [doc = "Enforce that html element has lang attribute."] # [serde (skip_serializing_if = "Option::is_none")] pub use_html_lang : Option < RuleConfiguration < biome_rule_options :: use_html_lang :: UseHtmlLangOptions >> , # [doc = "Enforces the usage of the attribute title for the element iframe."] # [serde (skip_serializing_if = "Option::is_none")] pub use_iframe_title : Option < RuleConfiguration < biome_rule_options :: use_iframe_title :: UseIframeTitleOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_key_with_click_events :: UseKeyWithClickEventsOptions >> , # [doc = "Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur."] # [serde (skip_serializing_if = "Option::is_none")] pub use_key_with_mouse_events : Option < RuleConfiguration < biome_rule_options :: use_key_with_mouse_events :: UseKeyWithMouseEventsOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_media_caption :: UseMediaCaptionOptions >> , # [doc = "It detects the use of role attributes in JSX elements and suggests using semantic elements instead."] # [serde (skip_serializing_if = "Option::is_none")] pub use_semantic_elements : Option < RuleConfiguration < biome_rule_options :: use_semantic_elements :: UseSemanticElementsOptions >> , # [doc = "Enforce that all anchors are valid, and they are navigable elements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_valid_anchor : Option < RuleConfiguration < biome_rule_options :: use_valid_anchor :: UseValidAnchorOptions >> , # [doc = "Ensures that ARIA properties aria-* are all valid."] # [serde (skip_serializing_if = "Option::is_none")] pub use_valid_aria_props : Option < RuleFixConfiguration < biome_rule_options :: use_valid_aria_props :: UseValidAriaPropsOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_valid_aria_role :: UseValidAriaRoleOptions >> , # [doc = "Enforce that ARIA state and property values are valid."] # [serde (skip_serializing_if = "Option::is_none")] pub use_valid_aria_values : Option < RuleConfiguration < biome_rule_options :: use_valid_aria_values :: UseValidAriaValuesOptions >> , # [doc = "Use valid values for the autocomplete attribute on input elements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_valid_autocomplete : Option < RuleConfiguration < biome_rule_options :: use_valid_autocomplete :: UseValidAutocompleteOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_valid_lang :: UseValidLangOptions >> } impl A11y { const GROUP_NAME: &'static str = "a11y"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -2592,154 +2452,7 @@ impl From for A11y { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Complexity { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow unclear usage of consecutive space characters in regular expression literals"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_adjacent_spaces_in_regex: - Option>, - #[doc = "Disallow the use of arguments."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_arguments: Option>, - #[doc = "Disallow primitive type aliases and misleading types."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_banned_types: Option>, - #[doc = "Disallow comma operator."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_comma_operator: Option>, - #[doc = "Disallow empty type parameters in type aliases and interfaces."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_type_parameters: - Option>, - #[doc = "Disallow functions that exceed a given Cognitive Complexity score."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_excessive_cognitive_complexity: - Option>, - #[doc = "This rule enforces a maximum depth to nested describe() in test files."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_excessive_nested_test_suites: - Option>, - #[doc = "Disallow unnecessary boolean casts"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_extra_boolean_cast: - Option>, - #[doc = "Disallow to use unnecessary callback on flatMap."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_flat_map_identity: - Option>, - #[doc = "Prefer for...of statement instead of Array.forEach."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_for_each: 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>, - #[doc = "Disallow this and super in static contexts."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_this_in_static: Option>, - #[doc = "Disallow unnecessary catch clauses."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_catch: Option>, - #[doc = "Disallow unnecessary constructors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_constructor: - Option>, - #[doc = "Avoid using unnecessary continue."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_continue: - 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>, - #[doc = "Disallow unnecessary escape sequence in regular expression literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_escape_in_regex: - Option>, - #[doc = "Disallow unnecessary fragments"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_fragments: - Option>, - #[doc = "Disallow unnecessary labels."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_label: Option>, - #[doc = "Disallow unnecessary nested block statements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_lone_block_statements: - 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>, - #[doc = "Disallow unnecessary concatenation of string or template literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_string_concat: - Option>, - #[doc = "Disallow unnecessary String.raw function in template string literals without any escape sequence."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_string_raw: - Option>, - #[doc = "Disallow useless case in switch statements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_switch_case: - Option>, - #[doc = "Disallow ternary operators when simpler alternatives exist."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_ternary: - Option>, - #[doc = "Disallow useless this aliasing."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow initializing variables to undefined."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_undefined_initialization: - 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>, - #[doc = "Use arrow functions over function expressions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_arrow_function: - Option>, - #[doc = "Use Date.now() to get the number of milliseconds since the Unix Epoch."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_date_now: 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>, - #[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>, - #[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>, - #[doc = "Enforce using concise optional chain instead of chained logical expressions."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow number literal object member names which are not base 10 or use underscore as separator."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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 struct Complexity { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow unclear usage of consecutive space characters in regular expression literals"] # [serde (skip_serializing_if = "Option::is_none")] pub no_adjacent_spaces_in_regex : Option < RuleFixConfiguration < biome_rule_options :: no_adjacent_spaces_in_regex :: NoAdjacentSpacesInRegexOptions >> , # [doc = "Disallow the use of arguments."] # [serde (skip_serializing_if = "Option::is_none")] pub no_arguments : Option < RuleConfiguration < biome_rule_options :: no_arguments :: NoArgumentsOptions >> , # [doc = "Disallow primitive type aliases and misleading types."] # [serde (skip_serializing_if = "Option::is_none")] pub no_banned_types : Option < RuleFixConfiguration < biome_rule_options :: no_banned_types :: NoBannedTypesOptions >> , # [doc = "Disallow comma operator."] # [serde (skip_serializing_if = "Option::is_none")] pub no_comma_operator : Option < RuleConfiguration < biome_rule_options :: no_comma_operator :: NoCommaOperatorOptions >> , # [doc = "Disallow empty type parameters in type aliases and interfaces."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_type_parameters : Option < RuleConfiguration < biome_rule_options :: no_empty_type_parameters :: NoEmptyTypeParametersOptions >> , # [doc = "Disallow functions that exceed a given Cognitive Complexity score."] # [serde (skip_serializing_if = "Option::is_none")] pub no_excessive_cognitive_complexity : Option < RuleConfiguration < biome_rule_options :: no_excessive_cognitive_complexity :: NoExcessiveCognitiveComplexityOptions >> , # [doc = "This rule enforces a maximum depth to nested describe() in test files."] # [serde (skip_serializing_if = "Option::is_none")] pub no_excessive_nested_test_suites : Option < RuleConfiguration < biome_rule_options :: no_excessive_nested_test_suites :: NoExcessiveNestedTestSuitesOptions >> , # [doc = "Disallow unnecessary boolean casts"] # [serde (skip_serializing_if = "Option::is_none")] pub no_extra_boolean_cast : Option < RuleFixConfiguration < biome_rule_options :: no_extra_boolean_cast :: NoExtraBooleanCastOptions >> , # [doc = "Disallow to use unnecessary callback on flatMap."] # [serde (skip_serializing_if = "Option::is_none")] pub no_flat_map_identity : Option < RuleFixConfiguration < biome_rule_options :: no_flat_map_identity :: NoFlatMapIdentityOptions >> , # [doc = "Prefer for...of statement instead of Array.forEach."] # [serde (skip_serializing_if = "Option::is_none")] pub no_for_each : Option < RuleConfiguration < biome_rule_options :: no_for_each :: NoForEachOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_static_only_class :: NoStaticOnlyClassOptions >> , # [doc = "Disallow this and super in static contexts."] # [serde (skip_serializing_if = "Option::is_none")] pub no_this_in_static : Option < RuleFixConfiguration < biome_rule_options :: no_this_in_static :: NoThisInStaticOptions >> , # [doc = "Disallow unnecessary catch clauses."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_catch : Option < RuleFixConfiguration < biome_rule_options :: no_useless_catch :: NoUselessCatchOptions >> , # [doc = "Disallow unnecessary constructors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_constructor : Option < RuleFixConfiguration < biome_rule_options :: no_useless_constructor :: NoUselessConstructorOptions >> , # [doc = "Avoid using unnecessary continue."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_continue : Option < RuleFixConfiguration < biome_rule_options :: no_useless_continue :: NoUselessContinueOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_useless_empty_export :: NoUselessEmptyExportOptions >> , # [doc = "Disallow unnecessary escape sequence in regular expression literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_escape_in_regex : Option < RuleFixConfiguration < biome_rule_options :: no_useless_escape_in_regex :: NoUselessEscapeInRegexOptions >> , # [doc = "Disallow unnecessary fragments"] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_fragments : Option < RuleFixConfiguration < biome_rule_options :: no_useless_fragments :: NoUselessFragmentsOptions >> , # [doc = "Disallow unnecessary labels."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_label : Option < RuleFixConfiguration < biome_rule_options :: no_useless_label :: NoUselessLabelOptions >> , # [doc = "Disallow unnecessary nested block statements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_lone_block_statements : Option < RuleFixConfiguration < biome_rule_options :: no_useless_lone_block_statements :: NoUselessLoneBlockStatementsOptions >> , # [doc = "Disallow renaming import, export, and destructured assignments to the same name."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_rename : Option < RuleFixConfiguration < biome_rule_options :: no_useless_rename :: NoUselessRenameOptions >> , # [doc = "Disallow unnecessary concatenation of string or template literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_string_concat : Option < RuleFixConfiguration < biome_rule_options :: no_useless_string_concat :: NoUselessStringConcatOptions >> , # [doc = "Disallow unnecessary String.raw function in template string literals without any escape sequence."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_string_raw : Option < RuleConfiguration < biome_rule_options :: no_useless_string_raw :: NoUselessStringRawOptions >> , # [doc = "Disallow useless case in switch statements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_switch_case : Option < RuleFixConfiguration < biome_rule_options :: no_useless_switch_case :: NoUselessSwitchCaseOptions >> , # [doc = "Disallow ternary operators when simpler alternatives exist."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_ternary : Option < RuleFixConfiguration < biome_rule_options :: no_useless_ternary :: NoUselessTernaryOptions >> , # [doc = "Disallow useless this aliasing."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_this_alias : Option < RuleFixConfiguration < biome_rule_options :: no_useless_this_alias :: NoUselessThisAliasOptions >> , # [doc = "Disallow using any or unknown as type constraint."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_type_constraint : Option < RuleFixConfiguration < biome_rule_options :: no_useless_type_constraint :: NoUselessTypeConstraintOptions >> , # [doc = "Disallow initializing variables to undefined."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_undefined_initialization : Option < RuleFixConfiguration < biome_rule_options :: no_useless_undefined_initialization :: NoUselessUndefinedInitializationOptions >> , # [doc = "Disallow the use of void operators, which is not a familiar operator."] # [serde (skip_serializing_if = "Option::is_none")] pub no_void : Option < RuleConfiguration < biome_rule_options :: no_void :: NoVoidOptions >> , # [doc = "Use arrow functions over function expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_arrow_function : Option < RuleFixConfiguration < biome_rule_options :: use_arrow_function :: UseArrowFunctionOptions >> , # [doc = "Use Date.now() to get the number of milliseconds since the Unix Epoch."] # [serde (skip_serializing_if = "Option::is_none")] pub use_date_now : Option < RuleFixConfiguration < biome_rule_options :: use_date_now :: UseDateNowOptions >> , # [doc = "Promotes the use of .flatMap() when map().flat() are used together."] # [serde (skip_serializing_if = "Option::is_none")] pub use_flat_map : Option < RuleFixConfiguration < biome_rule_options :: use_flat_map :: UseFlatMapOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_literal_keys :: UseLiteralKeysOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_numeric_literals :: UseNumericLiteralsOptions >> , # [doc = "Enforce using concise optional chain instead of chained logical expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_optional_chain : Option < RuleFixConfiguration < biome_rule_options :: use_optional_chain :: UseOptionalChainOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_regex_literals :: UseRegexLiteralsOptions >> , # [doc = "Disallow number literal object member names which are not base 10 or use underscore as separator."] # [serde (skip_serializing_if = "Option::is_none")] pub use_simple_number_keys : Option < RuleFixConfiguration < biome_rule_options :: use_simple_number_keys :: UseSimpleNumberKeysOptions >> , # [doc = "Discard redundant terms from logical expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_simplified_logic_expression : Option < RuleFixConfiguration < biome_rule_options :: use_simplified_logic_expression :: UseSimplifiedLogicExpressionOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_while :: UseWhileOptions >> } impl Complexity { const GROUP_NAME: &'static str = "complexity"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -3502,210 +3215,7 @@ impl From for Complexity { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Correctness { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Prevent passing of children as props."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow constant expressions in conditions"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_constant_condition: - Option>, - #[doc = "Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_constant_math_min_max_clamp: - Option>, - #[doc = "Disallow returning a value from a constructor."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallows empty destructuring patterns."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow function and var declarations that are accessible outside their block."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_inner_declarations: - Option>, - #[doc = "Ensure that builtins are correctly instantiated."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_builtin_instantiation: - 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>, - #[doc = "Disallow non-standard direction values for linear gradient functions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_direction_in_linear_gradient: - Option>, - #[doc = "Disallows invalid named grid areas in CSS Grid Layouts."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_grid_areas: - Option>, - #[doc = "Disallow the use of @import at-rules in invalid positions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_invalid_position_at_import_rule: - 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>, - #[doc = "Disallow missing var function for css variables."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_missing_var_function: - Option>, - #[doc = "Forbid the use of Node.js builtin modules."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_nodejs_modules: Option>, - #[doc = "Disallow \\8 and \\9 escape sequences in string literals."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Restrict imports of private exports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_private_imports: 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>, - #[doc = "Disallow assignments where both sides are exactly the same."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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>, - #[doc = "Disallow lexical declarations in switch clauses."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_switch_declarations: - 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>, - #[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>, - #[doc = "Disallow unknown CSS value functions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_function: - Option>, - #[doc = "Disallow unknown media feature names."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_media_feature_name: - Option>, - #[doc = "Disallow unknown properties."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_property: - Option>, - #[doc = "Disallow unknown pseudo-class selectors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_pseudo_class: - Option>, - #[doc = "Disallow unknown pseudo-element selectors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_pseudo_element: - Option>, - #[doc = "Disallow unknown type selectors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_type_selector: - Option>, - #[doc = "Disallow unknown CSS units."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_unit: Option>, - #[doc = "Disallow unmatchable An+B selectors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unmatchable_anb_selector: - Option>, - #[doc = "Disallow unreachable code"] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow control flow statements in finally blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow unused function parameters."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_function_parameters: - Option>, - #[doc = "Disallow unused imports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_imports: Option>, - #[doc = "Disallow unused labels."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_labels: Option>, - #[doc = "Disallow unused private class members"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unused_private_class_members: - Option>, - #[doc = "Disallow unused variables."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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>, - #[doc = "Enforce all dependencies are correctly specified in a React hook."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Enforce file extensions for relative imports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_import_extensions: - Option>, - #[doc = "Require calls to isNaN() when checking for NaN."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_is_nan: Option>, - #[doc = "Disallow missing key props in iterators/collection literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_jsx_key_in_iterable: - 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>, - #[doc = "This rule checks that the result of a typeof expression is compared to a valid value."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_valid_typeof: Option>, - #[doc = "Require generator functions to contain yield."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_yield: Option>, -} +pub struct Correctness { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Prevent passing of children as props."] # [serde (skip_serializing_if = "Option::is_none")] pub no_children_prop : Option < RuleConfiguration < biome_rule_options :: no_children_prop :: NoChildrenPropOptions >> , # [doc = "Prevents from having const variables being re-assigned."] # [serde (skip_serializing_if = "Option::is_none")] pub no_const_assign : Option < RuleFixConfiguration < biome_rule_options :: no_const_assign :: NoConstAssignOptions >> , # [doc = "Disallow constant expressions in conditions"] # [serde (skip_serializing_if = "Option::is_none")] pub no_constant_condition : Option < RuleConfiguration < biome_rule_options :: no_constant_condition :: NoConstantConditionOptions >> , # [doc = "Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant."] # [serde (skip_serializing_if = "Option::is_none")] pub no_constant_math_min_max_clamp : Option < RuleFixConfiguration < biome_rule_options :: no_constant_math_min_max_clamp :: NoConstantMathMinMaxClampOptions >> , # [doc = "Disallow returning a value from a constructor."] # [serde (skip_serializing_if = "Option::is_none")] pub no_constructor_return : Option < RuleConfiguration < biome_rule_options :: no_constructor_return :: NoConstructorReturnOptions >> , # [doc = "Disallow empty character classes in regular expression literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_character_class_in_regex : Option < RuleConfiguration < biome_rule_options :: no_empty_character_class_in_regex :: NoEmptyCharacterClassInRegexOptions >> , # [doc = "Disallows empty destructuring patterns."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_pattern : Option < RuleConfiguration < biome_rule_options :: no_empty_pattern :: NoEmptyPatternOptions >> , # [doc = "Disallow calling global object properties as functions"] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_object_calls : Option < RuleConfiguration < biome_rule_options :: no_global_object_calls :: NoGlobalObjectCallsOptions >> , # [doc = "Disallow function and var declarations that are accessible outside their block."] # [serde (skip_serializing_if = "Option::is_none")] pub no_inner_declarations : Option < RuleConfiguration < biome_rule_options :: no_inner_declarations :: NoInnerDeclarationsOptions >> , # [doc = "Ensure that builtins are correctly instantiated."] # [serde (skip_serializing_if = "Option::is_none")] pub no_invalid_builtin_instantiation : Option < RuleFixConfiguration < biome_rule_options :: no_invalid_builtin_instantiation :: NoInvalidBuiltinInstantiationOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_invalid_constructor_super :: NoInvalidConstructorSuperOptions >> , # [doc = "Disallow non-standard direction values for linear gradient functions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_invalid_direction_in_linear_gradient : Option < RuleConfiguration < biome_rule_options :: no_invalid_direction_in_linear_gradient :: NoInvalidDirectionInLinearGradientOptions >> , # [doc = "Disallows invalid named grid areas in CSS Grid Layouts."] # [serde (skip_serializing_if = "Option::is_none")] pub no_invalid_grid_areas : Option < RuleConfiguration < biome_rule_options :: no_invalid_grid_areas :: NoInvalidGridAreasOptions >> , # [doc = "Disallow the use of @import at-rules in invalid positions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_invalid_position_at_import_rule : Option < RuleConfiguration < biome_rule_options :: no_invalid_position_at_import_rule :: NoInvalidPositionAtImportRuleOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_invalid_use_before_declaration :: NoInvalidUseBeforeDeclarationOptions >> , # [doc = "Disallow missing var function for css variables."] # [serde (skip_serializing_if = "Option::is_none")] pub no_missing_var_function : Option < RuleConfiguration < biome_rule_options :: no_missing_var_function :: NoMissingVarFunctionOptions >> , # [doc = "Forbid the use of Node.js builtin modules."] # [serde (skip_serializing_if = "Option::is_none")] pub no_nodejs_modules : Option < RuleConfiguration < biome_rule_options :: no_nodejs_modules :: NoNodejsModulesOptions >> , # [doc = "Disallow \\8 and \\9 escape sequences in string literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_nonoctal_decimal_escape : Option < RuleFixConfiguration < biome_rule_options :: no_nonoctal_decimal_escape :: NoNonoctalDecimalEscapeOptions >> , # [doc = "Disallow literal numbers that lose precision"] # [serde (skip_serializing_if = "Option::is_none")] pub no_precision_loss : Option < RuleConfiguration < biome_rule_options :: no_precision_loss :: NoPrecisionLossOptions >> , # [doc = "Restrict imports of private exports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_private_imports : Option < RuleConfiguration < biome_rule_options :: no_private_imports :: NoPrivateImportsOptions >> , # [doc = "Prevent the usage of the return value of React.render."] # [serde (skip_serializing_if = "Option::is_none")] pub no_render_return_value : Option < RuleConfiguration < biome_rule_options :: no_render_return_value :: NoRenderReturnValueOptions >> , # [doc = "Disallow assignments where both sides are exactly the same."] # [serde (skip_serializing_if = "Option::is_none")] pub no_self_assign : Option < RuleConfiguration < biome_rule_options :: no_self_assign :: NoSelfAssignOptions >> , # [doc = "Disallow returning a value from a setter"] # [serde (skip_serializing_if = "Option::is_none")] pub no_setter_return : Option < RuleConfiguration < biome_rule_options :: no_setter_return :: NoSetterReturnOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_string_case_mismatch :: NoStringCaseMismatchOptions >> , # [doc = "Disallow lexical declarations in switch clauses."] # [serde (skip_serializing_if = "Option::is_none")] pub no_switch_declarations : Option < RuleFixConfiguration < biome_rule_options :: no_switch_declarations :: NoSwitchDeclarationsOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_undeclared_dependencies :: NoUndeclaredDependenciesOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_undeclared_variables :: NoUndeclaredVariablesOptions >> , # [doc = "Disallow unknown CSS value functions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_function : Option < RuleConfiguration < biome_rule_options :: no_unknown_function :: NoUnknownFunctionOptions >> , # [doc = "Disallow unknown media feature names."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_media_feature_name : Option < RuleConfiguration < biome_rule_options :: no_unknown_media_feature_name :: NoUnknownMediaFeatureNameOptions >> , # [doc = "Disallow unknown properties."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_property : Option < RuleConfiguration < biome_rule_options :: no_unknown_property :: NoUnknownPropertyOptions >> , # [doc = "Disallow unknown pseudo-class selectors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_pseudo_class : Option < RuleConfiguration < biome_rule_options :: no_unknown_pseudo_class :: NoUnknownPseudoClassOptions >> , # [doc = "Disallow unknown pseudo-element selectors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_pseudo_element : Option < RuleConfiguration < biome_rule_options :: no_unknown_pseudo_element :: NoUnknownPseudoElementOptions >> , # [doc = "Disallow unknown type selectors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_type_selector : Option < RuleConfiguration < biome_rule_options :: no_unknown_type_selector :: NoUnknownTypeSelectorOptions >> , # [doc = "Disallow unknown CSS units."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_unit : Option < RuleConfiguration < biome_rule_options :: no_unknown_unit :: NoUnknownUnitOptions >> , # [doc = "Disallow unmatchable An+B selectors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unmatchable_anb_selector : Option < RuleConfiguration < biome_rule_options :: no_unmatchable_anb_selector :: NoUnmatchableAnbSelectorOptions >> , # [doc = "Disallow unreachable code"] # [serde (skip_serializing_if = "Option::is_none")] pub no_unreachable : Option < RuleConfiguration < biome_rule_options :: no_unreachable :: NoUnreachableOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_unreachable_super :: NoUnreachableSuperOptions >> , # [doc = "Disallow control flow statements in finally blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unsafe_finally : Option < RuleConfiguration < biome_rule_options :: no_unsafe_finally :: NoUnsafeFinallyOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_unsafe_optional_chaining :: NoUnsafeOptionalChainingOptions >> , # [doc = "Disallow unused function parameters."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unused_function_parameters : Option < RuleFixConfiguration < biome_rule_options :: no_unused_function_parameters :: NoUnusedFunctionParametersOptions >> , # [doc = "Disallow unused imports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unused_imports : Option < RuleFixConfiguration < biome_rule_options :: no_unused_imports :: NoUnusedImportsOptions >> , # [doc = "Disallow unused labels."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unused_labels : Option < RuleFixConfiguration < biome_rule_options :: no_unused_labels :: NoUnusedLabelsOptions >> , # [doc = "Disallow unused private class members"] # [serde (skip_serializing_if = "Option::is_none")] pub no_unused_private_class_members : Option < RuleFixConfiguration < biome_rule_options :: no_unused_private_class_members :: NoUnusedPrivateClassMembersOptions >> , # [doc = "Disallow unused variables."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unused_variables : Option < RuleFixConfiguration < biome_rule_options :: no_unused_variables :: NoUnusedVariablesOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_void_elements_with_children :: NoVoidElementsWithChildrenOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_void_type_return :: NoVoidTypeReturnOptions >> , # [doc = "Enforce all dependencies are correctly specified in a React hook."] # [serde (skip_serializing_if = "Option::is_none")] pub use_exhaustive_dependencies : Option < RuleFixConfiguration < biome_rule_options :: use_exhaustive_dependencies :: UseExhaustiveDependenciesOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_hook_at_top_level :: UseHookAtTopLevelOptions >> , # [doc = "Enforce file extensions for relative imports."] # [serde (skip_serializing_if = "Option::is_none")] pub use_import_extensions : Option < RuleFixConfiguration < biome_rule_options :: use_import_extensions :: UseImportExtensionsOptions >> , # [doc = "Require calls to isNaN() when checking for NaN."] # [serde (skip_serializing_if = "Option::is_none")] pub use_is_nan : Option < RuleFixConfiguration < biome_rule_options :: use_is_nan :: UseIsNanOptions >> , # [doc = "Disallow missing key props in iterators/collection literals."] # [serde (skip_serializing_if = "Option::is_none")] pub use_jsx_key_in_iterable : Option < RuleConfiguration < biome_rule_options :: use_jsx_key_in_iterable :: UseJsxKeyInIterableOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_valid_for_direction :: UseValidForDirectionOptions >> , # [doc = "This rule checks that the result of a typeof expression is compared to a valid value."] # [serde (skip_serializing_if = "Option::is_none")] pub use_valid_typeof : Option < RuleFixConfiguration < biome_rule_options :: use_valid_typeof :: UseValidTypeofOptions >> , # [doc = "Require generator functions to contain yield."] # [serde (skip_serializing_if = "Option::is_none")] pub use_yield : Option < RuleConfiguration < biome_rule_options :: use_yield :: UseYieldOptions >> } impl Correctness { const GROUP_NAME: &'static str = "correctness"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -4736,190 +4246,7 @@ impl From for Correctness { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Nursery { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow await inside loops."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_await_in_loop: Option>, - #[doc = "Disallow bitwise operators."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_bitwise_operators: - Option>, - #[doc = "Disallow expressions where the operation doesn't affect the value"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_constant_binary_expression: - Option>, - #[doc = "Disallow destructuring props inside JSX components in Solid projects."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_destructured_props: - Option>, - #[doc = "Restrict the number of lines of code in a function."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_excessive_lines_per_function: - Option>, - #[doc = "Require Promise-like statements to be handled appropriately."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_floating_promises: - Option>, - #[doc = "Disallow the use of __dirname and __filename in the global scope."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_dirname_filename: - Option>, - #[doc = "Disallow shorthand type conversions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_implicit_coercion: - Option>, - #[doc = "Prevent import cycles."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_import_cycles: Option>, - #[doc = "Disallow the use of the !important style."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_important_styles: - Option>, - #[doc = "Reports usage of \"magic numbers\" — numbers used directly instead of being assigned to named constants."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_magic_numbers: Option>, - #[doc = "Disallows defining React components inside other components."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_nested_component_definitions: - Option>, - #[doc = "Disallow use event handlers on non-interactive elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_noninteractive_element_interactions: - Option>, - #[doc = "Disallow the use of process global."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_process_global: Option>, - #[doc = "Disallow assigning to React component props."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_react_prop_assign: - Option>, - #[doc = "Disallow the use of configured elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_restricted_elements: - Option>, - #[doc = "Disallow usage of sensitive data such as API keys and tokens."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_secrets: Option>, - #[doc = "Disallow variable declarations from shadowing variables declared in the outer scope."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_shadow: Option>, - #[doc = "Prevents the use of the TypeScript directive @ts-ignore."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_ts_ignore: Option>, - #[doc = "Disallow let or var variables that are read but never assigned."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unassigned_variables: - Option>, - #[doc = "Disallow unknown at-rules."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unknown_at_rule: Option>, - #[doc = "Warn when importing non-existing exports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unresolved_imports: - Option>, - #[doc = "Prevent duplicate polyfills from Polyfill.io."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unwanted_polyfillio: - Option>, - #[doc = "Disallow useless backreferences in regular expression literals that always match an empty string."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_backref_in_regex: - Option>, - #[doc = "Disallow unnecessary escapes in string literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_escape_in_string: - Option>, - #[doc = "Disallow the use of useless undefined."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_undefined: - Option>, - #[doc = "Enforce that getters and setters for the same property are adjacent in class and object definitions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_adjacent_getter_setter: - Option>, - #[doc = "Require the consistent declaration of object literals. Defaults to explicit definitions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_object_definition: - Option>, - #[doc = "Use static Response methods instead of new Response() constructor when possible."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_response: - Option>, - #[doc = "Require switch-case statements to be exhaustive."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_exhaustive_switch_cases: - Option>, - #[doc = "Enforce types in functions, methods, variables, and parameters."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_explicit_type: Option>, - #[doc = "Require that all exports are declared after all non-export statements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_exports_last: Option>, - #[doc = "Enforce using Solid's \\ component for mapping an array to JSX elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_for_component: Option>, - #[doc = "Ensure the preconnect attribute is used when using Google Fonts."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_google_font_preconnect: - Option>, - #[doc = "Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_index_of: Option>, - #[doc = "Enforce consistent return values in iterable callbacks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_iterable_callback_return: - Option>, - #[doc = "Enforces the use of with { type: \"json\" } for JSON module imports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_json_import_attribute: - Option>, - #[doc = "Enforce specifying the name of GraphQL operations."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_named_operation: - Option>, - #[doc = "Validates that all enum values are capitalized."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_naming_convention: - Option>, - #[doc = "Enforce the use of numeric separators in numeric literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_numeric_separators: - Option>, - #[doc = "Prefer object spread over Object.assign() when constructing new objects."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_object_spread: Option>, - #[doc = "Enforce the consistent use of the radix argument when using parseInt()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_parse_int_radix: - Option>, - #[doc = "Enforce marking members as readonly if they are never modified outside the constructor."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_readonly_class_properties: - Option>, - #[doc = "Enforce JSDoc comment lines to start with a single asterisk, except for the first one."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_single_js_doc_asterisk: - Option>, - #[doc = "Enforce the sorting of CSS utility classes."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_sorted_classes: - Option>, - #[doc = "Require a description parameter for the Symbol()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_symbol_description: - Option>, - #[doc = "Disallow overload signatures that can be unified into a single signature."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_unified_type_signature: - Option>, - #[doc = "Prevent the usage of static string literal id attribute on elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_unique_element_ids: - Option>, -} +pub struct Nursery { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow await inside loops."] # [serde (skip_serializing_if = "Option::is_none")] pub no_await_in_loop : Option < RuleConfiguration < biome_rule_options :: no_await_in_loop :: NoAwaitInLoopOptions >> , # [doc = "Disallow bitwise operators."] # [serde (skip_serializing_if = "Option::is_none")] pub no_bitwise_operators : Option < RuleConfiguration < biome_rule_options :: no_bitwise_operators :: NoBitwiseOperatorsOptions >> , # [doc = "Disallow expressions where the operation doesn't affect the value"] # [serde (skip_serializing_if = "Option::is_none")] pub no_constant_binary_expression : Option < RuleConfiguration < biome_rule_options :: no_constant_binary_expression :: NoConstantBinaryExpressionOptions >> , # [doc = "Disallow destructuring props inside JSX components in Solid projects."] # [serde (skip_serializing_if = "Option::is_none")] pub no_destructured_props : Option < RuleConfiguration < biome_rule_options :: no_destructured_props :: NoDestructuredPropsOptions >> , # [doc = "Restrict the number of lines of code in a function."] # [serde (skip_serializing_if = "Option::is_none")] pub no_excessive_lines_per_function : Option < RuleConfiguration < biome_rule_options :: no_excessive_lines_per_function :: NoExcessiveLinesPerFunctionOptions >> , # [doc = "Require Promise-like statements to be handled appropriately."] # [serde (skip_serializing_if = "Option::is_none")] pub no_floating_promises : Option < RuleFixConfiguration < biome_rule_options :: no_floating_promises :: NoFloatingPromisesOptions >> , # [doc = "Disallow the use of __dirname and __filename in the global scope."] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_dirname_filename : Option < RuleFixConfiguration < biome_rule_options :: no_global_dirname_filename :: NoGlobalDirnameFilenameOptions >> , # [doc = "Disallow shorthand type conversions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_implicit_coercion : Option < RuleFixConfiguration < biome_rule_options :: no_implicit_coercion :: NoImplicitCoercionOptions >> , # [doc = "Prevent import cycles."] # [serde (skip_serializing_if = "Option::is_none")] pub no_import_cycles : Option < RuleConfiguration < biome_rule_options :: no_import_cycles :: NoImportCyclesOptions >> , # [doc = "Disallow the use of the !important style."] # [serde (skip_serializing_if = "Option::is_none")] pub no_important_styles : Option < RuleFixConfiguration < biome_rule_options :: no_important_styles :: NoImportantStylesOptions >> , # [doc = "Reports usage of \"magic numbers\" — numbers used directly instead of being assigned to named constants."] # [serde (skip_serializing_if = "Option::is_none")] pub no_magic_numbers : Option < RuleConfiguration < biome_rule_options :: no_magic_numbers :: NoMagicNumbersOptions >> , # [doc = "Disallows defining React components inside other components."] # [serde (skip_serializing_if = "Option::is_none")] pub no_nested_component_definitions : Option < RuleConfiguration < biome_rule_options :: no_nested_component_definitions :: NoNestedComponentDefinitionsOptions >> , # [doc = "Disallow use event handlers on non-interactive elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_noninteractive_element_interactions : Option < RuleConfiguration < biome_rule_options :: no_noninteractive_element_interactions :: NoNoninteractiveElementInteractionsOptions >> , # [doc = "Disallow the use of process global."] # [serde (skip_serializing_if = "Option::is_none")] pub no_process_global : Option < RuleFixConfiguration < biome_rule_options :: no_process_global :: NoProcessGlobalOptions >> , # [doc = "Disallow assigning to React component props."] # [serde (skip_serializing_if = "Option::is_none")] pub no_react_prop_assign : Option < RuleConfiguration < biome_rule_options :: no_react_prop_assign :: NoReactPropAssignOptions >> , # [doc = "Disallow the use of configured elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_restricted_elements : Option < RuleConfiguration < biome_rule_options :: no_restricted_elements :: NoRestrictedElementsOptions >> , # [doc = "Disallow usage of sensitive data such as API keys and tokens."] # [serde (skip_serializing_if = "Option::is_none")] pub no_secrets : Option < RuleConfiguration < biome_rule_options :: no_secrets :: NoSecretsOptions >> , # [doc = "Disallow variable declarations from shadowing variables declared in the outer scope."] # [serde (skip_serializing_if = "Option::is_none")] pub no_shadow : Option < RuleConfiguration < biome_rule_options :: no_shadow :: NoShadowOptions >> , # [doc = "Prevents the use of the TypeScript directive @ts-ignore."] # [serde (skip_serializing_if = "Option::is_none")] pub no_ts_ignore : Option < RuleFixConfiguration < biome_rule_options :: no_ts_ignore :: NoTsIgnoreOptions >> , # [doc = "Disallow let or var variables that are read but never assigned."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unassigned_variables : Option < RuleConfiguration < biome_rule_options :: no_unassigned_variables :: NoUnassignedVariablesOptions >> , # [doc = "Disallow unknown at-rules."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unknown_at_rule : Option < RuleConfiguration < biome_rule_options :: no_unknown_at_rule :: NoUnknownAtRuleOptions >> , # [doc = "Warn when importing non-existing exports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unresolved_imports : Option < RuleConfiguration < biome_rule_options :: no_unresolved_imports :: NoUnresolvedImportsOptions >> , # [doc = "Prevent duplicate polyfills from Polyfill.io."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unwanted_polyfillio : Option < RuleConfiguration < biome_rule_options :: no_unwanted_polyfillio :: NoUnwantedPolyfillioOptions >> , # [doc = "Disallow useless backreferences in regular expression literals that always match an empty string."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_backref_in_regex : Option < RuleConfiguration < biome_rule_options :: no_useless_backref_in_regex :: NoUselessBackrefInRegexOptions >> , # [doc = "Disallow unnecessary escapes in string literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_escape_in_string : Option < RuleFixConfiguration < biome_rule_options :: no_useless_escape_in_string :: NoUselessEscapeInStringOptions >> , # [doc = "Disallow the use of useless undefined."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_undefined : Option < RuleFixConfiguration < biome_rule_options :: no_useless_undefined :: NoUselessUndefinedOptions >> , # [doc = "Enforce that getters and setters for the same property are adjacent in class and object definitions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_adjacent_getter_setter : Option < RuleConfiguration < biome_rule_options :: use_adjacent_getter_setter :: UseAdjacentGetterSetterOptions >> , # [doc = "Require the consistent declaration of object literals. Defaults to explicit definitions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_object_definition : Option < RuleFixConfiguration < biome_rule_options :: use_consistent_object_definition :: UseConsistentObjectDefinitionOptions >> , # [doc = "Use static Response methods instead of new Response() constructor when possible."] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_response : Option < RuleFixConfiguration < biome_rule_options :: use_consistent_response :: UseConsistentResponseOptions >> , # [doc = "Require switch-case statements to be exhaustive."] # [serde (skip_serializing_if = "Option::is_none")] pub use_exhaustive_switch_cases : Option < RuleFixConfiguration < biome_rule_options :: use_exhaustive_switch_cases :: UseExhaustiveSwitchCasesOptions >> , # [doc = "Enforce types in functions, methods, variables, and parameters."] # [serde (skip_serializing_if = "Option::is_none")] pub use_explicit_type : Option < RuleConfiguration < biome_rule_options :: use_explicit_type :: UseExplicitTypeOptions >> , # [doc = "Require that all exports are declared after all non-export statements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_exports_last : Option < RuleConfiguration < biome_rule_options :: use_exports_last :: UseExportsLastOptions >> , # [doc = "Enforce using Solid's \\ component for mapping an array to JSX elements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_for_component : Option < RuleConfiguration < biome_rule_options :: use_for_component :: UseForComponentOptions >> , # [doc = "Ensure the preconnect attribute is used when using Google Fonts."] # [serde (skip_serializing_if = "Option::is_none")] pub use_google_font_preconnect : Option < RuleFixConfiguration < biome_rule_options :: use_google_font_preconnect :: UseGoogleFontPreconnectOptions >> , # [doc = "Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item."] # [serde (skip_serializing_if = "Option::is_none")] pub use_index_of : Option < RuleFixConfiguration < biome_rule_options :: use_index_of :: UseIndexOfOptions >> , # [doc = "Enforce consistent return values in iterable callbacks."] # [serde (skip_serializing_if = "Option::is_none")] pub use_iterable_callback_return : Option < RuleConfiguration < biome_rule_options :: use_iterable_callback_return :: UseIterableCallbackReturnOptions >> , # [doc = "Enforces the use of with { type: \"json\" } for JSON module imports."] # [serde (skip_serializing_if = "Option::is_none")] pub use_json_import_attribute : Option < RuleFixConfiguration < biome_rule_options :: use_json_import_attribute :: UseJsonImportAttributeOptions >> , # [doc = "Enforce specifying the name of GraphQL operations."] # [serde (skip_serializing_if = "Option::is_none")] pub use_named_operation : Option < RuleFixConfiguration < biome_rule_options :: use_named_operation :: UseNamedOperationOptions >> , # [doc = "Validates that all enum values are capitalized."] # [serde (skip_serializing_if = "Option::is_none")] pub use_naming_convention : Option < RuleConfiguration < biome_rule_options :: use_naming_convention :: UseNamingConventionOptions >> , # [doc = "Enforce the use of numeric separators in numeric literals."] # [serde (skip_serializing_if = "Option::is_none")] pub use_numeric_separators : Option < RuleFixConfiguration < biome_rule_options :: use_numeric_separators :: UseNumericSeparatorsOptions >> , # [doc = "Prefer object spread over Object.assign() when constructing new objects."] # [serde (skip_serializing_if = "Option::is_none")] pub use_object_spread : Option < RuleFixConfiguration < biome_rule_options :: use_object_spread :: UseObjectSpreadOptions >> , # [doc = "Enforce the consistent use of the radix argument when using parseInt()."] # [serde (skip_serializing_if = "Option::is_none")] pub use_parse_int_radix : Option < RuleFixConfiguration < biome_rule_options :: use_parse_int_radix :: UseParseIntRadixOptions >> , # [doc = "Enforce marking members as readonly if they are never modified outside the constructor."] # [serde (skip_serializing_if = "Option::is_none")] pub use_readonly_class_properties : Option < RuleFixConfiguration < biome_rule_options :: use_readonly_class_properties :: UseReadonlyClassPropertiesOptions >> , # [doc = "Enforce JSDoc comment lines to start with a single asterisk, except for the first one."] # [serde (skip_serializing_if = "Option::is_none")] pub use_single_js_doc_asterisk : Option < RuleFixConfiguration < biome_rule_options :: use_single_js_doc_asterisk :: UseSingleJsDocAsteriskOptions >> , # [doc = "Enforce the sorting of CSS utility classes."] # [serde (skip_serializing_if = "Option::is_none")] pub use_sorted_classes : Option < RuleFixConfiguration < biome_rule_options :: use_sorted_classes :: UseSortedClassesOptions >> , # [doc = "Require a description parameter for the Symbol()."] # [serde (skip_serializing_if = "Option::is_none")] pub use_symbol_description : Option < RuleConfiguration < biome_rule_options :: use_symbol_description :: UseSymbolDescriptionOptions >> , # [doc = "Disallow overload signatures that can be unified into a single signature."] # [serde (skip_serializing_if = "Option::is_none")] pub use_unified_type_signature : Option < RuleFixConfiguration < biome_rule_options :: use_unified_type_signature :: UseUnifiedTypeSignatureOptions >> , # [doc = "Prevent the usage of static string literal id attribute on elements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_unique_element_ids : Option < RuleConfiguration < biome_rule_options :: use_unique_element_ids :: UseUniqueElementIdsOptions >> } impl Nursery { const GROUP_NAME: &'static str = "nursery"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -5812,38 +5139,7 @@ impl From for Nursery { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Performance { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow the use of spread (...) syntax on accumulators."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_accumulating_spread: - Option>, - #[doc = "Disallow the use of barrel file."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_barrel_file: Option>, - #[doc = "Disallow the use of the delete operator."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_delete: Option>, - #[doc = "Disallow accessing namespace imports dynamically."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_dynamic_namespace_import_access: - Option>, - #[doc = "Prevent usage of \\ element in a Next.js project."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_img_element: Option>, - #[doc = "Disallow the use of namespace imports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_namespace_import: - Option>, - #[doc = "Avoid re-export all."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_re_export_all: Option>, - #[doc = "Require regex literals to be declared at the top level."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_top_level_regex: Option>, -} +pub struct Performance { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow the use of spread (...) syntax on accumulators."] # [serde (skip_serializing_if = "Option::is_none")] pub no_accumulating_spread : Option < RuleConfiguration < biome_rule_options :: no_accumulating_spread :: NoAccumulatingSpreadOptions >> , # [doc = "Disallow the use of barrel file."] # [serde (skip_serializing_if = "Option::is_none")] pub no_barrel_file : Option < RuleConfiguration < biome_rule_options :: no_barrel_file :: NoBarrelFileOptions >> , # [doc = "Disallow the use of the delete operator."] # [serde (skip_serializing_if = "Option::is_none")] pub no_delete : Option < RuleFixConfiguration < biome_rule_options :: no_delete :: NoDeleteOptions >> , # [doc = "Disallow accessing namespace imports dynamically."] # [serde (skip_serializing_if = "Option::is_none")] pub no_dynamic_namespace_import_access : Option < RuleConfiguration < biome_rule_options :: no_dynamic_namespace_import_access :: NoDynamicNamespaceImportAccessOptions >> , # [doc = "Prevent usage of \\ element in a Next.js project."] # [serde (skip_serializing_if = "Option::is_none")] pub no_img_element : Option < RuleConfiguration < biome_rule_options :: no_img_element :: NoImgElementOptions >> , # [doc = "Disallow the use of namespace imports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_namespace_import : Option < RuleConfiguration < biome_rule_options :: no_namespace_import :: NoNamespaceImportOptions >> , # [doc = "Avoid re-export all."] # [serde (skip_serializing_if = "Option::is_none")] pub no_re_export_all : Option < RuleConfiguration < biome_rule_options :: no_re_export_all :: NoReExportAllOptions >> , # [doc = "Require regex literals to be declared at the top level."] # [serde (skip_serializing_if = "Option::is_none")] pub use_top_level_regex : Option < RuleConfiguration < biome_rule_options :: use_top_level_regex :: UseTopLevelRegexOptions >> } impl Performance { const GROUP_NAME: &'static str = "performance"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -6049,25 +5345,7 @@ impl From for Performance { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Security { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow target=\"_blank\" attribute without rel=\"noopener\"."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_blank_target: Option>, - #[doc = "Prevent the usage of dangerous JSX props"] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow the use of global eval()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_eval: Option>, -} +pub struct Security { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow target=\"_blank\" attribute without rel=\"noopener\"."] # [serde (skip_serializing_if = "Option::is_none")] pub no_blank_target : Option < RuleFixConfiguration < biome_rule_options :: no_blank_target :: NoBlankTargetOptions >> , # [doc = "Prevent the usage of dangerous JSX props"] # [serde (skip_serializing_if = "Option::is_none")] pub no_dangerously_set_inner_html : Option < RuleConfiguration < biome_rule_options :: no_dangerously_set_inner_html :: NoDangerouslySetInnerHtmlOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_dangerously_set_inner_html_with_children :: NoDangerouslySetInnerHtmlWithChildrenOptions >> , # [doc = "Disallow the use of global eval()."] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_eval : Option < RuleConfiguration < biome_rule_options :: no_global_eval :: NoGlobalEvalOptions >> } impl Security { const GROUP_NAME: &'static str = "security"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -6207,236 +5485,7 @@ impl From for Security { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Style { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow use of CommonJs module system in favor of ESM style imports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_common_js: Option>, - #[doc = "Disallow default exports."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_default_export: Option>, - #[doc = "Disallow a lower specificity selector from coming after a higher specificity selector."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_descending_specificity: - Option>, - #[doc = "Disallow using a callback in asynchronous tests and hooks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_done_callback: Option>, - #[doc = "Disallow TypeScript enum."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_enum: Option>, - #[doc = "Disallow exporting an imported variable."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_exported_imports: - Option>, - #[doc = "Prevent usage of \\ element in a Next.js project."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_head_element: Option>, - #[doc = "Disallow implicit true values on JSX boolean attributes"] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow the use of TypeScript's namespaces."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow nested ternary expressions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_nested_ternary: Option>, - #[doc = "Disallow non-null assertions using the ! postfix operator."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_non_null_assertion: - Option>, - #[doc = "Disallow reassigning function parameters."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow the use of process.env."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_process_env: 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>, - #[doc = "Disallow specified modules when loaded by import or require."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_restricted_imports: - Option>, - #[doc = "Disallow user defined types."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_restricted_types: - 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>, - #[doc = "Enforce the use of String.slice() over String.substr() and String.substring()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_substr: 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>, - #[doc = "Disallow else block when the if block breaks early."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_useless_else: Option>, - #[doc = "Disallow use of @value rule in css modules."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_value_at_rule: Option>, - #[doc = "Disallow the use of yoda expressions."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_yoda_expression: - Option>, - #[doc = "Disallow Array constructors."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_array_literals: - 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>, - #[doc = "Use at() instead of integer index access."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_at_index: Option>, - #[doc = "Requires following curly brace conventions."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Enforce using single if instead of nested if clauses."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_collapsed_if: Option>, - #[doc = "Enforce declaring components only within modules that export React Components exclusively."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_component_export_only_modules: - Option>, - #[doc = "Require consistently using either T\\[] or Array\\"] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_array_type: - Option>, - #[doc = "Enforce the use of new for all builtins, except String, Number and Boolean."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_builtin_instantiation: - Option>, - #[doc = "This rule enforces consistent use of curly braces inside JSX attributes and JSX children."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_curly_braces: - Option>, - #[doc = "Require consistent accessibility modifiers on class properties and methods."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_consistent_member_accessibility: - Option>, - #[doc = "Require const declarations for variables that are only assigned once."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Require the default clause in switch statements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_default_switch_clause: - Option>, - #[doc = "Require specifying the reason argument when using @deprecated directive"] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_deprecated_reason: - Option>, - #[doc = "Require that each enum member value be explicitly initialized."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_enum_initializers: - Option>, - #[doc = "Enforce explicitly comparing the length, size, byteLength or byteOffset property of a value."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_explicit_length_check: - 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>, - #[doc = "Promotes the use of export type for types."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[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>, - #[doc = "This rule enforces the use of \\<>...\\ over \\...\\."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_fragment_syntax: - Option>, - #[doc = "Promotes the use of import type for types."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_import_type: Option>, - #[doc = "Require all enum members to be literal values."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Promotes the usage of node:assert/strict over node:assert."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Use the Number properties instead of global ones."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_number_namespace: - Option>, - #[doc = "Prevent extra closing tags for components without children."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_self_closing_elements: - Option>, - #[doc = "Require assignment operator shorthand where possible."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_shorthand_assign: - 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>, - #[doc = "Disallow multiple variable declarations in the same variable statement"] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_single_var_declarator: - Option>, - #[doc = "Prefer template literals over string concatenation."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_template: Option>, - #[doc = "Require new when throwing an error."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_throw_new_error: - Option>, - #[doc = "Disallow throwing non-Error values."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_throw_only_error: - Option>, - #[doc = "Enforce the use of String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_trim_start_end: - Option>, -} +pub struct Style { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow use of CommonJs module system in favor of ESM style imports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_common_js : Option < RuleConfiguration < biome_rule_options :: no_common_js :: NoCommonJsOptions >> , # [doc = "Disallow default exports."] # [serde (skip_serializing_if = "Option::is_none")] pub no_default_export : Option < RuleConfiguration < biome_rule_options :: no_default_export :: NoDefaultExportOptions >> , # [doc = "Disallow a lower specificity selector from coming after a higher specificity selector."] # [serde (skip_serializing_if = "Option::is_none")] pub no_descending_specificity : Option < RuleConfiguration < biome_rule_options :: no_descending_specificity :: NoDescendingSpecificityOptions >> , # [doc = "Disallow using a callback in asynchronous tests and hooks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_done_callback : Option < RuleConfiguration < biome_rule_options :: no_done_callback :: NoDoneCallbackOptions >> , # [doc = "Disallow TypeScript enum."] # [serde (skip_serializing_if = "Option::is_none")] pub no_enum : Option < RuleConfiguration < biome_rule_options :: no_enum :: NoEnumOptions >> , # [doc = "Disallow exporting an imported variable."] # [serde (skip_serializing_if = "Option::is_none")] pub no_exported_imports : Option < RuleConfiguration < biome_rule_options :: no_exported_imports :: NoExportedImportsOptions >> , # [doc = "Prevent usage of \\ element in a Next.js project."] # [serde (skip_serializing_if = "Option::is_none")] pub no_head_element : Option < RuleConfiguration < biome_rule_options :: no_head_element :: NoHeadElementOptions >> , # [doc = "Disallow implicit true values on JSX boolean attributes"] # [serde (skip_serializing_if = "Option::is_none")] pub no_implicit_boolean : Option < RuleFixConfiguration < biome_rule_options :: no_implicit_boolean :: NoImplicitBooleanOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_inferrable_types :: NoInferrableTypesOptions >> , # [doc = "Disallow the use of TypeScript's namespaces."] # [serde (skip_serializing_if = "Option::is_none")] pub no_namespace : Option < RuleConfiguration < biome_rule_options :: no_namespace :: NoNamespaceOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_negation_else :: NoNegationElseOptions >> , # [doc = "Disallow nested ternary expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_nested_ternary : Option < RuleConfiguration < biome_rule_options :: no_nested_ternary :: NoNestedTernaryOptions >> , # [doc = "Disallow non-null assertions using the ! postfix operator."] # [serde (skip_serializing_if = "Option::is_none")] pub no_non_null_assertion : Option < RuleFixConfiguration < biome_rule_options :: no_non_null_assertion :: NoNonNullAssertionOptions >> , # [doc = "Disallow reassigning function parameters."] # [serde (skip_serializing_if = "Option::is_none")] pub no_parameter_assign : Option < RuleConfiguration < biome_rule_options :: no_parameter_assign :: NoParameterAssignOptions >> , # [doc = "Disallow the use of parameter properties in class constructors."] # [serde (skip_serializing_if = "Option::is_none")] pub no_parameter_properties : Option < RuleConfiguration < biome_rule_options :: no_parameter_properties :: NoParameterPropertiesOptions >> , # [doc = "Disallow the use of process.env."] # [serde (skip_serializing_if = "Option::is_none")] pub no_process_env : Option < RuleConfiguration < biome_rule_options :: no_process_env :: NoProcessEnvOptions >> , # [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 < RuleConfiguration < biome_rule_options :: no_restricted_globals :: NoRestrictedGlobalsOptions >> , # [doc = "Disallow specified modules when loaded by import or require."] # [serde (skip_serializing_if = "Option::is_none")] pub no_restricted_imports : Option < RuleConfiguration < biome_rule_options :: no_restricted_imports :: NoRestrictedImportsOptions >> , # [doc = "Disallow user defined types."] # [serde (skip_serializing_if = "Option::is_none")] pub no_restricted_types : Option < RuleFixConfiguration < biome_rule_options :: no_restricted_types :: NoRestrictedTypesOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_shouty_constants :: NoShoutyConstantsOptions >> , # [doc = "Enforce the use of String.slice() over String.substr() and String.substring()."] # [serde (skip_serializing_if = "Option::is_none")] pub no_substr : Option < RuleFixConfiguration < biome_rule_options :: no_substr :: NoSubstrOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_unused_template_literal :: NoUnusedTemplateLiteralOptions >> , # [doc = "Disallow else block when the if block breaks early."] # [serde (skip_serializing_if = "Option::is_none")] pub no_useless_else : Option < RuleFixConfiguration < biome_rule_options :: no_useless_else :: NoUselessElseOptions >> , # [doc = "Disallow use of @value rule in css modules."] # [serde (skip_serializing_if = "Option::is_none")] pub no_value_at_rule : Option < RuleConfiguration < biome_rule_options :: no_value_at_rule :: NoValueAtRuleOptions >> , # [doc = "Disallow the use of yoda expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_yoda_expression : Option < RuleFixConfiguration < biome_rule_options :: no_yoda_expression :: NoYodaExpressionOptions >> , # [doc = "Disallow Array constructors."] # [serde (skip_serializing_if = "Option::is_none")] pub use_array_literals : Option < RuleFixConfiguration < biome_rule_options :: use_array_literals :: UseArrayLiteralsOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_as_const_assertion :: UseAsConstAssertionOptions >> , # [doc = "Use at() instead of integer index access."] # [serde (skip_serializing_if = "Option::is_none")] pub use_at_index : Option < RuleFixConfiguration < biome_rule_options :: use_at_index :: UseAtIndexOptions >> , # [doc = "Requires following curly brace conventions."] # [serde (skip_serializing_if = "Option::is_none")] pub use_block_statements : Option < RuleFixConfiguration < biome_rule_options :: use_block_statements :: UseBlockStatementsOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_collapsed_else_if :: UseCollapsedElseIfOptions >> , # [doc = "Enforce using single if instead of nested if clauses."] # [serde (skip_serializing_if = "Option::is_none")] pub use_collapsed_if : Option < RuleFixConfiguration < biome_rule_options :: use_collapsed_if :: UseCollapsedIfOptions >> , # [doc = "Enforce declaring components only within modules that export React Components exclusively."] # [serde (skip_serializing_if = "Option::is_none")] pub use_component_export_only_modules : Option < RuleConfiguration < biome_rule_options :: use_component_export_only_modules :: UseComponentExportOnlyModulesOptions >> , # [doc = "Require consistently using either T\\[] or Array\\"] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_array_type : Option < RuleFixConfiguration < biome_rule_options :: use_consistent_array_type :: UseConsistentArrayTypeOptions >> , # [doc = "Enforce the use of new for all builtins, except String, Number and Boolean."] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_builtin_instantiation : Option < RuleFixConfiguration < biome_rule_options :: use_consistent_builtin_instantiation :: UseConsistentBuiltinInstantiationOptions >> , # [doc = "This rule enforces consistent use of curly braces inside JSX attributes and JSX children."] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_curly_braces : Option < RuleFixConfiguration < biome_rule_options :: use_consistent_curly_braces :: UseConsistentCurlyBracesOptions >> , # [doc = "Require consistent accessibility modifiers on class properties and methods."] # [serde (skip_serializing_if = "Option::is_none")] pub use_consistent_member_accessibility : Option < RuleConfiguration < biome_rule_options :: use_consistent_member_accessibility :: UseConsistentMemberAccessibilityOptions >> , # [doc = "Require const declarations for variables that are only assigned once."] # [serde (skip_serializing_if = "Option::is_none")] pub use_const : Option < RuleFixConfiguration < biome_rule_options :: use_const :: UseConstOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_default_parameter_last :: UseDefaultParameterLastOptions >> , # [doc = "Require the default clause in switch statements."] # [serde (skip_serializing_if = "Option::is_none")] pub use_default_switch_clause : Option < RuleConfiguration < biome_rule_options :: use_default_switch_clause :: UseDefaultSwitchClauseOptions >> , # [doc = "Require specifying the reason argument when using @deprecated directive"] # [serde (skip_serializing_if = "Option::is_none")] pub use_deprecated_reason : Option < RuleConfiguration < biome_rule_options :: use_deprecated_reason :: UseDeprecatedReasonOptions >> , # [doc = "Require that each enum member value be explicitly initialized."] # [serde (skip_serializing_if = "Option::is_none")] pub use_enum_initializers : Option < RuleFixConfiguration < biome_rule_options :: use_enum_initializers :: UseEnumInitializersOptions >> , # [doc = "Enforce explicitly comparing the length, size, byteLength or byteOffset property of a value."] # [serde (skip_serializing_if = "Option::is_none")] pub use_explicit_length_check : Option < RuleFixConfiguration < biome_rule_options :: use_explicit_length_check :: UseExplicitLengthCheckOptions >> , # [doc = "Disallow the use of Math.pow in favor of the ** operator."] # [serde (skip_serializing_if = "Option::is_none")] pub use_exponentiation_operator : Option < RuleFixConfiguration < biome_rule_options :: use_exponentiation_operator :: UseExponentiationOperatorOptions >> , # [doc = "Promotes the use of export type for types."] # [serde (skip_serializing_if = "Option::is_none")] pub use_export_type : Option < RuleFixConfiguration < biome_rule_options :: use_export_type :: UseExportTypeOptions >> , # [doc = "Enforce naming conventions for JavaScript and TypeScript filenames."] # [serde (skip_serializing_if = "Option::is_none")] pub use_filenaming_convention : Option < RuleConfiguration < biome_rule_options :: use_filenaming_convention :: UseFilenamingConventionOptions >> , # [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 < RuleConfiguration < biome_rule_options :: use_for_of :: UseForOfOptions >> , # [doc = "This rule enforces the use of \\<>...\\ over \\...\\."] # [serde (skip_serializing_if = "Option::is_none")] pub use_fragment_syntax : Option < RuleFixConfiguration < biome_rule_options :: use_fragment_syntax :: UseFragmentSyntaxOptions >> , # [doc = "Promotes the use of import type for types."] # [serde (skip_serializing_if = "Option::is_none")] pub use_import_type : Option < RuleFixConfiguration < biome_rule_options :: use_import_type :: UseImportTypeOptions >> , # [doc = "Require all enum members to be literal values."] # [serde (skip_serializing_if = "Option::is_none")] pub use_literal_enum_members : Option < RuleConfiguration < biome_rule_options :: use_literal_enum_members :: UseLiteralEnumMembersOptions >> , # [doc = "Enforce naming conventions for everything across a codebase."] # [serde (skip_serializing_if = "Option::is_none")] pub use_naming_convention : Option < RuleFixConfiguration < biome_rule_options :: use_naming_convention :: UseNamingConventionOptions >> , # [doc = "Promotes the usage of node:assert/strict over node:assert."] # [serde (skip_serializing_if = "Option::is_none")] pub use_node_assert_strict : Option < RuleFixConfiguration < biome_rule_options :: use_node_assert_strict :: UseNodeAssertStrictOptions >> , # [doc = "Enforces using the node: protocol for Node.js builtin modules."] # [serde (skip_serializing_if = "Option::is_none")] pub use_nodejs_import_protocol : Option < RuleFixConfiguration < biome_rule_options :: use_nodejs_import_protocol :: UseNodejsImportProtocolOptions >> , # [doc = "Use the Number properties instead of global ones."] # [serde (skip_serializing_if = "Option::is_none")] pub use_number_namespace : Option < RuleFixConfiguration < biome_rule_options :: use_number_namespace :: UseNumberNamespaceOptions >> , # [doc = "Prevent extra closing tags for components without children."] # [serde (skip_serializing_if = "Option::is_none")] pub use_self_closing_elements : Option < RuleFixConfiguration < biome_rule_options :: use_self_closing_elements :: UseSelfClosingElementsOptions >> , # [doc = "Require assignment operator shorthand where possible."] # [serde (skip_serializing_if = "Option::is_none")] pub use_shorthand_assign : Option < RuleFixConfiguration < biome_rule_options :: use_shorthand_assign :: UseShorthandAssignOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_shorthand_function_type :: UseShorthandFunctionTypeOptions >> , # [doc = "Disallow multiple variable declarations in the same variable statement"] # [serde (skip_serializing_if = "Option::is_none")] pub use_single_var_declarator : Option < RuleFixConfiguration < biome_rule_options :: use_single_var_declarator :: UseSingleVarDeclaratorOptions >> , # [doc = "Prefer template literals over string concatenation."] # [serde (skip_serializing_if = "Option::is_none")] pub use_template : Option < RuleFixConfiguration < biome_rule_options :: use_template :: UseTemplateOptions >> , # [doc = "Require new when throwing an error."] # [serde (skip_serializing_if = "Option::is_none")] pub use_throw_new_error : Option < RuleFixConfiguration < biome_rule_options :: use_throw_new_error :: UseThrowNewErrorOptions >> , # [doc = "Disallow throwing non-Error values."] # [serde (skip_serializing_if = "Option::is_none")] pub use_throw_only_error : Option < RuleConfiguration < biome_rule_options :: use_throw_only_error :: UseThrowOnlyErrorOptions >> , # [doc = "Enforce the use of String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight()."] # [serde (skip_serializing_if = "Option::is_none")] pub use_trim_start_end : Option < RuleFixConfiguration < biome_rule_options :: use_trim_start_end :: UseTrimStartEndOptions >> } impl Style { const GROUP_NAME: &'static str = "style"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ @@ -7553,303 +6602,7 @@ impl From for Style { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] #[doc = r" A list of rules that belong to this group"] -pub struct Suspicious { - #[doc = r" It enables the recommended rules for this group"] - #[serde(skip_serializing_if = "Option::is_none")] - pub recommended: Option, - #[doc = "Disallow the use of alert, confirm, and prompt."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_alert: Option>, - #[doc = "Use standard constants instead of approximated literals."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow assignments in expressions."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow reassigning exceptions in catch clauses."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_catch_assign: Option>, - #[doc = "Disallow reassigning class members."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow comparing against -0"] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow void type outside of generic or return types."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_confusing_void_type: - Option>, - #[doc = "Disallow the use of console."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_console: Option>, - #[doc = "Disallow TypeScript const enum"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_const_enum: Option>, - #[doc = "Prevents from having control characters and some escape sequences that match control characters in regular expression literals."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_control_characters_in_regex: - Option>, - #[doc = "Disallow the use of debugger"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_debugger: Option>, - #[doc = "Disallow direct assignments to document.cookie."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_document_cookie: Option>, - #[doc = "Prevents importing next/document outside of pages/_document.jsx in Next.js projects."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_document_import_in_page: - Option>, - #[doc = "Require the use of === and !==."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_double_equals: Option>, - #[doc = "Disallow duplicate @import rules."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_at_import_rules: - Option>, - #[doc = "Disallow duplicate case labels."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_case: Option>, - #[doc = "Disallow duplicate class members."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_class_members: - Option>, - #[doc = "Disallow duplicate custom properties within declaration blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_custom_properties: - Option>, - #[doc = "Disallow duplicate conditions in if-else-if chains"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_else_if: - Option>, - #[doc = "No duplicated fields in GraphQL operations."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_fields: - Option>, - #[doc = "Disallow duplicate names within font families."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_font_names: - Option>, - #[doc = "Prevents JSX properties to be assigned multiple times."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_jsx_props: - Option>, - #[doc = "Disallow two keys with the same name inside objects."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_object_keys: - Option>, - #[doc = "Disallow duplicate function parameter name."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_parameters: - Option>, - #[doc = "Disallow duplicate properties within declaration blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_properties: - Option>, - #[doc = "Disallow duplicate selectors within keyframe blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_selectors_keyframe_block: - Option>, - #[doc = "A describe block should not contain duplicate hooks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_test_hooks: - Option>, - #[doc = "Disallow CSS empty blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_block: Option>, - #[doc = "Disallow empty block statements and static blocks."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_block_statements: - Option>, - #[doc = "Disallow the declaration of empty interfaces."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_empty_interface: - Option>, - #[doc = "Disallow variables from evolving into any type through reassignments."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_evolving_types: Option>, - #[doc = "Disallow the any type usage."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_explicit_any: Option>, - #[doc = "Disallow using export or module.exports in files containing tests"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_exports_in_test: 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>, - #[doc = "Disallow fallthrough of switch clauses."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_fallthrough_switch_clause: - Option>, - #[doc = "Disallow focused tests."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_focused_tests: Option>, - #[doc = "Disallow reassigning function declarations."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_function_assign: Option>, - #[doc = "Disallow assignments to native objects and read-only global variables."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_global_assign: Option>, - #[doc = "Use Number.isFinite instead of global isFinite."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Prevent using the next/head module in pages/_document.js on Next.js projects."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_head_import_in_document: - Option>, - #[doc = "Disallow use of implicit any type on variable declarations."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_implicit_any_let: Option>, - #[doc = "Disallow assigning to imported bindings"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_import_assign: Option>, - #[doc = "Disallow invalid !important within keyframe declarations"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_important_in_keyframe: - Option>, - #[doc = "Disallows the use of irregular whitespace characters."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_irregular_whitespace: - Option>, - #[doc = "Disallow labels that share a name with a variable"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_label_var: 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>, - #[doc = "Enforce proper usage of new and constructor."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_misleading_instantiator: - Option>, - #[doc = "Checks that the assertion function, for example expect, is placed inside an it() function call."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_misplaced_assertion: - Option>, - #[doc = "Disallow shorthand assign when variable appears on both sides."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_misrefactored_shorthand_assign: - Option>, - #[doc = "Disallow octal escape sequences in string literals"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_octal_escape: Option>, - #[doc = "Disallow direct use of Object.prototype builtins."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_prototype_builtins: - Option>, - #[doc = "Prevents React-specific JSX properties from being used."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_react_specific_props: - Option>, - #[doc = "Disallow variable, function, class, and type redeclarations in the same scope."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_redeclare: Option>, - #[doc = "Prevents from having redundant \"use strict\"."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Disallow identifiers from shadowing restricted names."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_shadow_restricted_names: - Option>, - #[doc = "Disallow shorthand properties that override related longhand properties."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_shorthand_property_overrides: - Option>, - #[doc = "Disallow disabled tests."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_skipped_tests: Option>, - #[doc = "Prevents the use of sparse arrays (arrays with holes)."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_sparse_array: Option>, - #[doc = "It detects possible \"wrong\" semicolons inside JSX elements."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_suspicious_semicolon_in_jsx: - Option>, - #[doc = "Disallow template literal placeholder syntax in regular strings."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_template_curly_in_string: - Option>, - #[doc = "Disallow then property."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_then_property: Option>, - #[doc = "Disallow unsafe declaration merging between interfaces and classes."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_declaration_merging: - Option>, - #[doc = "Disallow using unsafe negation."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_unsafe_negation: - Option>, - #[doc = "Disallow the use of var"] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_var: Option>, - #[doc = "Disallow with statements in non-strict contexts."] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_with: Option>, - #[doc = "Disallow the use of overload signatures that are not next to each other."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_adjacent_overload_signatures: - Option>, - #[doc = "Ensure async functions utilize await."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_await: 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>, - #[doc = "Enforce passing a message value when creating a built-in error."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_error_message: Option>, - #[doc = "Enforce get methods to always return a value."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_getter_return: Option>, - #[doc = "Enforces the use of a recommended display strategy with Google Fonts."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_google_font_display: - Option>, - #[doc = "Require for-in loops to include an if statement."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_guard_for_in: Option>, - #[doc = "Use Array.isArray() instead of instanceof Array."] - #[serde(skip_serializing_if = "Option::is_none")] - 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>, - #[doc = "Enforce using the digits argument with Number#toFixed()."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_number_to_fixed_digits_argument: - Option>, - #[doc = "Enforce the use of the directive \"use strict\" in script files."] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_strict_mode: Option>, -} +pub struct Suspicious { # [doc = r" It enables the recommended rules for this group"] # [serde (skip_serializing_if = "Option::is_none")] pub recommended : Option < bool > , # [doc = "Disallow the use of alert, confirm, and prompt."] # [serde (skip_serializing_if = "Option::is_none")] pub no_alert : Option < RuleConfiguration < biome_rule_options :: no_alert :: NoAlertOptions >> , # [doc = "Use standard constants instead of approximated literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_approximative_numeric_constant : Option < RuleFixConfiguration < biome_rule_options :: no_approximative_numeric_constant :: NoApproximativeNumericConstantOptions >> , # [doc = "Discourage the usage of Array index in keys."] # [serde (skip_serializing_if = "Option::is_none")] pub no_array_index_key : Option < RuleConfiguration < biome_rule_options :: no_array_index_key :: NoArrayIndexKeyOptions >> , # [doc = "Disallow assignments in expressions."] # [serde (skip_serializing_if = "Option::is_none")] pub no_assign_in_expressions : Option < RuleConfiguration < biome_rule_options :: no_assign_in_expressions :: NoAssignInExpressionsOptions >> , # [doc = "Disallows using an async function as a Promise executor."] # [serde (skip_serializing_if = "Option::is_none")] pub no_async_promise_executor : Option < RuleConfiguration < biome_rule_options :: no_async_promise_executor :: NoAsyncPromiseExecutorOptions >> , # [doc = "Disallow reassigning exceptions in catch clauses."] # [serde (skip_serializing_if = "Option::is_none")] pub no_catch_assign : Option < RuleConfiguration < biome_rule_options :: no_catch_assign :: NoCatchAssignOptions >> , # [doc = "Disallow reassigning class members."] # [serde (skip_serializing_if = "Option::is_none")] pub no_class_assign : Option < RuleConfiguration < biome_rule_options :: no_class_assign :: NoClassAssignOptions >> , # [doc = "Prevent comments from being inserted as text nodes"] # [serde (skip_serializing_if = "Option::is_none")] pub no_comment_text : Option < RuleFixConfiguration < biome_rule_options :: no_comment_text :: NoCommentTextOptions >> , # [doc = "Disallow comparing against -0"] # [serde (skip_serializing_if = "Option::is_none")] pub no_compare_neg_zero : Option < RuleFixConfiguration < biome_rule_options :: no_compare_neg_zero :: NoCompareNegZeroOptions >> , # [doc = "Disallow labeled statements that are not loops."] # [serde (skip_serializing_if = "Option::is_none")] pub no_confusing_labels : Option < RuleConfiguration < biome_rule_options :: no_confusing_labels :: NoConfusingLabelsOptions >> , # [doc = "Disallow void type outside of generic or return types."] # [serde (skip_serializing_if = "Option::is_none")] pub no_confusing_void_type : Option < RuleFixConfiguration < biome_rule_options :: no_confusing_void_type :: NoConfusingVoidTypeOptions >> , # [doc = "Disallow the use of console."] # [serde (skip_serializing_if = "Option::is_none")] pub no_console : Option < RuleFixConfiguration < biome_rule_options :: no_console :: NoConsoleOptions >> , # [doc = "Disallow TypeScript const enum"] # [serde (skip_serializing_if = "Option::is_none")] pub no_const_enum : Option < RuleFixConfiguration < biome_rule_options :: no_const_enum :: NoConstEnumOptions >> , # [doc = "Prevents from having control characters and some escape sequences that match control characters in regular expression literals."] # [serde (skip_serializing_if = "Option::is_none")] pub no_control_characters_in_regex : Option < RuleConfiguration < biome_rule_options :: no_control_characters_in_regex :: NoControlCharactersInRegexOptions >> , # [doc = "Disallow the use of debugger"] # [serde (skip_serializing_if = "Option::is_none")] pub no_debugger : Option < RuleFixConfiguration < biome_rule_options :: no_debugger :: NoDebuggerOptions >> , # [doc = "Disallow direct assignments to document.cookie."] # [serde (skip_serializing_if = "Option::is_none")] pub no_document_cookie : Option < RuleConfiguration < biome_rule_options :: no_document_cookie :: NoDocumentCookieOptions >> , # [doc = "Prevents importing next/document outside of pages/_document.jsx in Next.js projects."] # [serde (skip_serializing_if = "Option::is_none")] pub no_document_import_in_page : Option < RuleConfiguration < biome_rule_options :: no_document_import_in_page :: NoDocumentImportInPageOptions >> , # [doc = "Require the use of === and !==."] # [serde (skip_serializing_if = "Option::is_none")] pub no_double_equals : Option < RuleFixConfiguration < biome_rule_options :: no_double_equals :: NoDoubleEqualsOptions >> , # [doc = "Disallow duplicate @import rules."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_at_import_rules : Option < RuleConfiguration < biome_rule_options :: no_duplicate_at_import_rules :: NoDuplicateAtImportRulesOptions >> , # [doc = "Disallow duplicate case labels."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_case : Option < RuleConfiguration < biome_rule_options :: no_duplicate_case :: NoDuplicateCaseOptions >> , # [doc = "Disallow duplicate class members."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_class_members : Option < RuleConfiguration < biome_rule_options :: no_duplicate_class_members :: NoDuplicateClassMembersOptions >> , # [doc = "Disallow duplicate custom properties within declaration blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_custom_properties : Option < RuleConfiguration < biome_rule_options :: no_duplicate_custom_properties :: NoDuplicateCustomPropertiesOptions >> , # [doc = "Disallow duplicate conditions in if-else-if chains"] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_else_if : Option < RuleConfiguration < biome_rule_options :: no_duplicate_else_if :: NoDuplicateElseIfOptions >> , # [doc = "No duplicated fields in GraphQL operations."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_fields : Option < RuleConfiguration < biome_rule_options :: no_duplicate_fields :: NoDuplicateFieldsOptions >> , # [doc = "Disallow duplicate names within font families."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_font_names : Option < RuleConfiguration < biome_rule_options :: no_duplicate_font_names :: NoDuplicateFontNamesOptions >> , # [doc = "Prevents JSX properties to be assigned multiple times."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_jsx_props : Option < RuleConfiguration < biome_rule_options :: no_duplicate_jsx_props :: NoDuplicateJsxPropsOptions >> , # [doc = "Disallow two keys with the same name inside objects."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_object_keys : Option < RuleConfiguration < biome_rule_options :: no_duplicate_object_keys :: NoDuplicateObjectKeysOptions >> , # [doc = "Disallow duplicate function parameter name."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_parameters : Option < RuleConfiguration < biome_rule_options :: no_duplicate_parameters :: NoDuplicateParametersOptions >> , # [doc = "Disallow duplicate properties within declaration blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_properties : Option < RuleConfiguration < biome_rule_options :: no_duplicate_properties :: NoDuplicatePropertiesOptions >> , # [doc = "Disallow duplicate selectors within keyframe blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_selectors_keyframe_block : Option < RuleConfiguration < biome_rule_options :: no_duplicate_selectors_keyframe_block :: NoDuplicateSelectorsKeyframeBlockOptions >> , # [doc = "A describe block should not contain duplicate hooks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_duplicate_test_hooks : Option < RuleConfiguration < biome_rule_options :: no_duplicate_test_hooks :: NoDuplicateTestHooksOptions >> , # [doc = "Disallow CSS empty blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_block : Option < RuleConfiguration < biome_rule_options :: no_empty_block :: NoEmptyBlockOptions >> , # [doc = "Disallow empty block statements and static blocks."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_block_statements : Option < RuleConfiguration < biome_rule_options :: no_empty_block_statements :: NoEmptyBlockStatementsOptions >> , # [doc = "Disallow the declaration of empty interfaces."] # [serde (skip_serializing_if = "Option::is_none")] pub no_empty_interface : Option < RuleFixConfiguration < biome_rule_options :: no_empty_interface :: NoEmptyInterfaceOptions >> , # [doc = "Disallow variables from evolving into any type through reassignments."] # [serde (skip_serializing_if = "Option::is_none")] pub no_evolving_types : Option < RuleConfiguration < biome_rule_options :: no_evolving_types :: NoEvolvingTypesOptions >> , # [doc = "Disallow the any type usage."] # [serde (skip_serializing_if = "Option::is_none")] pub no_explicit_any : Option < RuleConfiguration < biome_rule_options :: no_explicit_any :: NoExplicitAnyOptions >> , # [doc = "Disallow using export or module.exports in files containing tests"] # [serde (skip_serializing_if = "Option::is_none")] pub no_exports_in_test : Option < RuleConfiguration < biome_rule_options :: no_exports_in_test :: NoExportsInTestOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_extra_non_null_assertion :: NoExtraNonNullAssertionOptions >> , # [doc = "Disallow fallthrough of switch clauses."] # [serde (skip_serializing_if = "Option::is_none")] pub no_fallthrough_switch_clause : Option < RuleConfiguration < biome_rule_options :: no_fallthrough_switch_clause :: NoFallthroughSwitchClauseOptions >> , # [doc = "Disallow focused tests."] # [serde (skip_serializing_if = "Option::is_none")] pub no_focused_tests : Option < RuleFixConfiguration < biome_rule_options :: no_focused_tests :: NoFocusedTestsOptions >> , # [doc = "Disallow reassigning function declarations."] # [serde (skip_serializing_if = "Option::is_none")] pub no_function_assign : Option < RuleConfiguration < biome_rule_options :: no_function_assign :: NoFunctionAssignOptions >> , # [doc = "Disallow assignments to native objects and read-only global variables."] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_assign : Option < RuleConfiguration < biome_rule_options :: no_global_assign :: NoGlobalAssignOptions >> , # [doc = "Use Number.isFinite instead of global isFinite."] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_is_finite : Option < RuleFixConfiguration < biome_rule_options :: no_global_is_finite :: NoGlobalIsFiniteOptions >> , # [doc = "Use Number.isNaN instead of global isNaN."] # [serde (skip_serializing_if = "Option::is_none")] pub no_global_is_nan : Option < RuleFixConfiguration < biome_rule_options :: no_global_is_nan :: NoGlobalIsNanOptions >> , # [doc = "Prevent using the next/head module in pages/_document.js on Next.js projects."] # [serde (skip_serializing_if = "Option::is_none")] pub no_head_import_in_document : Option < RuleConfiguration < biome_rule_options :: no_head_import_in_document :: NoHeadImportInDocumentOptions >> , # [doc = "Disallow use of implicit any type on variable declarations."] # [serde (skip_serializing_if = "Option::is_none")] pub no_implicit_any_let : Option < RuleConfiguration < biome_rule_options :: no_implicit_any_let :: NoImplicitAnyLetOptions >> , # [doc = "Disallow assigning to imported bindings"] # [serde (skip_serializing_if = "Option::is_none")] pub no_import_assign : Option < RuleConfiguration < biome_rule_options :: no_import_assign :: NoImportAssignOptions >> , # [doc = "Disallow invalid !important within keyframe declarations"] # [serde (skip_serializing_if = "Option::is_none")] pub no_important_in_keyframe : Option < RuleConfiguration < biome_rule_options :: no_important_in_keyframe :: NoImportantInKeyframeOptions >> , # [doc = "Disallows the use of irregular whitespace characters."] # [serde (skip_serializing_if = "Option::is_none")] pub no_irregular_whitespace : Option < RuleConfiguration < biome_rule_options :: no_irregular_whitespace :: NoIrregularWhitespaceOptions >> , # [doc = "Disallow labels that share a name with a variable"] # [serde (skip_serializing_if = "Option::is_none")] pub no_label_var : Option < RuleConfiguration < biome_rule_options :: no_label_var :: NoLabelVarOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: no_misleading_character_class :: NoMisleadingCharacterClassOptions >> , # [doc = "Enforce proper usage of new and constructor."] # [serde (skip_serializing_if = "Option::is_none")] pub no_misleading_instantiator : Option < RuleConfiguration < biome_rule_options :: no_misleading_instantiator :: NoMisleadingInstantiatorOptions >> , # [doc = "Checks that the assertion function, for example expect, is placed inside an it() function call."] # [serde (skip_serializing_if = "Option::is_none")] pub no_misplaced_assertion : Option < RuleConfiguration < biome_rule_options :: no_misplaced_assertion :: NoMisplacedAssertionOptions >> , # [doc = "Disallow shorthand assign when variable appears on both sides."] # [serde (skip_serializing_if = "Option::is_none")] pub no_misrefactored_shorthand_assign : Option < RuleFixConfiguration < biome_rule_options :: no_misrefactored_shorthand_assign :: NoMisrefactoredShorthandAssignOptions >> , # [doc = "Disallow octal escape sequences in string literals"] # [serde (skip_serializing_if = "Option::is_none")] pub no_octal_escape : Option < RuleFixConfiguration < biome_rule_options :: no_octal_escape :: NoOctalEscapeOptions >> , # [doc = "Disallow direct use of Object.prototype builtins."] # [serde (skip_serializing_if = "Option::is_none")] pub no_prototype_builtins : Option < RuleFixConfiguration < biome_rule_options :: no_prototype_builtins :: NoPrototypeBuiltinsOptions >> , # [doc = "Prevents React-specific JSX properties from being used."] # [serde (skip_serializing_if = "Option::is_none")] pub no_react_specific_props : Option < RuleFixConfiguration < biome_rule_options :: no_react_specific_props :: NoReactSpecificPropsOptions >> , # [doc = "Disallow variable, function, class, and type redeclarations in the same scope."] # [serde (skip_serializing_if = "Option::is_none")] pub no_redeclare : Option < RuleConfiguration < biome_rule_options :: no_redeclare :: NoRedeclareOptions >> , # [doc = "Prevents from having redundant \"use strict\"."] # [serde (skip_serializing_if = "Option::is_none")] pub no_redundant_use_strict : Option < RuleFixConfiguration < biome_rule_options :: no_redundant_use_strict :: NoRedundantUseStrictOptions >> , # [doc = "Disallow comparisons where both sides are exactly the same."] # [serde (skip_serializing_if = "Option::is_none")] pub no_self_compare : Option < RuleConfiguration < biome_rule_options :: no_self_compare :: NoSelfCompareOptions >> , # [doc = "Disallow identifiers from shadowing restricted names."] # [serde (skip_serializing_if = "Option::is_none")] pub no_shadow_restricted_names : Option < RuleConfiguration < biome_rule_options :: no_shadow_restricted_names :: NoShadowRestrictedNamesOptions >> , # [doc = "Disallow shorthand properties that override related longhand properties."] # [serde (skip_serializing_if = "Option::is_none")] pub no_shorthand_property_overrides : Option < RuleConfiguration < biome_rule_options :: no_shorthand_property_overrides :: NoShorthandPropertyOverridesOptions >> , # [doc = "Disallow disabled tests."] # [serde (skip_serializing_if = "Option::is_none")] pub no_skipped_tests : Option < RuleFixConfiguration < biome_rule_options :: no_skipped_tests :: NoSkippedTestsOptions >> , # [doc = "Prevents the use of sparse arrays (arrays with holes)."] # [serde (skip_serializing_if = "Option::is_none")] pub no_sparse_array : Option < RuleFixConfiguration < biome_rule_options :: no_sparse_array :: NoSparseArrayOptions >> , # [doc = "It detects possible \"wrong\" semicolons inside JSX elements."] # [serde (skip_serializing_if = "Option::is_none")] pub no_suspicious_semicolon_in_jsx : Option < RuleConfiguration < biome_rule_options :: no_suspicious_semicolon_in_jsx :: NoSuspiciousSemicolonInJsxOptions >> , # [doc = "Disallow template literal placeholder syntax in regular strings."] # [serde (skip_serializing_if = "Option::is_none")] pub no_template_curly_in_string : Option < RuleConfiguration < biome_rule_options :: no_template_curly_in_string :: NoTemplateCurlyInStringOptions >> , # [doc = "Disallow then property."] # [serde (skip_serializing_if = "Option::is_none")] pub no_then_property : Option < RuleConfiguration < biome_rule_options :: no_then_property :: NoThenPropertyOptions >> , # [doc = "Disallow unsafe declaration merging between interfaces and classes."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unsafe_declaration_merging : Option < RuleConfiguration < biome_rule_options :: no_unsafe_declaration_merging :: NoUnsafeDeclarationMergingOptions >> , # [doc = "Disallow using unsafe negation."] # [serde (skip_serializing_if = "Option::is_none")] pub no_unsafe_negation : Option < RuleFixConfiguration < biome_rule_options :: no_unsafe_negation :: NoUnsafeNegationOptions >> , # [doc = "Disallow the use of var"] # [serde (skip_serializing_if = "Option::is_none")] pub no_var : Option < RuleFixConfiguration < biome_rule_options :: no_var :: NoVarOptions >> , # [doc = "Disallow with statements in non-strict contexts."] # [serde (skip_serializing_if = "Option::is_none")] pub no_with : Option < RuleConfiguration < biome_rule_options :: no_with :: NoWithOptions >> , # [doc = "Disallow the use of overload signatures that are not next to each other."] # [serde (skip_serializing_if = "Option::is_none")] pub use_adjacent_overload_signatures : Option < RuleConfiguration < biome_rule_options :: use_adjacent_overload_signatures :: UseAdjacentOverloadSignaturesOptions >> , # [doc = "Ensure async functions utilize await."] # [serde (skip_serializing_if = "Option::is_none")] pub use_await : Option < RuleConfiguration < biome_rule_options :: use_await :: UseAwaitOptions >> , # [doc = "Enforce default clauses in switch statements to be last"] # [serde (skip_serializing_if = "Option::is_none")] pub use_default_switch_clause_last : Option < RuleConfiguration < biome_rule_options :: use_default_switch_clause_last :: UseDefaultSwitchClauseLastOptions >> , # [doc = "Enforce passing a message value when creating a built-in error."] # [serde (skip_serializing_if = "Option::is_none")] pub use_error_message : Option < RuleConfiguration < biome_rule_options :: use_error_message :: UseErrorMessageOptions >> , # [doc = "Enforce get methods to always return a value."] # [serde (skip_serializing_if = "Option::is_none")] pub use_getter_return : Option < RuleConfiguration < biome_rule_options :: use_getter_return :: UseGetterReturnOptions >> , # [doc = "Enforces the use of a recommended display strategy with Google Fonts."] # [serde (skip_serializing_if = "Option::is_none")] pub use_google_font_display : Option < RuleConfiguration < biome_rule_options :: use_google_font_display :: UseGoogleFontDisplayOptions >> , # [doc = "Require for-in loops to include an if statement."] # [serde (skip_serializing_if = "Option::is_none")] pub use_guard_for_in : Option < RuleConfiguration < biome_rule_options :: use_guard_for_in :: UseGuardForInOptions >> , # [doc = "Use Array.isArray() instead of instanceof Array."] # [serde (skip_serializing_if = "Option::is_none")] pub use_is_array : Option < RuleFixConfiguration < biome_rule_options :: use_is_array :: UseIsArrayOptions >> , # [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 < RuleFixConfiguration < biome_rule_options :: use_namespace_keyword :: UseNamespaceKeywordOptions >> , # [doc = "Enforce using the digits argument with Number#toFixed()."] # [serde (skip_serializing_if = "Option::is_none")] pub use_number_to_fixed_digits_argument : Option < RuleFixConfiguration < biome_rule_options :: use_number_to_fixed_digits_argument :: UseNumberToFixedDigitsArgumentOptions >> , # [doc = "Enforce the use of the directive \"use strict\" in script files."] # [serde (skip_serializing_if = "Option::is_none")] pub use_strict_mode : Option < RuleFixConfiguration < biome_rule_options :: use_strict_mode :: UseStrictModeOptions >> } impl Suspicious { const GROUP_NAME: &'static str = "suspicious"; pub(crate) const GROUP_RULES: &'static [&'static str] = &[ diff --git a/crates/biome_configuration/src/analyzer/mod.rs b/crates/biome_configuration/src/analyzer/mod.rs index 63522081d344..8e4649bee8b3 100644 --- a/crates/biome_configuration/src/analyzer/mod.rs +++ b/crates/biome_configuration/src/analyzer/mod.rs @@ -74,7 +74,7 @@ impl Merge for RuleConfiguration { } } } -impl RuleConfiguration { +impl RuleConfiguration { pub fn get_options(&self) -> Option { match self { Self::Plain(_) => None, @@ -382,6 +382,7 @@ pub struct RuleWithOptions { /// Rule's options pub options: T, } + impl Merge for RuleWithOptions { fn merge_with(&mut self, other: Self) { self.level = other.level; diff --git a/crates/biome_css_analyze/Cargo.toml b/crates/biome_css_analyze/Cargo.toml index 35129af8cee9..c65b7d5c9f4d 100644 --- a/crates/biome_css_analyze/Cargo.toml +++ b/crates/biome_css_analyze/Cargo.toml @@ -22,6 +22,7 @@ biome_deserialize = { workspace = true } biome_deserialize_macros = { workspace = true } biome_diagnostics = { workspace = true } biome_rowan = { workspace = true } +biome_rule_options = { workspace = true } biome_string_case = { workspace = true } biome_suppression = { workspace = true } camino = { workspace = true } diff --git a/crates/biome_css_analyze/src/assist/source/use_sorted_properties.rs b/crates/biome_css_analyze/src/assist/source/use_sorted_properties.rs index 0e96ee006804..3e381fcaf629 100644 --- a/crates/biome_css_analyze/src/assist/source/use_sorted_properties.rs +++ b/crates/biome_css_analyze/src/assist/source/use_sorted_properties.rs @@ -15,6 +15,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::category; use biome_rowan::{AstNode, BatchMutationExt, NodeOrToken, SyntaxNode, TokenText}; +use biome_rule_options::use_sorted_properties::UseSortedPropertiesOptions; use biome_string_case::StrOnlyExtension; use std::{ borrow::Cow, @@ -106,7 +107,7 @@ impl Rule for UseSortedProperties { type Query = Ast; type State = UseSortedPropertiesState; type Signals = Option; - type Options = (); + type Options = UseSortedPropertiesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lib.rs b/crates/biome_css_analyze/src/lib.rs index 875def70a11e..3492088b6858 100644 --- a/crates/biome_css_analyze/src/lib.rs +++ b/crates/biome_css_analyze/src/lib.rs @@ -3,7 +3,6 @@ mod assist; mod keywords; mod lint; -pub mod options; mod order; mod registry; mod services; diff --git a/crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs b/crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs index cfe427a6d5e4..ce2ec4a2630e 100644 --- a/crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs +++ b/crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs @@ -8,6 +8,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::{AstNode, SyntaxNodeCast, TextRange}; +use biome_rule_options::use_generic_font_names::UseGenericFontNamesOptions; use biome_string_case::StrLikeExtension; use crate::utils::{ @@ -75,7 +76,7 @@ impl Rule for UseGenericFontNames { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseGenericFontNamesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_invalid_direction_in_linear_gradient.rs b/crates/biome_css_analyze/src/lint/correctness/no_invalid_direction_in_linear_gradient.rs index aae0bb71a982..ef37ef1b8313 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_invalid_direction_in_linear_gradient.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_invalid_direction_in_linear_gradient.rs @@ -6,6 +6,7 @@ use biome_css_syntax::{CssFunction, CssParameter}; use biome_diagnostics::Severity; use biome_rowan::AstNode; use biome_rowan::AstSeparatedList; +use biome_rule_options::no_invalid_direction_in_linear_gradient::NoInvalidDirectionInLinearGradientOptions; use biome_string_case::StrLikeExtension; use regex::Regex; use std::sync::LazyLock; @@ -73,7 +74,7 @@ impl Rule for NoInvalidDirectionInLinearGradient { type Query = Ast; type State = CssParameter; type Signals = Option; - type Options = (); + type Options = NoInvalidDirectionInLinearGradientOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_invalid_grid_areas.rs b/crates/biome_css_analyze/src/lint/correctness/no_invalid_grid_areas.rs index c57e98484f10..ec4e9851929c 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_invalid_grid_areas.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_invalid_grid_areas.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::CssDeclarationOrRuleList; use biome_diagnostics::Severity; use biome_rowan::{TextRange, TokenText}; +use biome_rule_options::no_invalid_grid_areas::NoInvalidGridAreasOptions; use rustc_hash::FxHashSet; @@ -81,7 +82,7 @@ impl Rule for NoInvalidGridAreas { type Query = Ast; type State = UseConsistentGridAreasState; type Signals = Option; - type Options = (); + type Options = NoInvalidGridAreasOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_invalid_position_at_import_rule.rs b/crates/biome_css_analyze/src/lint/correctness/no_invalid_position_at_import_rule.rs index a3afae9d484d..94edfae600ec 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_invalid_position_at_import_rule.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_invalid_position_at_import_rule.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssRule, CssRuleList}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_invalid_position_at_import_rule::NoInvalidPositionAtImportRuleOptions; declare_lint_rule! { /// Disallow the use of `@import` at-rules in invalid positions. @@ -41,7 +42,7 @@ impl Rule for NoInvalidPositionAtImportRule { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoInvalidPositionAtImportRuleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs b/crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs index 7d7bda891878..26c6e42305ab 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssProperty, CssDashedIdentifier, CssDeclaration, CssSyntaxKind}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, Text}; +use biome_rule_options::no_missing_var_function::NoMissingVarFunctionOptions; use crate::services::semantic::Semantic; @@ -148,7 +149,7 @@ impl Rule for NoMissingVarFunction { type Query = Semantic; type State = CssDashedIdentifier; type Signals = Option; - type Options = (); + type Options = NoMissingVarFunctionOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs index aaa7252b8d59..37094d499247 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::CssFunction; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_unknown_function::NoUnknownFunctionOptions; use crate::utils::{is_custom_function, is_function_keyword}; @@ -51,7 +52,7 @@ impl Rule for NoUnknownFunction { type Query = Ast; type State = NoUnknownFunctionState; type Signals = Option; - type Options = (); + type Options = NoUnknownFunctionOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_media_feature_name.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_media_feature_name.rs index 4fb7768bd0c9..006573238364 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_media_feature_name.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_media_feature_name.rs @@ -10,6 +10,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_unknown_media_feature_name::NoUnknownMediaFeatureNameOptions; use crate::utils::is_media_feature_name; @@ -81,7 +82,7 @@ impl Rule for NoUnknownMediaFeatureName { type Query = Ast; type State = CssMediaQueryList; type Signals = Option; - type Options = (); + type Options = NoUnknownMediaFeatureNameOptions; fn run(ctx: &RuleContext) -> Option { let media_query_list = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_property.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_property.rs index 4caff615d8a0..6455d92772d4 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_property.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_property.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::CssGenericProperty; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_unknown_property::NoUnknownPropertyOptions; use biome_string_case::StrLikeExtension; use crate::utils::{is_known_properties, vendor_prefixed}; @@ -71,7 +72,7 @@ impl Rule for NoUnknownProperty { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoUnknownPropertyOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_class.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_class.rs index 1eef8b1e278d..29f37527c4e3 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_class.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_class.rs @@ -16,6 +16,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_unknown_pseudo_class::NoUnknownPseudoClassOptions; use biome_string_case::StrLikeExtension; declare_lint_rule! { @@ -187,7 +188,7 @@ impl Rule for NoUnknownPseudoClass { type Query = Ast; type State = NoUnknownPseudoClassSelectorState; type Signals = Option; - type Options = (); + type Options = NoUnknownPseudoClassOptions; fn run(ctx: &RuleContext) -> Option { let pseudo_class = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_element.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_element.rs index c5418449f808..9bd441a202ac 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_element.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_pseudo_element.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssPseudoElement, CssPseudoElementSelector}; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_unknown_pseudo_element::NoUnknownPseudoElementOptions; use biome_string_case::StrLikeExtension; use crate::utils::{is_pseudo_elements, vender_prefix}; @@ -64,7 +65,7 @@ impl Rule for NoUnknownPseudoElement { type Query = Ast; type State = AnyCssPseudoElement; type Signals = Option; - type Options = (); + type Options = NoUnknownPseudoElementOptions; fn run(ctx: &RuleContext) -> Option { let node: &CssPseudoElementSelector = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_type_selector.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_type_selector.rs index b129783ee209..c7f174a48d44 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_type_selector.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_type_selector.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::CssTypeSelector; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_unknown_type_selector::NoUnknownTypeSelectorOptions; use crate::utils::is_known_type_selector; @@ -64,7 +65,7 @@ impl Rule for NoUnknownTypeSelector { type Query = Ast; type State = CssTypeSelector; type Signals = Option; - type Options = (); + type Options = NoUnknownTypeSelectorOptions; fn run(ctx: &RuleContext) -> Option { let css_type_selector = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unknown_unit.rs b/crates/biome_css_analyze/src/lint/correctness/no_unknown_unit.rs index c5a421a92bb7..f3acf9bae1b5 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unknown_unit.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unknown_unit.rs @@ -7,6 +7,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::{SyntaxNodeCast, TextRange}; +use biome_rule_options::no_unknown_unit::NoUnknownUnitOptions; use biome_string_case::StrLikeExtension; const RESOLUTION_MEDIA_FEATURE_NAMES: [&str; 3] = @@ -79,7 +80,7 @@ impl Rule for NoUnknownUnit { type Query = Ast; type State = NoUnknownUnitState; type Signals = Option; - type Options = (); + type Options = NoUnknownUnitOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/correctness/no_unmatchable_anb_selector.rs b/crates/biome_css_analyze/src/lint/correctness/no_unmatchable_anb_selector.rs index d72783e6f0df..37cb3551026f 100644 --- a/crates/biome_css_analyze/src/lint/correctness/no_unmatchable_anb_selector.rs +++ b/crates/biome_css_analyze/src/lint/correctness/no_unmatchable_anb_selector.rs @@ -7,6 +7,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::{AstNode, SyntaxNodeCast}; +use biome_rule_options::no_unmatchable_anb_selector::NoUnmatchableAnbSelectorOptions; declare_lint_rule! { /// Disallow unmatchable An+B selectors. @@ -67,7 +68,7 @@ impl Rule for NoUnmatchableAnbSelector { type Query = Ast; type State = CssPseudoClassNthSelector; type Signals = Option; - type Options = (); + type Options = NoUnmatchableAnbSelectorOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/nursery/no_important_styles.rs b/crates/biome_css_analyze/src/lint/nursery/no_important_styles.rs index f992207ef079..d443ec0f721b 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_important_styles.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_important_styles.rs @@ -6,6 +6,7 @@ use biome_css_factory::make::css_declaration; use biome_css_syntax::{CssDeclaration, CssDeclarationImportant}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_important_styles::NoImportantStylesOptions; declare_lint_rule! { /// Disallow the use of the `!important` style. @@ -64,7 +65,7 @@ impl Rule for NoImportantStyles { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoImportantStylesOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_css_analyze/src/lint/nursery/no_unknown_at_rule.rs b/crates/biome_css_analyze/src/lint/nursery/no_unknown_at_rule.rs index 02c3dc6f6fb1..73b7ec52f2e6 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_unknown_at_rule.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_unknown_at_rule.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::{CssUnknownBlockAtRule, CssUnknownValueAtRule}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_unknown_at_rule::NoUnknownAtRuleOptions; declare_lint_rule! { /// Disallow unknown at-rules. @@ -61,7 +62,7 @@ impl Rule for NoUnknownAtRule { type Query = Ast; type State = NoUnknownAtRuleState; type Signals = Option; - type Options = (); + type Options = NoUnknownAtRuleOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/nursery/no_useless_escape_in_string.rs b/crates/biome_css_analyze/src/lint/nursery/no_useless_escape_in_string.rs index 0dd17f3f0ae4..f4db2d953cce 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_useless_escape_in_string.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_useless_escape_in_string.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_css_syntax::{CssString, CssSyntaxToken}; use biome_diagnostics::Severity; use biome_rowan::{BatchMutationExt, TextRange}; +use biome_rule_options::no_useless_escape_in_string::NoUselessEscapeInStringOptions; use crate::CssRuleAction; @@ -56,7 +57,7 @@ impl Rule for NoUselessEscapeInString { type Query = Ast; type State = (CssSyntaxToken, usize); type Signals = Option; - type Options = (); + type Options = NoUselessEscapeInStringOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs b/crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs index 5368b122d907..b8d07a07a605 100644 --- a/crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs +++ b/crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs @@ -8,6 +8,7 @@ use biome_diagnostics::Severity; use biome_rowan::TextRange; use biome_rowan::AstNode; +use biome_rule_options::no_descending_specificity::NoDescendingSpecificityOptions; use crate::services::semantic::Semantic; @@ -175,7 +176,7 @@ impl Rule for NoDescendingSpecificity { type Query = Semantic; type State = DescendingSelector; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDescendingSpecificityOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_css_analyze/src/lint/style/no_value_at_rule.rs b/crates/biome_css_analyze/src/lint/style/no_value_at_rule.rs index 2375b877c835..e1c766bb7226 100644 --- a/crates/biome_css_analyze/src/lint/style/no_value_at_rule.rs +++ b/crates/biome_css_analyze/src/lint/style/no_value_at_rule.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_css_syntax::CssAtRule; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_value_at_rule::NoValueAtRuleOptions; declare_lint_rule! { /// Disallow use of `@value` rule in css modules. @@ -42,7 +43,7 @@ impl Rule for NoValueAtRule { type Query = Ast; type State = CssAtRule; type Signals = Option; - type Options = (); + type Options = NoValueAtRuleOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_at_import_rules.rs b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_at_import_rules.rs index b3c783cd36d2..643f34f81a37 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_at_import_rules.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_at_import_rules.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssAtRule, AnyCssRule, CssImportAtRule, CssRuleList}; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_duplicate_at_import_rules::NoDuplicateAtImportRulesOptions; use biome_string_case::StrOnlyExtension; declare_lint_rule! { @@ -61,7 +62,7 @@ impl Rule for NoDuplicateAtImportRules { type Query = Ast; type State = CssImportAtRule; type Signals = Option; - type Options = (); + type Options = NoDuplicateAtImportRulesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs index 59adbfbe824d..d99d1a8f6b64 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_css_syntax::CssDeclarationOrRuleList; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_duplicate_custom_properties::NoDuplicateCustomPropertiesOptions; use rustc_hash::FxHashMap; use std::collections::hash_map::Entry; @@ -48,7 +49,7 @@ impl Rule for NoDuplicateCustomProperties { type Query = Semantic; type State = (TextRange, (TextRange, String)); type Signals = Option; - type Options = (); + type Options = NoDuplicateCustomPropertiesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs index 8cd58888641a..416a830aa2b3 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssGenericComponentValue, AnyCssValue, CssGenericProperty}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_duplicate_font_names::NoDuplicateFontNamesOptions; use biome_string_case::StrLikeExtension; use std::collections::HashSet; @@ -62,7 +63,7 @@ impl Rule for NoDuplicateFontNames { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoDuplicateFontNamesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs index df9739091a82..c2ef2c0eedba 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_css_syntax::{CssDeclarationOrRuleList, CssKeyframesAtRule}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_duplicate_properties::NoDuplicatePropertiesOptions; use rustc_hash::FxHashMap; use std::collections::hash_map::Entry; @@ -47,7 +48,7 @@ impl Rule for NoDuplicateProperties { type Query = Semantic; type State = (TextRange, (TextRange, Box)); type Signals = Option; - type Options = (); + type Options = NoDuplicatePropertiesOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_selectors_keyframe_block.rs b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_selectors_keyframe_block.rs index a577f6659f8c..4128882ce8e7 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_selectors_keyframe_block.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_duplicate_selectors_keyframe_block.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssKeyframesItem, AnyCssKeyframesSelector, CssKeyframesBlock}; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_duplicate_selectors_keyframe_block::NoDuplicateSelectorsKeyframeBlockOptions; use biome_string_case::StrLikeExtension; declare_lint_rule! { @@ -52,7 +53,7 @@ impl Rule for NoDuplicateSelectorsKeyframeBlock { type Query = Ast; type State = AnyCssKeyframesSelector; type Signals = Option; - type Options = (); + type Options = NoDuplicateSelectorsKeyframeBlockOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_empty_block.rs b/crates/biome_css_analyze/src/lint/suspicious/no_empty_block.rs index ff7aa1339f60..7041ea9d431b 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_empty_block.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_empty_block.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::stmt_ext::CssBlockLike; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_empty_block::NoEmptyBlockOptions; declare_lint_rule! { /// Disallow CSS empty blocks. @@ -57,7 +58,7 @@ impl Rule for NoEmptyBlock { type Query = Ast; type State = CssBlockLike; type Signals = Option; - type Options = (); + type Options = NoEmptyBlockOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_important_in_keyframe.rs b/crates/biome_css_analyze/src/lint/suspicious/no_important_in_keyframe.rs index 90e8da73b275..9a58001773e5 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_important_in_keyframe.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_important_in_keyframe.rs @@ -7,6 +7,7 @@ use biome_css_syntax::{ }; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_important_in_keyframe::NoImportantInKeyframeOptions; declare_lint_rule! { /// Disallow invalid `!important` within keyframe declarations @@ -55,7 +56,7 @@ impl Rule for NoImportantInKeyframe { type Query = Ast; type State = CssDeclarationImportant; type Signals = Option; - type Options = (); + type Options = NoImportantInKeyframeOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs b/crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs index a5d0350441d2..0f1c41d7a5bf 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssRule, CssLanguage}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, Direction, SyntaxToken, TextRange}; +use biome_rule_options::no_irregular_whitespace::NoIrregularWhitespaceOptions; const IRREGULAR_WHITESPACES: &[char; 22] = &[ '\u{c}', '\u{b}', '\u{85}', '\u{feff}', '\u{a0}', '\u{1680}', '\u{180e}', '\u{2000}', @@ -54,7 +55,7 @@ impl Rule for NoIrregularWhitespace { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoIrregularWhitespaceOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_css_analyze/src/lint/suspicious/no_shorthand_property_overrides.rs b/crates/biome_css_analyze/src/lint/suspicious/no_shorthand_property_overrides.rs index 0ab7cc763b2e..7e9b625f9a63 100644 --- a/crates/biome_css_analyze/src/lint/suspicious/no_shorthand_property_overrides.rs +++ b/crates/biome_css_analyze/src/lint/suspicious/no_shorthand_property_overrides.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_css_syntax::{AnyCssDeclarationName, CssGenericProperty, CssLanguage, CssSyntaxKind}; use biome_diagnostics::Severity; use biome_rowan::{AstNode, Language, SyntaxNode, TextRange, WalkEvent}; +use biome_rule_options::no_shorthand_property_overrides::NoShorthandPropertyOverridesOptions; fn remove_vendor_prefix<'a>(prop: &'a str, prefix: &'a str) -> &'a str { if let Some(prop) = prop.strip_prefix(prefix) { @@ -186,7 +187,7 @@ impl Rule for NoShorthandPropertyOverrides { type Query = NoDeclarationBlockShorthandPropertyOverridesQuery; type State = NoDeclarationBlockShorthandPropertyOverridesState; type Signals = Option; - type Options = (); + type Options = NoShorthandPropertyOverridesOptions; fn run(ctx: &RuleContext) -> Option { let query = ctx.query(); diff --git a/crates/biome_css_analyze/src/options.rs b/crates/biome_css_analyze/src/options.rs deleted file mode 100644 index 295755377bee..000000000000 --- a/crates/biome_css_analyze/src/options.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! Generated file, do not edit by hand, see `xtask/codegen` - -//! Generated file, do not edit by hand, see `xtask/codegen` - -use crate::assist; -use crate::lint; -pub type NoDescendingSpecificity = < lint :: style :: no_descending_specificity :: NoDescendingSpecificity as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateAtImportRules = < lint :: suspicious :: no_duplicate_at_import_rules :: NoDuplicateAtImportRules as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateCustomProperties = < lint :: suspicious :: no_duplicate_custom_properties :: NoDuplicateCustomProperties as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateFontNames = < lint :: suspicious :: no_duplicate_font_names :: NoDuplicateFontNames as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateProperties = < lint :: suspicious :: no_duplicate_properties :: NoDuplicateProperties as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateSelectorsKeyframeBlock = < lint :: suspicious :: no_duplicate_selectors_keyframe_block :: NoDuplicateSelectorsKeyframeBlock as biome_analyze :: Rule > :: Options ; -pub type NoEmptyBlock = - ::Options; -pub type NoImportantInKeyframe = < lint :: suspicious :: no_important_in_keyframe :: NoImportantInKeyframe as biome_analyze :: Rule > :: Options ; -pub type NoImportantStyles = - ::Options; -pub type NoInvalidDirectionInLinearGradient = < lint :: correctness :: no_invalid_direction_in_linear_gradient :: NoInvalidDirectionInLinearGradient as biome_analyze :: Rule > :: Options ; -pub type NoInvalidGridAreas = - ::Options; -pub type NoInvalidPositionAtImportRule = < lint :: correctness :: no_invalid_position_at_import_rule :: NoInvalidPositionAtImportRule as biome_analyze :: Rule > :: Options ; -pub type NoIrregularWhitespace = < lint :: suspicious :: no_irregular_whitespace :: NoIrregularWhitespace as biome_analyze :: Rule > :: Options ; -pub type NoMissingVarFunction = < lint :: correctness :: no_missing_var_function :: NoMissingVarFunction as biome_analyze :: Rule > :: Options ; -pub type NoShorthandPropertyOverrides = < lint :: suspicious :: no_shorthand_property_overrides :: NoShorthandPropertyOverrides as biome_analyze :: Rule > :: Options ; -pub type NoUnknownAtRule = - ::Options; -pub type NoUnknownFunction = - ::Options; -pub type NoUnknownMediaFeatureName = < lint :: correctness :: no_unknown_media_feature_name :: NoUnknownMediaFeatureName as biome_analyze :: Rule > :: Options ; -pub type NoUnknownProperty = - ::Options; -pub type NoUnknownPseudoClass = < lint :: correctness :: no_unknown_pseudo_class :: NoUnknownPseudoClass as biome_analyze :: Rule > :: Options ; -pub type NoUnknownPseudoElement = < lint :: correctness :: no_unknown_pseudo_element :: NoUnknownPseudoElement as biome_analyze :: Rule > :: Options ; -pub type NoUnknownTypeSelector = < lint :: correctness :: no_unknown_type_selector :: NoUnknownTypeSelector as biome_analyze :: Rule > :: Options ; -pub type NoUnknownUnit = - ::Options; -pub type NoUnmatchableAnbSelector = < lint :: correctness :: no_unmatchable_anb_selector :: NoUnmatchableAnbSelector as biome_analyze :: Rule > :: Options ; -pub type NoUselessEscapeInString = < lint :: nursery :: no_useless_escape_in_string :: NoUselessEscapeInString as biome_analyze :: Rule > :: Options ; -pub type NoValueAtRule = - ::Options; -pub type UseGenericFontNames = - ::Options; -pub type UseSortedProperties = - ::Options; diff --git a/crates/biome_graphql_analyze/Cargo.toml b/crates/biome_graphql_analyze/Cargo.toml index 4b1ecc28e1c4..64d34190a4c3 100644 --- a/crates/biome_graphql_analyze/Cargo.toml +++ b/crates/biome_graphql_analyze/Cargo.toml @@ -19,6 +19,7 @@ biome_diagnostics = { workspace = true } biome_graphql_factory = { workspace = true } biome_graphql_syntax = { workspace = true } biome_rowan = { workspace = true } +biome_rule_options = { workspace = true } biome_string_case = { workspace = true } biome_suppression = { workspace = true } schemars = { workspace = true, optional = true } diff --git a/crates/biome_graphql_analyze/src/lib.rs b/crates/biome_graphql_analyze/src/lib.rs index 573250c23a38..0be1bf667516 100644 --- a/crates/biome_graphql_analyze/src/lib.rs +++ b/crates/biome_graphql_analyze/src/lib.rs @@ -1,7 +1,6 @@ #![deny(clippy::use_self)] mod lint; -pub mod options; mod registry; mod suppression_action; diff --git a/crates/biome_graphql_analyze/src/lint/nursery/use_named_operation.rs b/crates/biome_graphql_analyze/src/lint/nursery/use_named_operation.rs index c253416a86a5..b7e3037a7015 100644 --- a/crates/biome_graphql_analyze/src/lint/nursery/use_named_operation.rs +++ b/crates/biome_graphql_analyze/src/lint/nursery/use_named_operation.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_graphql_factory::make; use biome_graphql_syntax::{GraphqlOperationDefinition, GraphqlOperationType}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_named_operation::UseNamedOperationOptions; use biome_string_case::Case; use crate::GraphqlRuleAction; @@ -46,7 +47,7 @@ impl Rule for UseNamedOperation { type Query = Ast; type State = GraphqlOperationType; type Signals = Option; - type Options = (); + type Options = UseNamedOperationOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_graphql_analyze/src/lint/nursery/use_naming_convention.rs b/crates/biome_graphql_analyze/src/lint/nursery/use_naming_convention.rs index 8dbb567b0d50..1087d0fcffed 100644 --- a/crates/biome_graphql_analyze/src/lint/nursery/use_naming_convention.rs +++ b/crates/biome_graphql_analyze/src/lint/nursery/use_naming_convention.rs @@ -3,6 +3,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, context::RuleContext, declare_lin use biome_console::markup; use biome_graphql_syntax::GraphqlEnumValueDefinition; use biome_rowan::AstNode; +use biome_rule_options::use_naming_convention::UseNamingConventionOptions; declare_lint_rule! { /// Validates that all enum values are capitalized. @@ -40,7 +41,7 @@ impl Rule for UseNamingConvention { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseNamingConventionOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_graphql_analyze/src/lint/style/use_deprecated_reason.rs b/crates/biome_graphql_analyze/src/lint/style/use_deprecated_reason.rs index f3734def541f..1871bae4bc75 100644 --- a/crates/biome_graphql_analyze/src/lint/style/use_deprecated_reason.rs +++ b/crates/biome_graphql_analyze/src/lint/style/use_deprecated_reason.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_graphql_syntax::GraphqlDirective; use biome_rowan::AstNode; +use biome_rule_options::use_deprecated_reason::UseDeprecatedReasonOptions; declare_lint_rule! { /// Require specifying the reason argument when using `@deprecated` directive @@ -43,7 +44,7 @@ impl Rule for UseDeprecatedReason { type Query = Ast; type State = GraphqlDirective; type Signals = Option; - type Options = (); + type Options = UseDeprecatedReasonOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_graphql_analyze/src/lint/suspicious/no_duplicate_fields.rs b/crates/biome_graphql_analyze/src/lint/suspicious/no_duplicate_fields.rs index d66c41320d0c..11a2816f9b09 100644 --- a/crates/biome_graphql_analyze/src/lint/suspicious/no_duplicate_fields.rs +++ b/crates/biome_graphql_analyze/src/lint/suspicious/no_duplicate_fields.rs @@ -9,6 +9,7 @@ use biome_graphql_syntax::{ GraphqlVariableDefinitions, }; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_duplicate_fields::NoDuplicateFieldsOptions; use biome_string_case::StrOnlyExtension; declare_lint_rule! { @@ -49,7 +50,7 @@ impl Rule for NoDuplicateFields { type Query = Ast; type State = DuplicatedField; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDuplicateFieldsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let operation = ctx.query(); diff --git a/crates/biome_graphql_analyze/src/options.rs b/crates/biome_graphql_analyze/src/options.rs deleted file mode 100644 index f51870dc639f..000000000000 --- a/crates/biome_graphql_analyze/src/options.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Generated file, do not edit by hand, see `xtask/codegen` - -//! Generated file, do not edit by hand, see `xtask/codegen` - -use crate::lint; -pub type NoDuplicateFields = - ::Options; -pub type UseDeprecatedReason = - ::Options; -pub type UseNamedOperation = - ::Options; -pub type UseNamingConvention = - ::Options; diff --git a/crates/biome_js_analyze/Cargo.toml b/crates/biome_js_analyze/Cargo.toml index 51cc05d517dd..bf275365f68c 100644 --- a/crates/biome_js_analyze/Cargo.toml +++ b/crates/biome_js_analyze/Cargo.toml @@ -31,7 +31,8 @@ biome_package = { workspace = true } biome_project_layout = { workspace = true } biome_resolver = { workspace = true } biome_rowan = { workspace = true } -biome_string_case = { workspace = true } +biome_rule_options = { workspace = true } +biome_string_case = { workspace = true, features = ["biome_rowan"] } biome_suppression = { workspace = true } biome_unicode_table = { workspace = true } bitvec = "1.0.1" diff --git a/crates/biome_js_analyze/src/assist/source/organize_imports.rs b/crates/biome_js_analyze/src/assist/source/organize_imports.rs index 2fa9de1696c7..b004900ab806 100644 --- a/crates/biome_js_analyze/src/assist/source/organize_imports.rs +++ b/crates/biome_js_analyze/src/assist/source/organize_imports.rs @@ -3,7 +3,6 @@ use biome_analyze::{ declare_source_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::category; use biome_js_factory::make; use biome_js_syntax::{ @@ -11,6 +10,7 @@ use biome_js_syntax::{ JsSyntaxKind, T, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TriviaPieceKind, chain_trivia_pieces}; +use biome_rule_options::organize_imports::OrganizeImportsOptions; use import_key::{ImportInfo, ImportKey}; use rustc_hash::FxHashMap; use specifiers_attributes::{ @@ -21,9 +21,7 @@ use specifiers_attributes::{ use crate::JsRuleAction; use util::{attached_trivia, detached_trivia, has_detached_leading_comment, leading_newlines}; -pub mod import_groups; pub mod import_key; -pub mod import_source; pub mod specifiers_attributes; mod util; @@ -633,7 +631,7 @@ impl Rule for OrganizeImports { type Query = Ast; type State = Box<[Issue]>; type Signals = Option; - type Options = Options; + type Options = OrganizeImportsOptions; fn text_range(ctx: &RuleContext, _state: &Self::State) -> Option { ctx.query() @@ -1022,15 +1020,6 @@ impl Rule for OrganizeImports { } } -#[derive( - Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, Deserializable, serde::Serialize, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct Options { - groups: import_groups::ImportGroups, -} - #[derive(Debug)] pub enum Issue { AddLeadingNewline { diff --git a/crates/biome_js_analyze/src/assist/source/organize_imports/import_key.rs b/crates/biome_js_analyze/src/assist/source/organize_imports/import_key.rs index b6755c54eedd..2c4875c60b4b 100644 --- a/crates/biome_js_analyze/src/assist/source/organize_imports/import_key.rs +++ b/crates/biome_js_analyze/src/assist/source/organize_imports/import_key.rs @@ -1,21 +1,20 @@ +use super::specifiers_attributes::JsNamedSpecifiers; use biome_js_syntax::{ AnyJsCombinedSpecifier, AnyJsExportClause, AnyJsImportClause, AnyJsModuleItem, AnyJsModuleSource, JsExport, JsImport, JsImportAssertion, }; use biome_rowan::AstNode; -use biome_string_case::comparable_token::ComparableToken; - -use super::{ - import_groups::{self, ImportCandidate, ImportSourceCandidate}, - import_source, - specifiers_attributes::JsNamedSpecifiers, +use biome_rule_options::organize_imports::import_groups::{ + ImportCandidate, ImportGroups, ImportSourceCandidate, }; +use biome_rule_options::organize_imports::import_source::ImportSource; +use biome_string_case::comparable_token::ComparableToken; /// Type used to determine the order between imports #[derive(Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct ImportKey { pub group: u16, - pub source: import_source::ImportSource, + pub source: ImportSource, pub has_no_attributes: bool, pub kind: ImportStatementKind, /// Slot index of the import in the module. @@ -23,7 +22,7 @@ pub struct ImportKey { pub slot_index: u32, } impl ImportKey { - pub fn new(info: ImportInfo, groups: &import_groups::ImportGroups) -> Self { + pub fn new(info: ImportInfo, groups: &ImportGroups) -> Self { Self { group: groups.index(&((&info).into())), source: info.source, @@ -77,7 +76,7 @@ pub struct ImportInfo { /// Slot index of the import in the module. pub slot_index: u32, pub kind: ImportStatementKind, - pub source: import_source::ImportSource, + pub source: ImportSource, pub has_no_attributes: bool, } impl ImportInfo { diff --git a/crates/biome_js_analyze/src/assist/source/use_sorted_attributes.rs b/crates/biome_js_analyze/src/assist/source/use_sorted_attributes.rs index 336e95bb154e..294ee2530d5e 100644 --- a/crates/biome_js_analyze/src/assist/source/use_sorted_attributes.rs +++ b/crates/biome_js_analyze/src/assist/source/use_sorted_attributes.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ AnyJsxAttribute, JsxAttribute, JsxAttributeList, JsxOpeningElement, JsxSelfClosingElement, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_sorted_attributes::UseSortedAttributesOptions; use biome_string_case::StrLikeExtension; use crate::JsRuleAction; @@ -51,7 +52,7 @@ impl Rule for UseSortedAttributes { type Query = Ast; type State = PropGroup; type Signals = Box<[Self::State]>; - type Options = (); + type Options = UseSortedAttributesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let props = ctx.query(); diff --git a/crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs b/crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs index 709d17d7987d..1b02d2f36383 100644 --- a/crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs +++ b/crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs @@ -12,6 +12,7 @@ use biome_diagnostics::{Applicability, category}; use biome_js_factory::make; use biome_js_syntax::{JsObjectExpression, JsObjectMemberList, T}; use biome_rowan::{AstNode, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::use_sorted_keys::UseSortedKeysOptions; use biome_string_case::comparable_token::ComparableToken; use crate::JsRuleAction; @@ -85,7 +86,7 @@ impl Rule for UseSortedKeys { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseSortedKeysOptions; fn run(ctx: &RuleContext) -> Self::Signals { is_separated_list_sorted_by(ctx.query(), |node| node.name().map(ComparableToken::new)) diff --git a/crates/biome_js_analyze/src/lib.rs b/crates/biome_js_analyze/src/lib.rs index 8069b9e15aef..f31ece140ebd 100644 --- a/crates/biome_js_analyze/src/lib.rs +++ b/crates/biome_js_analyze/src/lib.rs @@ -23,7 +23,6 @@ mod ast_utils; pub mod globals; pub mod lint; mod nextjs; -pub mod options; mod react; mod registry; mod services; diff --git a/crates/biome_js_analyze/src/lint/a11y/no_access_key.rs b/crates/biome_js_analyze/src/lint/a11y/no_access_key.rs index c2385bc5c408..be1f9e9efc24 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_access_key.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_access_key.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsxAttribute, JsxAttributeList, jsx_ext::AnyJsxElement}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_access_key::NoAccessKeyOptions; declare_lint_rule! { /// Enforce that the `accessKey` attribute is not used on any HTML element. @@ -51,7 +52,7 @@ impl Rule for NoAccessKey { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoAccessKeyOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_aria_hidden_on_focusable.rs b/crates/biome_js_analyze/src/lint/a11y/no_aria_hidden_on_focusable.rs index 53ade172eb0e..5488a6c061bc 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_aria_hidden_on_focusable.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_aria_hidden_on_focusable.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxAttributeValue, AnyNumberLikeExpression, jsx_ext::AnyJsxElement}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_aria_hidden_on_focusable::NoAriaHiddenOnFocusableOptions; declare_lint_rule! { /// Enforce that aria-hidden="true" is not set on focusable elements. @@ -61,7 +62,7 @@ impl Rule for NoAriaHiddenOnFocusable { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = NoAriaHiddenOnFocusableOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_aria_unsupported_elements.rs b/crates/biome_js_analyze/src/lint/a11y/no_aria_unsupported_elements.rs index 3fc925ff11d8..2419d09db64d 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_aria_unsupported_elements.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_aria_unsupported_elements.rs @@ -9,6 +9,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::no_aria_unsupported_elements::NoAriaUnsupportedElementsOptions; declare_lint_rule! { /// Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. @@ -74,7 +75,7 @@ impl Rule for NoAriaUnsupportedElements { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoAriaUnsupportedElementsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_autofocus.rs b/crates/biome_js_analyze/src/lint/a11y/no_autofocus.rs index cb3e60930a14..423bf4475afa 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_autofocus.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_autofocus.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsLanguage, JsSyntaxKind, JsxAttribute, jsx_ext::AnyJsxElement}; use biome_rowan::{AstNode, BatchMutationExt, WalkEvent}; +use biome_rule_options::no_autofocus::NoAutofocusOptions; use biome_string_case::StrOnlyExtension; declare_lint_rule! { @@ -191,7 +192,7 @@ impl Rule for NoAutofocus { type Query = ValidAutofocus; type State = JsxAttribute; type Signals = Option; - type Options = (); + type Options = NoAutofocusOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_distracting_elements.rs b/crates/biome_js_analyze/src/lint/a11y/no_distracting_elements.rs index 25e1026327e2..647e6bdec73c 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_distracting_elements.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_distracting_elements.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_js_syntax::*; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_distracting_elements::NoDistractingElementsOptions; use crate::JsRuleAction; @@ -52,7 +53,7 @@ impl Rule for NoDistractingElements { type Query = Ast; type State = JsSyntaxToken; type Signals = Option; - type Options = (); + type Options = NoDistractingElementsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_header_scope.rs b/crates/biome_js_analyze/src/lint/a11y/no_header_scope.rs index 6d30db637560..e2c8451c9cb3 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_header_scope.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_header_scope.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_header_scope::NoHeaderScopeOptions; use crate::JsRuleAction; @@ -52,7 +53,7 @@ impl Rule for NoHeaderScope { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoHeaderScopeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_interactive_element_to_noninteractive_role.rs b/crates/biome_js_analyze/src/lint/a11y/no_interactive_element_to_noninteractive_role.rs index 7bbe903167db..dad221ceae1f 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_interactive_element_to_noninteractive_role.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_interactive_element_to_noninteractive_role.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_interactive_element_to_noninteractive_role::NoInteractiveElementToNoninteractiveRoleOptions; declare_lint_rule! { /// Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements. @@ -52,7 +53,7 @@ impl Rule for NoInteractiveElementToNoninteractiveRole { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = NoInteractiveElementToNoninteractiveRoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_label_without_control.rs b/crates/biome_js_analyze/src/lint/a11y/no_label_without_control.rs index c404b7794fc3..a3f9b96fb90e 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_label_without_control.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_label_without_control.rs @@ -2,14 +2,13 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsxAttribute, AnyJsxAttributeName, AnyJsxAttributeValue, AnyJsxElementName, AnyJsxTag, JsSyntaxKind, JsxAttribute, }; use biome_rowan::{AstNode, WalkEvent}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::no_label_without_control::NoLabelWithoutControlOptions; declare_lint_rule! { /// Enforce that a label element or component has a text label and an associated input. @@ -105,15 +104,15 @@ impl Rule for NoLabelWithoutControl { let options = ctx.options(); let element_name = node.name()?.name_value_token().ok()?; let element_name = element_name.text_trimmed(); - let is_allowed_element = options.has_element_name(element_name) + let is_allowed_element = has_element_name(options, element_name) || DEFAULT_LABEL_COMPONENTS.contains(&element_name); if !is_allowed_element { return None; } - let has_text_content = options.has_accessible_label(node); - let has_control_association = has_for_attribute(node) || options.has_nested_control(node); + let has_text_content = has_accessible_label(options, node); + let has_control_association = has_for_attribute(node) || has_nested_control(options, node); if has_text_content && has_control_association { return None; @@ -151,118 +150,105 @@ impl Rule for NoLabelWithoutControl { } } -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoLabelWithoutControlOptions { - /// Array of component names that should be considered the same as an `input` element. - pub input_components: Box<[Box]>, - /// Array of attributes that should be treated as the `label` accessible text content. - pub label_attributes: Box<[Box]>, - /// Array of component names that should be considered the same as a `label` element. - pub label_components: Box<[Box]>, -} - -impl NoLabelWithoutControlOptions { - /// Returns `true` whether the passed `attribute` meets one of the following conditions: - /// - Has a label attribute that corresponds to the `label_attributes` parameter - /// - Has a label among `DEFAULT_LABEL_ATTRIBUTES` - fn has_label_attribute(&self, attribute: &JsxAttribute) -> bool { - let Ok(attribute_name) = attribute.name().and_then(|name| name.name_token()) else { - return false; - }; - let attribute_name = attribute_name.text_trimmed(); - if !DEFAULT_LABEL_ATTRIBUTES.contains(&attribute_name) - && !self - .label_attributes - .iter() - .any(|name| name.as_ref() == attribute_name) - { - return false; - } - attribute - .initializer() - .and_then(|init| init.value().ok()) - .is_some_and(|v| has_label_attribute_value(&v)) +/// Returns `true` whether the passed `attribute` meets one of the following conditions: +/// - Has a label attribute that corresponds to the `label_attributes` parameter +/// - Has a label among `DEFAULT_LABEL_ATTRIBUTES` +fn has_label_attribute(options: &NoLabelWithoutControlOptions, attribute: &JsxAttribute) -> bool { + let Ok(attribute_name) = attribute.name().and_then(|name| name.name_token()) else { + return false; + }; + let attribute_name = attribute_name.text_trimmed(); + if !DEFAULT_LABEL_ATTRIBUTES.contains(&attribute_name) + && !options + .label_attributes + .iter() + .any(|name| name.as_ref() == attribute_name) + { + return false; } + attribute + .initializer() + .and_then(|init| init.value().ok()) + .is_some_and(|v| has_label_attribute_value(&v)) +} - /// Returns `true` whether the passed `jsx_tag` meets one of the following conditions: - /// - Has a label attribute that corresponds to the `label_attributes` parameter - /// - Has a label among `DEFAULT_LABEL_ATTRIBUTES` - /// - Has a child that acts as a label - fn has_accessible_label(&self, jsx_tag: &AnyJsxTag) -> bool { - let mut child_iter = jsx_tag.syntax().preorder(); - while let Some(event) = child_iter.next() { - match event { - WalkEvent::Enter(child) => match child.kind() { - JsSyntaxKind::JSX_EXPRESSION_CHILD - | JsSyntaxKind::JSX_SPREAD_CHILD - | JsSyntaxKind::JSX_TEXT => { +/// Returns `true` whether the passed `jsx_tag` meets one of the following conditions: +/// - Has a label attribute that corresponds to the `label_attributes` parameter +/// - Has a label among `DEFAULT_LABEL_ATTRIBUTES` +/// - Has a child that acts as a label +fn has_accessible_label(options: &NoLabelWithoutControlOptions, jsx_tag: &AnyJsxTag) -> bool { + let mut child_iter = jsx_tag.syntax().preorder(); + while let Some(event) = child_iter.next() { + match event { + WalkEvent::Enter(child) => match child.kind() { + JsSyntaxKind::JSX_EXPRESSION_CHILD + | JsSyntaxKind::JSX_SPREAD_CHILD + | JsSyntaxKind::JSX_TEXT => { + return true; + } + JsSyntaxKind::JSX_ELEMENT + | JsSyntaxKind::JSX_OPENING_ELEMENT + | JsSyntaxKind::JSX_CHILD_LIST + | JsSyntaxKind::JSX_SELF_CLOSING_ELEMENT + | JsSyntaxKind::JSX_ATTRIBUTE_LIST => {} + JsSyntaxKind::JSX_ATTRIBUTE => { + let attribute = JsxAttribute::unwrap_cast(child); + if has_label_attribute(options, &attribute) { return true; } - JsSyntaxKind::JSX_ELEMENT - | JsSyntaxKind::JSX_OPENING_ELEMENT - | JsSyntaxKind::JSX_CHILD_LIST - | JsSyntaxKind::JSX_SELF_CLOSING_ELEMENT - | JsSyntaxKind::JSX_ATTRIBUTE_LIST => {} - JsSyntaxKind::JSX_ATTRIBUTE => { - let attribute = JsxAttribute::unwrap_cast(child); - if self.has_label_attribute(&attribute) { - return true; - } - child_iter.skip_subtree(); - } - _ => { - child_iter.skip_subtree(); - } - }, - WalkEvent::Leave(_) => {} - } + child_iter.skip_subtree(); + } + _ => { + child_iter.skip_subtree(); + } + }, + WalkEvent::Leave(_) => {} } - false } + false +} - /// Returns whether the passed `AnyJsxTag` have a child that is considered an input component - /// according to the passed `input_components` parameter - fn has_nested_control(&self, jsx_tag: &AnyJsxTag) -> bool { - let mut child_iter = jsx_tag.syntax().preorder(); - while let Some(event) = child_iter.next() { - match event { - WalkEvent::Enter(child) => match child.kind() { - JsSyntaxKind::JSX_ELEMENT - | JsSyntaxKind::JSX_OPENING_ELEMENT - | JsSyntaxKind::JSX_CHILD_LIST - | JsSyntaxKind::JSX_SELF_CLOSING_ELEMENT => {} - _ => { - let Some(element_name) = AnyJsxElementName::cast(child) else { - child_iter.skip_subtree(); - continue; - }; - let Ok(element_name) = element_name.name_value_token() else { - continue; - }; - let element_name = element_name.text_trimmed(); - if DEFAULT_INPUT_COMPONENTS.contains(&element_name) - || self - .input_components - .iter() - .any(|name| name.as_ref() == element_name) - { - return true; - } +/// Returns whether the passed `AnyJsxTag` have a child that is considered an input component +/// according to the passed `input_components` parameter +fn has_nested_control(options: &NoLabelWithoutControlOptions, jsx_tag: &AnyJsxTag) -> bool { + let mut child_iter = jsx_tag.syntax().preorder(); + while let Some(event) = child_iter.next() { + match event { + WalkEvent::Enter(child) => match child.kind() { + JsSyntaxKind::JSX_ELEMENT + | JsSyntaxKind::JSX_OPENING_ELEMENT + | JsSyntaxKind::JSX_CHILD_LIST + | JsSyntaxKind::JSX_SELF_CLOSING_ELEMENT => {} + _ => { + let Some(element_name) = AnyJsxElementName::cast(child) else { + child_iter.skip_subtree(); + continue; + }; + let Ok(element_name) = element_name.name_value_token() else { + continue; + }; + let element_name = element_name.text_trimmed(); + if DEFAULT_INPUT_COMPONENTS.contains(&element_name) + || options + .input_components + .iter() + .any(|name| name.as_ref() == element_name) + { + return true; } - }, - WalkEvent::Leave(_) => {} - } + } + }, + WalkEvent::Leave(_) => {} } - false } + false +} - fn has_element_name(&self, element_name: &str) -> bool { - self.label_components - .iter() - .any(|label_component_name| label_component_name.as_ref() == element_name) - } +fn has_element_name(options: &NoLabelWithoutControlOptions, element_name: &str) -> bool { + options + .label_components + .iter() + .any(|label_component_name| label_component_name.as_ref() == element_name) } pub struct NoLabelWithoutControlState { diff --git a/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_element_to_interactive_role.rs b/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_element_to_interactive_role.rs index 130c8dccb267..21887af9398b 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_element_to_interactive_role.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_element_to_interactive_role.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TokenText}; +use biome_rule_options::no_noninteractive_element_to_interactive_role::NoNoninteractiveElementToInteractiveRoleOptions; declare_lint_rule! { /// Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements. @@ -66,7 +67,7 @@ impl Rule for NoNoninteractiveElementToInteractiveRole { type Query = Aria; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoNoninteractiveElementToInteractiveRoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_tabindex.rs b/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_tabindex.rs index 8d6b8009ea2e..7ff206f86494 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_tabindex.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_noninteractive_tabindex.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ AnyJsxAttributeValue, AnyNumberLikeExpression, TextRange, jsx_ext::AnyJsxElement, }; use biome_rowan::{AstNode, BatchMutationExt, TokenText}; +use biome_rule_options::no_noninteractive_tabindex::NoNoninteractiveTabindexOptions; declare_lint_rule! { /// Enforce that `tabIndex` is not assigned to non-interactive HTML elements. @@ -67,7 +68,7 @@ impl Rule for NoNoninteractiveTabindex { type Query = Aria; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoNoninteractiveTabindexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_positive_tabindex.rs b/crates/biome_js_analyze/src/lint/a11y/no_positive_tabindex.rs index 04d2f1213db1..77f9f09221fb 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_positive_tabindex.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_positive_tabindex.rs @@ -14,6 +14,7 @@ use biome_js_syntax::{ JsPropertyObjectMember, JsStringLiteralExpression, JsUnaryExpression, JsxAttribute, TextRange, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_positive_tabindex::NoPositiveTabindexOptions; declare_lint_rule! { /// Prevent the usage of positive integers on `tabIndex` property @@ -100,7 +101,7 @@ impl Rule for NoPositiveTabindex { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoPositiveTabindexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_redundant_alt.rs b/crates/biome_js_analyze/src/lint/a11y/no_redundant_alt.rs index 0edb65736b5d..2b6dfcfb4975 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_redundant_alt.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_redundant_alt.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ AnyJsExpression, AnyJsLiteralExpression, AnyJsTemplateElement, AnyJsxAttributeValue, }; use biome_rowan::AstNode; +use biome_rule_options::no_redundant_alt::NoRedundantAltOptions; use biome_string_case::StrLikeExtension; declare_lint_rule! { @@ -55,7 +56,7 @@ impl Rule for NoRedundantAlt { type Query = Ast; type State = AnyJsxAttributeValue; type Signals = Option; - type Options = (); + type Options = NoRedundantAltOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_redundant_roles.rs b/crates/biome_js_analyze/src/lint/a11y/no_redundant_roles.rs index 6a0248af1871..491252b5d98a 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_redundant_roles.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_redundant_roles.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxAttributeValue, JsxAttribute, jsx_ext::AnyJsxElement}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_redundant_roles::NoRedundantRolesOptions; declare_lint_rule! { /// Enforce explicit `role` property is not the same as implicit/default role property on an element. @@ -61,7 +62,7 @@ impl Rule for NoRedundantRoles { type Query = Aria; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoRedundantRolesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_static_element_interactions.rs b/crates/biome_js_analyze/src/lint/a11y/no_static_element_interactions.rs index 2334cf6cb549..49971ea95fc2 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_static_element_interactions.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_static_element_interactions.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; +use biome_rule_options::no_static_element_interactions::NoStaticElementInteractionsOptions; declare_lint_rule! { /// Enforce that static, visible elements (such as `
`) that have click handlers use the valid role attribute. @@ -95,7 +96,7 @@ impl Rule for NoStaticElementInteractions { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = NoStaticElementInteractionsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/no_svg_without_title.rs b/crates/biome_js_analyze/src/lint/a11y/no_svg_without_title.rs index 2c937b726332..f62702e329be 100644 --- a/crates/biome_js_analyze/src/lint/a11y/no_svg_without_title.rs +++ b/crates/biome_js_analyze/src/lint/a11y/no_svg_without_title.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsxAttribute, JsxChildList, JsxElement, jsx_ext::AnyJsxElement}; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::no_svg_without_title::NoSvgWithoutTitleOptions; use biome_string_case::StrLikeExtension; declare_lint_rule! { @@ -111,7 +112,7 @@ impl Rule for NoSvgWithoutTitle { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoSvgWithoutTitleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_alt_text.rs b/crates/biome_js_analyze/src/lint/a11y/use_alt_text.rs index 7388c1f19674..dc37aeb08905 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_alt_text.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_alt_text.rs @@ -5,6 +5,7 @@ use biome_console::{fmt::Display, fmt::Formatter, markup}; use biome_diagnostics::Severity; use biome_js_syntax::{TextRange, jsx_ext::AnyJsxElement, static_value::StaticValue}; use biome_rowan::AstNode; +use biome_rule_options::use_alt_text::UseAltTextOptions; declare_lint_rule! { /// Enforce that all elements that require alternative text have meaningful information to relay back to the end user. @@ -76,7 +77,7 @@ impl Rule for UseAltText { type Query = Ast; type State = (ValidatedElement, TextRange); type Signals = Option; - type Options = (); + type Options = UseAltTextOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_anchor_content.rs b/crates/biome_js_analyze/src/lint/a11y/use_anchor_content.rs index ad9b4151ace1..9ac1140eb6d0 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_anchor_content.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_anchor_content.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsxElement; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_anchor_content::UseAnchorContentOptions; use crate::JsRuleAction; @@ -79,7 +80,7 @@ impl Rule for UseAnchorContent { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseAnchorContentOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_aria_activedescendant_with_tabindex.rs b/crates/biome_js_analyze/src/lint/a11y/use_aria_activedescendant_with_tabindex.rs index f0bf11308f74..dc693f0f6988 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_aria_activedescendant_with_tabindex.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_aria_activedescendant_with_tabindex.rs @@ -13,6 +13,7 @@ use biome_js_syntax::{ jsx_ext::AnyJsxElement, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::use_aria_activedescendant_with_tabindex::UseAriaActivedescendantWithTabindexOptions; declare_lint_rule! { /// Enforce that `tabIndex` is assigned to non-interactive HTML elements with `aria-activedescendant`. @@ -63,7 +64,7 @@ impl Rule for UseAriaActivedescendantWithTabindex { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = UseAriaActivedescendantWithTabindexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_aria_props_for_role.rs b/crates/biome_js_analyze/src/lint/a11y/use_aria_props_for_role.rs index 21923521c464..b01e36b161f6 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_aria_props_for_role.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_aria_props_for_role.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsxAttribute; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, TokenText}; +use biome_rule_options::use_aria_props_for_role::UseAriaPropsForRoleOptions; declare_lint_rule! { /// Enforce that elements with ARIA roles must have all required ARIA attributes for that role. @@ -59,7 +60,7 @@ impl Rule for UseAriaPropsForRole { type Query = Ast; type State = UseAriaPropsForRoleState; type Signals = Option; - type Options = (); + type Options = UseAriaPropsForRoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_aria_props_supported_by_role.rs b/crates/biome_js_analyze/src/lint/a11y/use_aria_props_supported_by_role.rs index ee086db334a6..4abf01467ad9 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_aria_props_supported_by_role.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_aria_props_supported_by_role.rs @@ -8,6 +8,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxAttribute, jsx_ext::AnyJsxElement}; use biome_rowan::AstNode; +use biome_rule_options::use_aria_props_supported_by_role::UseAriaPropsSupportedByRoleOptions; declare_lint_rule! { /// Enforce that ARIA properties are valid for the roles that are supported by the element. @@ -50,7 +51,7 @@ impl Rule for UseAriaPropsSupportedByRole { type Query = Aria; type State = AriaAttribute; type Signals = Option; - type Options = (); + type Options = UseAriaPropsSupportedByRoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_button_type.rs b/crates/biome_js_analyze/src/lint/a11y/use_button_type.rs index 95fdcf383ff4..7c629ed9e1a4 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_button_type.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_button_type.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ TextRange, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::use_button_type::UseButtonTypeOptions; declare_lint_rule! { /// Enforces the usage of the attribute `type` for the element `button` @@ -62,7 +63,7 @@ impl Rule for UseButtonType { type Query = Semantic; type State = UseButtonTypeState; type Signals = Option; - type Options = (); + type Options = UseButtonTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_focusable_interactive.rs b/crates/biome_js_analyze/src/lint/a11y/use_focusable_interactive.rs index d8ae97fc5698..8b44df13034b 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_focusable_interactive.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_focusable_interactive.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxAttributeValue, jsx_ext::AnyJsxElement}; use biome_rowan::AstNode; +use biome_rule_options::use_focusable_interactive::UseFocusableInteractiveOptions; use crate::services::aria::Aria; @@ -52,7 +53,7 @@ impl Rule for UseFocusableInteractive { type Query = Aria; type State = Box; type Signals = Option; - type Options = (); + type Options = UseFocusableInteractiveOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_heading_content.rs b/crates/biome_js_analyze/src/lint/a11y/use_heading_content.rs index 4faa4bde04e4..3e3c7c68ad38 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_heading_content.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_heading_content.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsxElement, jsx_ext::AnyJsxElement}; use biome_rowan::AstNode; +use biome_rule_options::use_heading_content::UseHeadingContentOptions; declare_lint_rule! { /// 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. @@ -72,7 +73,7 @@ impl Rule for UseHeadingContent { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseHeadingContentOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_html_lang.rs b/crates/biome_js_analyze/src/lint/a11y/use_html_lang.rs index f3f551128371..d59f030f2d32 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_html_lang.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_html_lang.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{TextRange, jsx_ext::AnyJsxElement}; use biome_rowan::AstNode; +use biome_rule_options::use_html_lang::UseHtmlLangOptions; declare_lint_rule! { /// Enforce that `html` element has `lang` attribute. @@ -69,7 +70,7 @@ impl Rule for UseHtmlLang { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseHtmlLangOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_iframe_title.rs b/crates/biome_js_analyze/src/lint/a11y/use_iframe_title.rs index 709e9ebd57e1..95cb53a76110 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_iframe_title.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_iframe_title.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; +use biome_rule_options::use_iframe_title::UseIframeTitleOptions; declare_lint_rule! { /// Enforces the usage of the attribute `title` for the element `iframe`. @@ -75,7 +76,7 @@ impl Rule for UseIframeTitle { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseIframeTitleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_key_with_click_events.rs b/crates/biome_js_analyze/src/lint/a11y/use_key_with_click_events.rs index fcae616d39f6..ffb1d4949331 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_key_with_click_events.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_key_with_click_events.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; +use biome_rule_options::use_key_with_click_events::UseKeyWithClickEventsOptions; declare_lint_rule! { /// Enforce onClick is accompanied by at least one of the following: `onKeyUp`, `onKeyDown`, `onKeyPress`. @@ -60,7 +61,7 @@ impl Rule for UseKeyWithClickEvents { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = UseKeyWithClickEventsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_key_with_mouse_events.rs b/crates/biome_js_analyze/src/lint/a11y/use_key_with_mouse_events.rs index ef427fbd13ac..1c2699394d57 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_key_with_mouse_events.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_key_with_mouse_events.rs @@ -5,6 +5,7 @@ use biome_console::{MarkupBuf, markup}; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; +use biome_rule_options::use_key_with_mouse_events::UseKeyWithMouseEventsOptions; declare_lint_rule! { /// Enforce `onMouseOver` / `onMouseOut` are accompanied by `onFocus` / `onBlur`. @@ -72,7 +73,7 @@ impl Rule for UseKeyWithMouseEvents { type Query = Semantic; type State = UseKeyWithMouseEventsState; type Signals = Option; - type Options = (); + type Options = UseKeyWithMouseEventsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_media_caption.rs b/crates/biome_js_analyze/src/lint/a11y/use_media_caption.rs index 6d5d533e713c..0295bcd8befe 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_media_caption.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_media_caption.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_js_syntax::{AnyJsxChild, JsxElement, TextRange}; use biome_rowan::AstNode; +use biome_rule_options::use_media_caption::UseMediaCaptionOptions; use biome_string_case::StrLikeExtension; declare_lint_rule! { @@ -46,7 +47,7 @@ impl Rule for UseMediaCaption { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseMediaCaptionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs b/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs index eacf7ed8cfda..d5784cc80188 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs @@ -7,6 +7,7 @@ use biome_deserialize::TextRange; use biome_diagnostics::Severity; use biome_js_syntax::{JsxAttribute, JsxOpeningElement}; use biome_rowan::AstNode; +use biome_rule_options::use_semantic_elements::UseSemanticElementsOptions; declare_lint_rule! { /// It detects the use of `role` attributes in JSX elements and suggests using semantic elements instead. @@ -56,7 +57,7 @@ impl Rule for UseSemanticElements { type Query = Ast; type State = JsxAttribute; type Signals = Option; - type Options = (); + type Options = UseSemanticElementsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_anchor.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_anchor.rs index 80a831572e26..33e7d3342bbe 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_anchor.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_anchor.rs @@ -4,6 +4,7 @@ use biome_console::{MarkupBuf, markup}; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::use_valid_anchor::UseValidAnchorOptions; declare_lint_rule! { /// Enforce that all anchors are valid, and they are navigable elements. @@ -145,7 +146,7 @@ impl Rule for UseValidAnchor { type Query = Ast; type State = UseValidAnchorState; type Signals = Option; - type Options = (); + type Options = UseValidAnchorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_props.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_props.rs index 518177b82f0a..1d21f5aeba65 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_props.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_props.rs @@ -9,6 +9,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsxAttribute; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::use_valid_aria_props::UseValidAriaPropsOptions; declare_lint_rule! { /// Ensures that ARIA properties `aria-*` are all valid. @@ -42,7 +43,7 @@ impl Rule for UseValidAriaProps { type Query = Ast; type State = JsxAttribute; type Signals = Box<[Self::State]>; - type Options = (); + type Options = UseValidAriaPropsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_role.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_role.rs index 8cdb565e95df..34d7ff567827 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_role.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_role.rs @@ -4,11 +4,10 @@ use biome_analyze::{ }; use biome_aria_metadata::AriaRole; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, BatchMutationExt}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::use_valid_aria_role::UseValidAriaRoleOptions; declare_lint_rule! { /// Elements with ARIA roles must use a valid, non-abstract ARIA role. @@ -45,15 +44,39 @@ declare_lint_rule! { /// /// ## Options /// + /// + /// ### `allowInvalidRoles` + /// + /// It allows specifying a list of roles that might be invalid otherwise + /// + /// ```json,options + /// { + /// "options": { + /// "allowInvalidRoles": ["datepicker"] + /// } + /// } + /// ``` + /// + /// ```jsx,use_options + ///
+ /// ``` + /// + /// ### `ignoreNonDom` + /// + /// Use this option to ignore non-DOM elements, such as components + /// /// ```json,options /// { /// "options": { - /// "allowInvalidRoles": ["invalid-role", "text"], /// "ignoreNonDom": true /// } /// } /// ``` /// + /// ```jsx,use_options + /// + /// ``` + /// /// ## Accessibility guidelines /// /// - [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value) @@ -75,19 +98,11 @@ declare_lint_rule! { } } -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct ValidAriaRoleOptions { - pub allow_invalid_roles: Box<[Box]>, - pub ignore_non_dom: bool, -} - impl Rule for UseValidAriaRole { type Query = Ast; type State = (); type Signals = Option; - type Options = Box; + type Options = UseValidAriaRoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_values.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_values.rs index 355d99f63d6a..556707e4149d 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_values.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_aria_values.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsSyntaxToken, JsxAttribute, TextRange}; use biome_rowan::AstNode; +use biome_rule_options::use_valid_aria_values::UseValidAriaValuesOptions; declare_lint_rule! { /// Enforce that ARIA state and property values are valid. @@ -68,7 +69,7 @@ impl Rule for UseValidAriaValues { type Query = Ast; type State = UseValidAriaValuesState; type Signals = Option; - type Options = (); + type Options = UseValidAriaValuesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_autocomplete.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_autocomplete.rs index 9db2848c03e3..c3cc32904d2a 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_autocomplete.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_autocomplete.rs @@ -2,10 +2,10 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::use_valid_autocomplete::UseValidAutocompleteOptions; declare_lint_rule! { /// Use valid values for the `autocomplete` attribute on `input` elements. @@ -132,21 +132,11 @@ const BILLING_AND_SHIPPING_ADDRESS: &[&str; 11] = &[ "street-address", ]; -#[derive( - Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseValidAutocompleteOptions { - /// `input` like custom components that should be checked. - pub input_components: Box<[Box]>, -} - impl Rule for UseValidAutocomplete { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = Box; + type Options = UseValidAutocompleteOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/a11y/use_valid_lang.rs b/crates/biome_js_analyze/src/lint/a11y/use_valid_lang.rs index 7bbea4f1321d..a791c1b72f1d 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_valid_lang.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_valid_lang.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::use_valid_lang::UseValidLangOptions; declare_lint_rule! { /// Ensure that the attribute passed to the `lang` attribute is a correct ISO language and/or country. /// @@ -54,7 +55,7 @@ impl Rule for UseValidLang { type Query = Ast; type State = UseValidLangState; type Signals = Option; - type Options = (); + type Options = UseValidLangOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_adjacent_spaces_in_regex.rs b/crates/biome_js_analyze/src/lint/complexity/no_adjacent_spaces_in_regex.rs index d7e06b0b0a29..bb9949cc0c86 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_adjacent_spaces_in_regex.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_adjacent_spaces_in_regex.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsRegexLiteralExpression, JsSyntaxKind, JsSyntaxToken, TextRange, TextSize}; use biome_rowan::BatchMutationExt; +use biome_rule_options::no_adjacent_spaces_in_regex::NoAdjacentSpacesInRegexOptions; use std::{fmt::Write, ops::Range}; use crate::JsRuleAction; @@ -60,7 +61,7 @@ impl Rule for NoAdjacentSpacesInRegex { type Query = Ast; type State = Vec>; type Signals = Option; - type Options = (); + type Options = NoAdjacentSpacesInRegexOptions; fn run(ctx: &RuleContext) -> Option { let value_token = ctx.query().value_token().ok()?; diff --git a/crates/biome_js_analyze/src/lint/complexity/no_arguments.rs b/crates/biome_js_analyze/src/lint/complexity/no_arguments.rs index 9f7c97ad38fc..a490a625d6dd 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_arguments.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_arguments.rs @@ -3,6 +3,7 @@ use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, decl use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::TextRange; +use biome_rule_options::no_arguments::NoArgumentsOptions; declare_lint_rule! { /// Disallow the use of `arguments`. @@ -39,7 +40,7 @@ impl Rule for NoArguments { type Query = SemanticServices; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoArgumentsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_banned_types.rs b/crates/biome_js_analyze/src/lint/complexity/no_banned_types.rs index 53b7122c79f4..f7076102db1e 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_banned_types.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_banned_types.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ TsReferenceType, TsTypeConstraintClause, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_banned_types::NoBannedTypesOptions; use crate::JsRuleAction; use crate::services::semantic::Semantic; @@ -103,7 +104,7 @@ impl Rule for NoBannedTypes { type Query = Semantic; type State = State; type Signals = Option; - type Options = (); + type Options = NoBannedTypesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_comma_operator.rs b/crates/biome_js_analyze/src/lint/complexity/no_comma_operator.rs index 1a5645c7d765..00ac2f21b36b 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_comma_operator.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_comma_operator.rs @@ -3,6 +3,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_diagnostics::Severity; use biome_js_syntax::{JsForStatement, JsSequenceExpression}; use biome_rowan::AstNode; +use biome_rule_options::no_comma_operator::NoCommaOperatorOptions; declare_lint_rule! { /// Disallow comma operator. @@ -51,7 +52,7 @@ impl Rule for NoCommaOperator { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoCommaOperatorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let seq = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_empty_type_parameters.rs b/crates/biome_js_analyze/src/lint/complexity/no_empty_type_parameters.rs index 7f08dae09d0f..d81a7eede935 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_empty_type_parameters.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_empty_type_parameters.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsSyntaxKind, TsTypeParameters}; use biome_rowan::{AstNode, AstSeparatedList, SyntaxNodeOptionExt}; +use biome_rule_options::no_empty_type_parameters::NoEmptyTypeParametersOptions; declare_lint_rule! { /// Disallow empty type parameters in type aliases and interfaces. @@ -48,7 +49,7 @@ impl Rule for NoEmptyTypeParameters { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoEmptyTypeParametersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs b/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs index 01d54cfd1b73..579b112cc974 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs @@ -3,18 +3,13 @@ use biome_analyze::{ Visitor, VisitorContext, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyFunctionLike, JsBreakStatement, JsContinueStatement, JsElseClause, JsLanguage, JsLogicalExpression, JsLogicalOperator, JsSyntaxNode, }; use biome_rowan::{AstNode, Language, SyntaxNode, TextRange, WalkEvent}; -use serde::{Deserialize, Serialize}; -use std::num::NonZeroU8; - -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::no_excessive_cognitive_complexity::NoExcessiveCognitiveComplexityOptions; const MAX_FUNCTION_DEPTH: usize = 10; const MAX_SCORE: u8 = u8::MAX; @@ -57,7 +52,7 @@ declare_lint_rule! { /// /// ## Options /// - /// Allows to specify the maximum allowed complexity. + /// Allows specifying the maximum allowed complexity. /// /// ```json,options /// { @@ -83,7 +78,7 @@ impl Rule for NoExcessiveCognitiveComplexity { type Query = CognitiveComplexity; type State = (); type Signals = Option; - type Options = ComplexityOptions; + type Options = NoExcessiveCognitiveComplexityOptions; fn run(ctx: &RuleContext) -> Self::Signals { let calculated_score = ctx.query().score.calculated_score; @@ -96,7 +91,7 @@ impl Rule for NoExcessiveCognitiveComplexity { score: ComplexityScore { calculated_score }, } = ctx.query(); - let ComplexityOptions { + let NoExcessiveCognitiveComplexityOptions { max_allowed_complexity, } = ctx.options(); @@ -367,20 +362,3 @@ fn receives_nesting_penalty(node: &JsSyntaxNode) -> bool { pub struct ComplexityScore { calculated_score: u8, } - -/// Options for the rule `noExcessiveCognitiveComplexity`. -#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct ComplexityOptions { - /// The maximum complexity score that we allow. Anything higher is considered excessive. - pub max_allowed_complexity: NonZeroU8, -} - -impl Default for ComplexityOptions { - fn default() -> Self { - Self { - max_allowed_complexity: NonZeroU8::new(15).unwrap(), - } - } -} diff --git a/crates/biome_js_analyze/src/lint/complexity/no_excessive_nested_test_suites.rs b/crates/biome_js_analyze/src/lint/complexity/no_excessive_nested_test_suites.rs index c23228c1dd40..3ecf680962f2 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_excessive_nested_test_suites.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_excessive_nested_test_suites.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsCallExpression, JsLanguage, JsStaticMemberExpression}; use biome_rowan::{AstNode, Language, SyntaxNode, SyntaxNodeOptionExt, TextRange, WalkEvent}; +use biome_rule_options::no_excessive_nested_test_suites::NoExcessiveNestedTestSuitesOptions; declare_lint_rule! { /// This rule enforces a maximum depth to nested `describe()` in test files. @@ -67,7 +68,7 @@ impl Rule for NoExcessiveNestedTestSuites { type Query = NestedTest; type State = (); type Signals = Option; - type Options = (); + type Options = NoExcessiveNestedTestSuitesOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_js_analyze/src/lint/complexity/no_extra_boolean_cast.rs b/crates/biome_js_analyze/src/lint/complexity/no_extra_boolean_cast.rs index c0ae277722a6..7dd62e79eef6 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_extra_boolean_cast.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_extra_boolean_cast.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsSyntaxNode, JsUnaryOperator, is_in_boolean_context, is_negation, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_extra_boolean_cast::NoExtraBooleanCastOptions; use crate::JsRuleAction; @@ -92,7 +93,7 @@ impl Rule for NoExtraBooleanCast { type Query = Ast; type State = (AnyJsExpression, ExtraBooleanCastType); type Signals = Option; - type Options = (); + type Options = NoExtraBooleanCastOptions; fn run(ctx: &RuleContext) -> Option { let n = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_flat_map_identity.rs b/crates/biome_js_analyze/src/lint/complexity/no_flat_map_identity.rs index 809965679c41..03f534b1731d 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_flat_map_identity.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_flat_map_identity.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsCallExpression, JsSyntaxKind, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_flat_map_identity::NoFlatMapIdentityOptions; use crate::JsRuleAction; @@ -50,7 +51,7 @@ impl Rule for NoFlatMapIdentity { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoFlatMapIdentityOptions; fn run(ctx: &RuleContext) -> Self::Signals { let flat_map_call = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_for_each.rs b/crates/biome_js_analyze/src/lint/complexity/no_for_each.rs index 83327a2b6416..142e66b16511 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_for_each.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_for_each.rs @@ -2,14 +2,10 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize::{ - DeserializableValidator, DeserializationContext, DeserializationDiagnostic, -}; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, AnyJsMemberExpression, JsCallExpression}; -use biome_rowan::{AstNode, AstSeparatedList, TextRange}; -use serde::{Deserialize, Serialize}; +use biome_rowan::{AstNode, AstSeparatedList}; +use biome_rule_options::no_for_each::NoForEachOptions; declare_lint_rule! { /// Prefer `for...of` statement instead of `Array.forEach`. @@ -164,39 +160,3 @@ impl Rule for NoForEach { })) } } - -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[deserializable(with_validator)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoForEachOptions { - #[serde(skip_serializing_if = "<[_]>::is_empty")] - /// A list of variable names allowed for `forEach` calls. - pub allowed_identifiers: Box<[Box]>, -} - -impl DeserializableValidator for NoForEachOptions { - fn validate( - &mut self, - ctx: &mut impl DeserializationContext, - _name: &str, - range: TextRange, - ) -> bool { - if self - .allowed_identifiers - .iter() - .any(|identifier| identifier.is_empty() || identifier.contains('.')) - { - ctx - .report( - DeserializationDiagnostic::new(markup!( - "'allowedIdentifiers'"" does not accept empty values or values with dots." - )) - .with_range(range) - ); - return false; - } - - true - } -} diff --git a/crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs b/crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs index 1bf415429f89..12bcec87867a 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ TsPropertySignatureClassMember, TsSetterSignatureClassMember, }; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::no_static_only_class::NoStaticOnlyClassOptions; declare_lint_rule! { /// This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace. @@ -135,7 +136,7 @@ impl Rule for NoStaticOnlyClass { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoStaticOnlyClassOptions; fn run(ctx: &RuleContext) -> Self::Signals { let class_declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_this_in_static.rs b/crates/biome_js_analyze/src/lint/complexity/no_this_in_static.rs index 888e2367bee4..c938704ee4d3 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_this_in_static.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_this_in_static.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsSyntaxToken, JsThisExpression, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, SyntaxResult, declare_node_union}; +use biome_rule_options::no_this_in_static::NoThisInStaticOptions; use crate::{JsRuleAction, services::control_flow::AnyJsControlFlowRoot}; @@ -92,7 +93,7 @@ impl Rule for NoThisInStatic { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoThisInStaticOptions; fn run(ctx: &RuleContext) -> Self::Signals { let this_super_expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_catch.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_catch.rs index e137e2dd6510..79b2ba6fdb2c 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_catch.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_catch.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsTryStatement, JsStatementList, TextRange}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::no_useless_catch::NoUselessCatchOptions; use crate::JsRuleAction; @@ -79,7 +80,7 @@ impl Rule for NoUselessCatch { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoUselessCatchOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs index 5cd39dea7d8d..7b401b7aaa40 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsCallExpression, JsConstructorClassMember, }; use biome_rowan::{AstNode, AstNodeList, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_useless_constructor::NoUselessConstructorOptions; use crate::JsRuleAction; @@ -132,7 +133,7 @@ impl Rule for NoUselessConstructor { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessConstructorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let constructor = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_continue.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_continue.rs index b808c3f0e639..81ad8ff1ce70 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_continue.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_continue.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsContinueStatement, JsLabeledStatement, JsSyntaxKind, JsSyntaxNode}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_useless_continue::NoUselessContinueOptions; use crate::{JsRuleAction, utils::batch::JsBatchMutation}; @@ -83,7 +84,7 @@ impl Rule for NoUselessContinue { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessContinueOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_empty_export.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_empty_export.rs index c6b03643ac16..e7029efb082d 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_empty_export.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_empty_export.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsModuleItem, JsExport, JsModuleItemList, JsSyntaxToken}; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_useless_empty_export::NoUselessEmptyExportOptions; use crate::JsRuleAction; @@ -57,7 +58,7 @@ impl Rule for NoUselessEmptyExport { /// The first import or export that makes useless the empty export. type State = JsSyntaxToken; type Signals = Option; - type Options = (); + type Options = NoUselessEmptyExportOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_escape_in_regex.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_escape_in_regex.rs index 37e235976cc0..2781fb53f979 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_escape_in_regex.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_escape_in_regex.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsRegexLiteralExpression, JsSyntaxKind, JsSyntaxToken}; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TextSize}; +use biome_rule_options::no_useless_escape_in_regex::NoUselessEscapeInRegexOptions; use crate::JsRuleAction; @@ -54,7 +55,7 @@ impl Rule for NoUselessEscapeInRegex { type Query = Ast; type State = State; type Signals = Option; - type Options = (); + type Options = NoUselessEscapeInRegexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs index 0b19a9adbcfd..451a404d2a8b 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs @@ -17,6 +17,7 @@ use biome_js_syntax::{ JsxText, T, }; use biome_rowan::{AstNode, AstNodeList, BatchMutation, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_useless_fragments::NoUselessFragmentsOptions; declare_lint_rule! { /// Disallow unnecessary fragments @@ -131,7 +132,7 @@ impl Rule for NoUselessFragments { type Query = Semantic; type State = NoUselessFragmentsState; type Signals = Option; - type Options = (); + type Options = NoUselessFragmentsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_label.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_label.rs index e59eb819753d..c010188a9d17 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_label.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_label.rs @@ -6,6 +6,7 @@ use biome_js_syntax::{AnyJsStatement, JsLabeledStatement, JsSyntaxKind}; use crate::JsRuleAction; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_useless_label::NoUselessLabelOptions; declare_lint_rule! { /// Disallow unnecessary labels. @@ -47,7 +48,7 @@ impl Rule for NoUselessLabel { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessLabelOptions; fn run(ctx: &RuleContext) -> Option { let stmt = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_lone_block_statements.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_lone_block_statements.rs index 9caab08e99d7..bd39d066b4b6 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_lone_block_statements.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_lone_block_statements.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsStatementList, JsSyntaxKind, JsVariableStatement, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::no_useless_lone_block_statements::NoUselessLoneBlockStatementsOptions; declare_lint_rule! { /// Disallow unnecessary nested block statements. @@ -57,7 +58,7 @@ impl Rule for NoUselessLoneBlockStatements { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessLoneBlockStatementsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let block = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_rename.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_rename.rs index b7e4860e1871..f4ccfa196140 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_rename.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_rename.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsObjectBindingPatternProperty, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union, trim_leading_trivia_pieces}; +use biome_rule_options::no_useless_rename::NoUselessRenameOptions; use crate::JsRuleAction; @@ -76,7 +77,7 @@ impl Rule for NoUselessRename { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessRenameOptions; fn run(ctx: &RuleContext) -> Self::Signals { let renaming = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_string_concat.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_string_concat.rs index 2f0b7bc9ba12..fa1a658f6c9d 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_string_concat.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_string_concat.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ AnyJsExpression, AnyJsLiteralExpression, JsBinaryExpression, JsBinaryOperator, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TextSize}; +use biome_rule_options::no_useless_string_concat::NoUselessStringConcatOptions; use crate::JsRuleAction; @@ -76,7 +77,7 @@ impl Rule for NoUselessStringConcat { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoUselessStringConcatOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_string_raw.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_string_raw.rs index ef4a49ccfec7..703f656318a2 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_string_raw.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_string_raw.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsTemplateElement, JsTemplateExpression}; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::no_useless_string_raw::NoUselessStringRawOptions; declare_lint_rule! { /// Disallow unnecessary `String.raw` function in template string literals without any escape sequence. @@ -43,7 +44,7 @@ impl Rule for NoUselessStringRaw { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessStringRawOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_switch_case.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_switch_case.rs index c74944a0d40e..f33dbe4bff94 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_switch_case.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_switch_case.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsSwitchClause, JsCaseClause, JsDefaultClause}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, Direction}; +use biome_rule_options::no_useless_switch_case::NoUselessSwitchCaseOptions; use crate::JsRuleAction; @@ -72,7 +73,7 @@ impl Rule for NoUselessSwitchCase { type Query = Ast; type State = JsCaseClause; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoUselessSwitchCaseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let default_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_ternary.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_ternary.rs index 3406be26e2a8..8183d2bc7535 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_ternary.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_ternary.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ OperatorPrecedence, T, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_useless_ternary::NoUselessTernaryOptions; use crate::JsRuleAction; @@ -67,7 +68,7 @@ impl Rule for NoUselessTernary { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessTernaryOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_this_alias.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_this_alias.rs index 4ba879824a52..7bb536cc6135 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_this_alias.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_this_alias.rs @@ -14,6 +14,7 @@ use biome_js_syntax::{ JsThisExpression, JsVariableDeclaration, JsVariableDeclarator, JsVariableStatement, T, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_useless_this_alias::NoUselessThisAliasOptions; declare_lint_rule! { /// Disallow useless `this` aliasing. @@ -65,7 +66,7 @@ impl Rule for NoUselessThisAlias { type Query = Semantic; type State = JsIdentifierBinding; type Signals = Option; - type Options = (); + type Options = NoUselessThisAliasOptions; fn run(ctx: &RuleContext) -> Self::Signals { let declarator = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs index 3b4447e6b3f1..d36dabdfd1ac 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutationExt, SyntaxNodeOptionExt, trim_leading_trivia_pieces, }; +use biome_rule_options::no_useless_type_constraint::NoUselessTypeConstraintOptions; use crate::JsRuleAction; @@ -91,7 +92,7 @@ impl Rule for NoUselessTypeConstraint { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUselessTypeConstraintOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_useless_undefined_initialization.rs b/crates/biome_js_analyze/src/lint/complexity/no_useless_undefined_initialization.rs index 1d97d332cc27..36b4e6258f44 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_useless_undefined_initialization.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_useless_undefined_initialization.rs @@ -7,6 +7,7 @@ use biome_js_factory::make::js_variable_declarator_list; use biome_js_syntax::{JsLanguage, JsSyntaxToken, JsVariableDeclarator, JsVariableStatement}; use biome_rowan::{AstNode, BatchMutationExt, TextRange}; use biome_rowan::{SyntaxTriviaPiece, chain_trivia_pieces}; +use biome_rule_options::no_useless_undefined_initialization::NoUselessUndefinedInitializationOptions; use crate::JsRuleAction; @@ -63,7 +64,7 @@ impl Rule for NoUselessUndefinedInitialization { type Query = Ast; type State = (Box, TextRange); type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoUselessUndefinedInitializationOptions; fn run(ctx: &RuleContext) -> Self::Signals { let statement = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/no_void.rs b/crates/biome_js_analyze/src/lint/complexity/no_void.rs index c9992101fa88..a3bf2c6ccad6 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_void.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_void.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsUnaryExpression; use biome_rowan::AstNode; +use biome_rule_options::no_void::NoVoidOptions; declare_lint_rule! { /// Disallow the use of `void` operators, which is not a familiar operator. @@ -34,7 +35,7 @@ impl Rule for NoVoid { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoVoidOptions; fn run(ctx: &RuleContext) -> Self::Signals { let expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_arrow_function.rs b/crates/biome_js_analyze/src/lint/complexity/use_arrow_function.rs index bc0e1260403a..9c591e9ea71f 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_arrow_function.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_arrow_function.rs @@ -17,6 +17,7 @@ use biome_rowan::{ AstNode, AstNodeList, AstSeparatedList, BatchMutationExt, Language, SyntaxNode, TextRange, TriviaPieceKind, WalkEvent, declare_node_union, }; +use biome_rule_options::use_arrow_function::UseArrowFunctionOptions; declare_lint_rule! { /// Use arrow functions over function expressions. @@ -81,7 +82,7 @@ impl Rule for UseArrowFunction { type Query = ActualThisScope; type State = (); type Signals = Option; - type Options = (); + type Options = UseArrowFunctionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let AnyThisScopeMetadata { scope, has_this } = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_date_now.rs b/crates/biome_js_analyze/src/lint/complexity/use_date_now.rs index e7e760f22156..44b2e6b4a2dc 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_date_now.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_date_now.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsNewOrCallExpression, JsSyntaxKind, JsSyntaxNode, JsUnaryOperator, T, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::use_date_now::UseDateNowOptions; use crate::JsRuleAction; @@ -68,7 +69,7 @@ impl Rule for UseDateNow { type Query = Ast; type State = (AnyJsExpression, UseDateNowIssueKind); type Signals = Option; - type Options = (); + type Options = UseDateNowOptions; fn run(ctx: &RuleContext) -> Self::Signals { let expr = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_flat_map.rs b/crates/biome_js_analyze/src/lint/complexity/use_flat_map.rs index 76a81a922bc4..f3cd9d76d77c 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_flat_map.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_flat_map.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make::{ident, js_name}; use biome_js_syntax::{AnyJsExpression, AnyJsMemberExpression, AnyJsName, JsCallExpression}; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::use_flat_map::UseFlatMapOptions; declare_lint_rule! { /// Promotes the use of `.flatMap()` when `map().flat()` are used together. @@ -49,7 +50,7 @@ impl Rule for UseFlatMap { type Query = Ast; type State = JsCallExpression; type Signals = Option; - type Options = (); + type Options = UseFlatMapOptions; fn run(ctx: &RuleContext) -> Self::Signals { let flat_call = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_literal_keys.rs b/crates/biome_js_analyze/src/lint/complexity/use_literal_keys.rs index cbd8dabfcbc1..0357a07b44c4 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_literal_keys.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_literal_keys.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ static_value::StaticValue, }; use biome_rowan::{AstNode, BatchMutationExt, SyntaxNodeOptionExt, TextRange, declare_node_union}; +use biome_rule_options::use_literal_keys::UseLiteralKeysOptions; use biome_unicode_table::is_js_ident; declare_lint_rule! { @@ -64,7 +65,7 @@ impl Rule for UseLiteralKeys { type Query = Ast; type State = (TextRange, JsSyntaxToken, bool); type Signals = Option; - type Options = (); + type Options = UseLiteralKeysOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_numeric_literals.rs b/crates/biome_js_analyze/src/lint/complexity/use_numeric_literals.rs index d1811611aa17..7c174620c175 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_numeric_literals.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_numeric_literals.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsSyntaxToken, global_identifier, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::use_numeric_literals::UseNumericLiteralsOptions; declare_lint_rule! { /// Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals @@ -69,7 +70,7 @@ impl Rule for UseNumericLiterals { type Query = Semantic; type State = CallInfo; type Signals = Option; - type Options = (); + type Options = UseNumericLiteralsOptions; fn run(ctx: &RuleContext) -> Option { let expr = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_optional_chain.rs b/crates/biome_js_analyze/src/lint/complexity/use_optional_chain.rs index 38346e0cf05d..64cec5ef8516 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_optional_chain.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_optional_chain.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ OperatorPrecedence, T, }; use biome_rowan::{AstNode, AstNodeExt, BatchMutationExt, SyntaxResult}; +use biome_rule_options::use_optional_chain::UseOptionalChainOptions; use std::cmp::Ordering; use std::collections::VecDeque; use std::iter; @@ -91,7 +92,7 @@ impl Rule for UseOptionalChain { type Query = Ast; type State = UseOptionalChainState; type Signals = Option; - type Options = (); + type Options = UseOptionalChainOptions; fn run(ctx: &RuleContext) -> Option { let logical = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_regex_literals.rs b/crates/biome_js_analyze/src/lint/complexity/use_regex_literals.rs index cc2efd0e4ca6..bb9998f6b9be 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_regex_literals.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_regex_literals.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ global_identifier, static_value::StaticValue, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxError, TextRange, TokenText}; +use biome_rule_options::use_regex_literals::UseRegexLiteralsOptions; use crate::{JsRuleAction, services::semantic::Semantic}; @@ -64,7 +65,7 @@ impl Rule for UseRegexLiterals { type Query = Semantic; type State = UseRegexLiteralsState; type Signals = Option; - type Options = (); + type Options = UseRegexLiteralsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_simple_number_keys.rs b/crates/biome_js_analyze/src/lint/complexity/use_simple_number_keys.rs index 3a955edd84c7..54671c836f8f 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_simple_number_keys.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_simple_number_keys.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ TextRange, }; use biome_rowan::{AstNode, BatchMutationExt, SyntaxResult}; +use biome_rule_options::use_simple_number_keys::UseSimpleNumberKeysOptions; use std::str::FromStr; declare_lint_rule! { @@ -268,7 +269,7 @@ impl Rule for UseSimpleNumberKeys { type Query = Ast; type State = RuleState; type Signals = Box<[Self::State]>; - type Options = (); + type Options = UseSimpleNumberKeysOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut result = Vec::new(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_simplified_logic_expression.rs b/crates/biome_js_analyze/src/lint/complexity/use_simplified_logic_expression.rs index 68177ea79784..203da9af6677 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_simplified_logic_expression.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_simplified_logic_expression.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsUnaryExpression, JsUnaryOperator, T, }; use biome_rowan::{AstNode, AstNodeExt, BatchMutationExt}; +use biome_rule_options::use_simplified_logic_expression::UseSimplifiedLogicExpressionOptions; declare_lint_rule! { /// Discard redundant terms from logical expressions. @@ -61,7 +62,7 @@ impl Rule for UseSimplifiedLogicExpression { /// First element of tuple is if the expression is simplified by [De Morgan's Law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws) rule, the second element is the expression to replace. type State = (bool, AnyJsExpression); type Signals = Option; - type Options = (); + type Options = UseSimplifiedLogicExpressionOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/complexity/use_while.rs b/crates/biome_js_analyze/src/lint/complexity/use_while.rs index d475508b3aa6..49f9152117a0 100644 --- a/crates/biome_js_analyze/src/lint/complexity/use_while.rs +++ b/crates/biome_js_analyze/src/lint/complexity/use_while.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsStatement, JsForStatement, T}; use biome_rowan::{AstNode, BatchMutationExt, trim_leading_trivia_pieces}; +use biome_rule_options::use_while::UseWhileOptions; use crate::JsRuleAction; @@ -53,7 +54,7 @@ impl Rule for UseWhile { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseWhileOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs b/crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs index f1b0b205d899..99837f64c2e5 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsCallExpression, JsxAttribute}; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_children_prop::NoChildrenPropOptions; declare_lint_rule! { /// Prevent passing of **children** as props. /// @@ -46,7 +47,7 @@ impl Rule for NoChildrenProp { type Query = Semantic; type State = NoChildrenPropState; type Signals = Option; - type Options = (); + type Options = NoChildrenPropOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_const_assign.rs b/crates/biome_js_analyze/src/lint/correctness/no_const_assign.rs index 75fce56cbaeb..541e91424d20 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_const_assign.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_const_assign.rs @@ -8,6 +8,7 @@ use biome_js_factory::make::{self}; use biome_js_syntax::binding_ext::AnyJsBindingDeclaration; use biome_js_syntax::{JsIdentifierAssignment, JsSyntaxKind}; use biome_rowan::{AstNode, BatchMutationExt, TextRange}; +use biome_rule_options::no_const_assign::NoConstAssignOptions; declare_lint_rule! { /// Prevents from having `const` variables being re-assigned. @@ -62,7 +63,7 @@ impl Rule for NoConstAssign { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoConstAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_constant_condition.rs b/crates/biome_js_analyze/src/lint/correctness/no_constant_condition.rs index 84cd1251a2f6..e01901e3dc3c 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_constant_condition.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_constant_condition.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsWhileStatement, JsYieldExpression, TextRange, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_constant_condition::NoConstantConditionOptions; declare_lint_rule! { /// Disallow constant expressions in conditions @@ -97,7 +98,7 @@ impl Rule for NoConstantCondition { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoConstantConditionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let conditional_stmt = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_constant_math_min_max_clamp.rs b/crates/biome_js_analyze/src/lint/correctness/no_constant_math_min_max_clamp.rs index 56bf1532afe8..ed9acd8a03b8 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_constant_math_min_max_clamp.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_constant_math_min_max_clamp.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsNumberLiteralExpression, global_identifier, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_constant_math_min_max_clamp::NoConstantMathMinMaxClampOptions; use crate::{JsRuleAction, services::semantic::Semantic}; @@ -49,7 +50,7 @@ impl Rule for NoConstantMathMinMaxClamp { type Query = Semantic; type State = (JsNumberLiteralExpression, JsNumberLiteralExpression); type Signals = Option; - type Options = (); + type Options = NoConstantMathMinMaxClampOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_constructor_return.rs b/crates/biome_js_analyze/src/lint/correctness/no_constructor_return.rs index 418e3f45119b..8645c2e4dec8 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_constructor_return.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_constructor_return.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsConstructorClassMember, JsReturnStatement}; use biome_rowan::AstNode; +use biome_rule_options::no_constructor_return::NoConstructorReturnOptions; use crate::services::control_flow::AnyJsControlFlowRoot; @@ -67,7 +68,7 @@ impl Rule for NoConstructorReturn { type Query = Ast; type State = JsConstructorClassMember; type Signals = Option; - type Options = (); + type Options = NoConstructorReturnOptions; fn run(ctx: &RuleContext) -> Self::Signals { let ret = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_empty_character_class_in_regex.rs b/crates/biome_js_analyze/src/lint/correctness/no_empty_character_class_in_regex.rs index 0489cfaf8d31..375ebd3a4322 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_empty_character_class_in_regex.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_empty_character_class_in_regex.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsRegexLiteralExpression; use biome_rowan::{TextRange, TextSize}; +use biome_rule_options::no_empty_character_class_in_regex::NoEmptyCharacterClassInRegexOptions; declare_lint_rule! { /// Disallow empty character classes in regular expression literals. @@ -55,7 +56,7 @@ impl Rule for NoEmptyCharacterClassInRegex { type Query = Ast; type State = Range; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoEmptyCharacterClassInRegexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut empty_classes = vec![]; diff --git a/crates/biome_js_analyze/src/lint/correctness/no_empty_pattern.rs b/crates/biome_js_analyze/src/lint/correctness/no_empty_pattern.rs index 4f1b4df2ac62..4cf3b08918bc 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_empty_pattern.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_empty_pattern.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsArrayBindingPattern, JsObjectBindingPattern}; use biome_rowan::{AstNode, AstSeparatedList, declare_node_union}; +use biome_rule_options::no_empty_pattern::NoEmptyPatternOptions; declare_lint_rule! { /// Disallows empty destructuring patterns. @@ -49,7 +50,7 @@ impl Rule for NoEmptyPattern { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoEmptyPatternOptions; fn run(ctx: &RuleContext) -> Option { use JsAnyBindPatternLike::*; diff --git a/crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs b/crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs index 2858127ca783..48b009dee065 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsCallExpression, JsNewExpression, global_identifier}; use biome_rowan::{SyntaxResult, TextRange, declare_node_union}; +use biome_rule_options::no_global_object_calls::NoGlobalObjectCallsOptions; use std::{fmt::Display, str::FromStr}; declare_lint_rule! { @@ -98,7 +99,7 @@ impl Rule for NoGlobalObjectCalls { type Query = Semantic; type State = (NonCallableGlobals, TextRange); type Signals = Option; - type Options = (); + type Options = NoGlobalObjectCallsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_inner_declarations.rs b/crates/biome_js_analyze/src/lint/correctness/no_inner_declarations.rs index 87ad9d9380f1..abff6638a408 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_inner_declarations.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_inner_declarations.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsDeclaration, JsFileSource, JsStatementList, JsSyntaxKind}; use biome_rowan::AstNode; +use biome_rule_options::no_inner_declarations::NoInnerDeclarationsOptions; use crate::services::control_flow::AnyJsControlFlowRoot; @@ -102,7 +103,7 @@ impl Rule for NoInnerDeclarations { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoInnerDeclarationsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let decl = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_invalid_builtin_instantiation.rs b/crates/biome_js_analyze/src/lint/correctness/no_invalid_builtin_instantiation.rs index 332ad4a1bdbc..506e7cc7d278 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_invalid_builtin_instantiation.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_invalid_builtin_instantiation.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ static_value::StaticValue, }; use biome_rowan::{AstNode, BatchMutationExt, chain_trivia_pieces}; +use biome_rule_options::no_invalid_builtin_instantiation::NoInvalidBuiltinInstantiationOptions; use crate::lint::style::use_throw_new_error::convert_call_expression_to_new_expression; @@ -89,7 +90,7 @@ impl Rule for NoInvalidBuiltinInstantiation { type Query = Semantic; type State = NoInvalidBuiltinInstantiationState; type Signals = Option; - type Options = (); + type Options = NoInvalidBuiltinInstantiationOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_invalid_constructor_super.rs b/crates/biome_js_analyze/src/lint/correctness/no_invalid_constructor_super.rs index 9ba41e61cf8e..2afc7342a768 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_invalid_constructor_super.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_invalid_constructor_super.rs @@ -6,6 +6,7 @@ use biome_js_syntax::{ AnyJsClass, AnyJsExpression, JsAssignmentOperator, JsConstructorClassMember, JsLogicalOperator, }; use biome_rowan::{AstNode, AstNodeList, TextRange}; +use biome_rule_options::no_invalid_constructor_super::NoInvalidConstructorSuperOptions; declare_lint_rule! { /// Prevents the incorrect use of `super()` inside classes. It also checks whether a call `super()` is missing from classes that extends other constructors. @@ -99,7 +100,7 @@ impl Rule for NoInvalidConstructorSuper { type Query = Ast; type State = NoInvalidConstructorSuperState; type Signals = Option; - type Options = (); + type Options = NoInvalidConstructorSuperOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs b/crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs index 8c6bf02cb072..f5008f1a3de9 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ binding_ext::{AnyJsBindingDeclaration, AnyJsIdentifierBinding}, }; use biome_rowan::{AstNode, SyntaxNodeOptionExt, TextRange}; +use biome_rule_options::no_invalid_use_before_declaration::NoInvalidUseBeforeDeclarationOptions; declare_lint_rule! { /// Disallow the use of variables and function parameters before their declaration @@ -75,7 +76,7 @@ impl Rule for NoInvalidUseBeforeDeclaration { type Query = SemanticServices; type State = InvalidUseBeforeDeclaration; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoInvalidUseBeforeDeclarationOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_nodejs_modules.rs b/crates/biome_js_analyze/src/lint/correctness/no_nodejs_modules.rs index aa8fdf1b3d6b..bfed2dbc1fdd 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_nodejs_modules.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_nodejs_modules.rs @@ -6,6 +6,7 @@ use biome_js_syntax::{AnyJsImportClause, AnyJsImportLike, inner_string_text}; use biome_resolver::is_builtin_node_module; use biome_rowan::AstNode; use biome_rowan::TextRange; +use biome_rule_options::no_nodejs_modules::NoNodejsModulesOptions; declare_lint_rule! { /// Forbid the use of Node.js builtin modules. @@ -52,7 +53,7 @@ impl Rule for NoNodejsModules { type Query = Manifest; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoNodejsModulesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_nonoctal_decimal_escape.rs b/crates/biome_js_analyze/src/lint/correctness/no_nonoctal_decimal_escape.rs index 2130a932ba01..328bc27d92cc 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_nonoctal_decimal_escape.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_nonoctal_decimal_escape.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsLiteralMemberName, JsStringLiteralExpression, JsSyntaxKind, JsSyntaxToken, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, declare_node_union}; +use biome_rule_options::no_nonoctal_decimal_escape::NoNonoctalDecimalEscapeOptions; use rustc_hash::FxHashSet; use std::ops::Range; @@ -82,7 +83,7 @@ impl Rule for NoNonoctalDecimalEscape { type Query = Ast; type State = RuleState; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoNonoctalDecimalEscapeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_precision_loss.rs b/crates/biome_js_analyze/src/lint/correctness/no_precision_loss.rs index 5e6e01c17cf1..be4c30bae97e 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_precision_loss.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_precision_loss.rs @@ -9,6 +9,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsNumberLiteralExpression; use biome_js_syntax::numbers::split_into_radix_and_number; use biome_rowan::AstNode; +use biome_rule_options::no_precision_loss::NoPrecisionLossOptions; declare_lint_rule! { /// Disallow literal numbers that lose precision @@ -64,7 +65,7 @@ impl Rule for NoPrecisionLoss { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoPrecisionLossOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs b/crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs index e7983064b829..1966925dca62 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs @@ -1,8 +1,8 @@ +use crate::services::module_graph::ResolvedImports; use biome_analyze::{ Rule, RuleDiagnostic, RuleDomain, RuleSource, context::RuleContext, declare_lint_rule, }; -use biome_console::{fmt::Display, markup}; -use biome_deserialize_macros::Deserializable; +use biome_console::markup; use biome_diagnostics::Severity; use biome_fs::BiomePath; use biome_js_syntax::{ @@ -11,15 +11,10 @@ use biome_js_syntax::{ use biome_jsdoc_comment::JsdocComment; use biome_module_graph::{JsModuleInfo, ModuleGraph, ResolvedPath}; use biome_rowan::{AstNode, SyntaxResult, Text, TextRange}; +use biome_rule_options::no_private_imports::{NoPrivateImportsOptions, Visibility}; use camino::{Utf8Path, Utf8PathBuf}; -use serde::{Deserialize, Serialize}; use std::str::FromStr; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; - -use crate::services::module_graph::ResolvedImports; - const INDEX_BASENAMES: &[&str] = &["index", "mod"]; declare_lint_rule! { @@ -156,50 +151,6 @@ declare_lint_rule! { } } -/// Options for the rule `noPrivateImports`. -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoPrivateImportsOptions { - /// The default visibility to assume for symbols without visibility tag. - /// - /// Default: **public**. - pub default_visibility: Visibility, -} - -#[derive(Clone, Copy, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase")] -pub enum Visibility { - #[default] - Public, - Package, - Private, -} - -impl Display for Visibility { - fn fmt(&self, fmt: &mut biome_console::fmt::Formatter) -> std::io::Result<()> { - match self { - Self::Public => fmt.write_str("public"), - Self::Package => fmt.write_str("package"), - Self::Private => fmt.write_str("private"), - } - } -} - -impl FromStr for Visibility { - type Err = (); - - fn from_str(s: &str) -> Result { - match s { - "public" => Ok(Self::Public), - "package" => Ok(Self::Package), - "private" => Ok(Self::Private), - _ => Err(()), - } - } -} - #[derive(Debug)] pub struct NoPrivateImportsState { range: TextRange, diff --git a/crates/biome_js_analyze/src/lint/correctness/no_render_return_value.rs b/crates/biome_js_analyze/src/lint/correctness/no_render_return_value.rs index 1ed22ffcd470..7638d5366809 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_render_return_value.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_render_return_value.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsCallExpression, JsExpressionStatement}; use biome_rowan::AstNode; +use biome_rule_options::no_render_return_value::NoRenderReturnValueOptions; declare_lint_rule! { /// Prevent the usage of the return value of `React.render`. @@ -44,7 +45,7 @@ impl Rule for NoRenderReturnValue { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoRenderReturnValueOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_self_assign.rs b/crates/biome_js_analyze/src/lint/correctness/no_self_assign.rs index c390d7ac11bc..41d05d8d5f42 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_self_assign.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_self_assign.rs @@ -14,6 +14,7 @@ use biome_rowan::{ AstNode, AstSeparatedList, AstSeparatedListNodesIterator, SyntaxError, SyntaxResult, TextRange, declare_node_union, }; +use biome_rule_options::no_self_assign::NoSelfAssignOptions; use std::collections::VecDeque; use std::iter::FusedIterator; @@ -81,7 +82,7 @@ impl Rule for NoSelfAssign { type Query = Ast; type State = IdentifiersLike; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoSelfAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_setter_return.rs b/crates/biome_js_analyze/src/lint/correctness/no_setter_return.rs index 4deaba43873b..ad6e819a07a6 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_setter_return.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_setter_return.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsReturnStatement, JsSetterClassMember, JsSetterObjectMember}; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_setter_return::NoSetterReturnOptions; use crate::services::control_flow::AnyJsControlFlowRoot; @@ -83,7 +84,7 @@ impl Rule for NoSetterReturn { type Query = Ast; type State = JsSetterMember; type Signals = Option; - type Options = (); + type Options = NoSetterReturnOptions; fn run(ctx: &RuleContext) -> Self::Signals { let ret = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_string_case_mismatch.rs b/crates/biome_js_analyze/src/lint/correctness/no_string_case_mismatch.rs index ddf01afc1b30..b5ac90e7bff3 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_string_case_mismatch.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_string_case_mismatch.rs @@ -7,6 +7,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::*; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_string_case_mismatch::NoStringCaseMismatchOptions; use biome_string_case::StrOnlyExtension; use crate::JsRuleAction; @@ -49,7 +50,7 @@ impl Rule for NoStringCaseMismatch { type Query = Ast; type State = CaseMismatchInfo; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoStringCaseMismatchOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_switch_declarations.rs b/crates/biome_js_analyze/src/lint/correctness/no_switch_declarations.rs index ddf22f1898d0..ccd7f0dd1d98 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_switch_declarations.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_switch_declarations.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ AnyJsDeclaration, AnyJsStatement, AnyJsSwitchClause, JsVariableStatement, T, TriviaPieceKind, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange}; +use biome_rule_options::no_switch_declarations::NoSwitchDeclarationsOptions; use crate::JsRuleAction; @@ -84,7 +85,7 @@ impl Rule for NoSwitchDeclarations { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoSwitchDeclarationsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let switch_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs b/crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs index 3f5cd28dd256..8d33030c8327 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs @@ -1,18 +1,15 @@ +use crate::services::manifest::Manifest; use biome_analyze::{ Rule, RuleDiagnostic, RuleDomain, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize::{ - Deserializable, DeserializableType, DeserializableValue, DeserializationContext, -}; -use biome_deserialize_macros::Deserializable; + use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsImportClause, AnyJsImportLike}; use biome_resolver::is_builtin_node_module; use biome_rowan::AstNode; -use camino::{Utf8Path, Utf8PathBuf}; - -use crate::services::manifest::Manifest; +use biome_rule_options::no_undeclared_dependencies::NoUndeclaredDependenciesOptions; +use camino::Utf8PathBuf; declare_lint_rule! { /// Disallow the use of dependencies that aren't specified in the `package.json`. @@ -92,111 +89,6 @@ declare_lint_rule! { } } -#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)] -#[serde(untagged)] -enum DependencyAvailability { - /// Dependencies are always available or unavailable. - Bool(bool), - - /// Dependencies are available in files that matches any of the globs. - Patterns(Box<[biome_glob::Glob]>), -} - -impl Default for DependencyAvailability { - fn default() -> Self { - Self::Bool(true) - } -} - -impl Deserializable for DependencyAvailability { - fn deserialize( - ctx: &mut impl DeserializationContext, - value: &impl DeserializableValue, - name: &str, - ) -> Option { - Some(if value.visitable_type()? == DeserializableType::Bool { - Self::Bool(bool::deserialize(ctx, value, name)?) - } else { - Self::Patterns(Deserializable::deserialize(ctx, value, name)?) - }) - } -} - -#[cfg(feature = "schemars")] -impl schemars::JsonSchema for DependencyAvailability { - fn schema_name() -> String { - "DependencyAvailability".to_owned() - } - - fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { - use schemars::schema::*; - - Schema::Object(SchemaObject { - subschemas: Some(Box::new(SubschemaValidation { - one_of: Some(vec![ - Schema::Object(SchemaObject { - instance_type: Some(InstanceType::Boolean.into()), - metadata: Some(Box::new(Metadata { - description: Some("This type of dependency will be always available or unavailable.".to_owned()), - ..Default::default() - })), - ..Default::default() - }), - Schema::Object(SchemaObject { - instance_type: Some(InstanceType::Array.into()), - array: Some(Box::new(ArrayValidation { - items: Some(SingleOrVec::Single(Box::new(Schema::Object(SchemaObject { - instance_type: Some(InstanceType::String.into()), - ..Default::default() - })))), - min_items: Some(1), - ..Default::default() - })), - metadata: Some(Box::new(Metadata { - description: Some("This type of dependency will be available only if the linted file matches any of the globs.".to_owned()), - ..Default::default() - })), - ..Default::default() - }) - ]), - ..Default::default() - })), - ..Default::default() - }) - } -} - -impl DependencyAvailability { - fn is_available(&self, path: &Utf8Path) -> bool { - match self { - Self::Bool(b) => *b, - Self::Patterns(globs) => { - biome_glob::CandidatePath::new(&path).matches_with_exceptions(globs) - } - } - } -} - -/// Rule's options -#[derive( - Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct NoUndeclaredDependenciesOptions { - /// If set to `false`, then the rule will show an error when `devDependencies` are imported. Defaults to `true`. - #[serde(default)] - dev_dependencies: DependencyAvailability, - - /// If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `true`. - #[serde(default)] - peer_dependencies: DependencyAvailability, - - /// If set to `false`, then the rule will show an error when `optionalDependencies` are imported. Defaults to `true`. - #[serde(default)] - optional_dependencies: DependencyAvailability, -} - pub struct RuleState { package_name: Box, is_dev_dependency_available: bool, diff --git a/crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs b/crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs index ab0f6c4e1377..f9a4813c1ea9 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs @@ -3,31 +3,18 @@ use crate::services::semantic::SemanticServices; use biome_analyze::context::RuleContext; use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsFunction, JsFileSource, Language, TextRange, TsAsExpression, TsReferenceType, }; use biome_rowan::AstNode; +use biome_rule_options::no_undeclared_variables::NoUndeclaredVariablesOptions; declare_lint_rule! { /// Prevents the usage of variables that haven't been declared inside the document. /// /// If you need to allow-list some global bindings, you can use the [`javascript.globals`](/reference/configuration/#javascriptglobals) configuration. /// - /// ## Options - /// - /// The rule provides a `checkTypes` option that make the rule checks undeclared types. - /// The option defaults to `false`. - /// - /// ```json - /// { - /// "options": { - /// "checkTypes": true - /// } - /// } - /// ``` - /// /// ## Examples /// /// ### Invalid @@ -45,6 +32,25 @@ declare_lint_rule! { /// ```ts /// type B = PromiseLike /// ``` + /// + /// ## Options + /// + /// ### `checkTypes` + /// + /// When set to `true`, it checks for undeclared types too. + /// The option defaults to `false`. + /// + /// ```json,options + /// { + /// "options": { + /// "checkTypes": true + /// } + /// } + /// ``` + /// + /// ```ts,use_options,expect_diagnostic + /// type A = number extends infer T ? never : T; + /// ``` pub NoUndeclaredVariables { version: "1.0.0", name: "noUndeclaredVariables", @@ -59,7 +65,7 @@ impl Rule for NoUndeclaredVariables { type Query = SemanticServices; type State = (TextRange, Box); type Signals = Box<[Self::State]>; - type Options = UndeclaredVariablesOptions; + type Options = NoUndeclaredVariablesOptions; fn run(ctx: &RuleContext) -> Self::Signals { ctx.query() @@ -128,16 +134,6 @@ impl Rule for NoUndeclaredVariables { } } -#[derive( - Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(default, rename_all = "camelCase")] -pub struct UndeclaredVariablesOptions { - /// Check undeclared types. - check_types: bool, -} - fn is_global(reference_name: &str, source_type: &JsFileSource) -> bool { match source_type.language() { Language::JavaScript => is_js_global(reference_name), diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unreachable.rs b/crates/biome_js_analyze/src/lint/correctness/no_unreachable.rs index b85a4be7c165..71fa5f016d4f 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unreachable.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unreachable.rs @@ -14,6 +14,7 @@ use biome_js_syntax::{ JsTryFinallyStatement, JsTryStatement, JsVariableStatement, JsWhileStatement, TextRange, }; use biome_rowan::{AstNode, NodeOrToken, declare_node_union}; +use biome_rule_options::no_unreachable::NoUnreachableOptions; use roaring::bitmap::RoaringBitmap; use rustc_hash::FxHashMap; @@ -61,7 +62,7 @@ impl Rule for NoUnreachable { type Query = ControlFlowGraph; type State = UnreachableRange; type Signals = UnreachableRanges; - type Options = (); + type Options = NoUnreachableOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut signals = UnreachableRanges::new(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unreachable_super.rs b/crates/biome_js_analyze/src/lint/correctness/no_unreachable_super.rs index 3aac13ec8dce..1cd06b39ef0b 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unreachable_super.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unreachable_super.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsThrowStatement, TextRange, WalkEvent, }; use biome_rowan::{AstNode, NodeOrToken}; +use biome_rule_options::no_unreachable_super::NoUnreachableSuperOptions; use rustc_hash::FxHashSet; use crate::services::control_flow::{AnyJsControlFlowRoot, ControlFlowGraph}; @@ -94,7 +95,7 @@ impl Rule for NoUnreachableSuper { type Query = ControlFlowGraph; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoUnreachableSuperOptions; fn run(ctx: &RuleContext) -> Self::Signals { let cfg = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unsafe_finally.rs b/crates/biome_js_analyze/src/lint/correctness/no_unsafe_finally.rs index 60346ab0fb7c..fd4843676a2c 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unsafe_finally.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unsafe_finally.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::*; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_unsafe_finally::NoUnsafeFinallyOptions; declare_lint_rule! { /// Disallow control flow statements in finally blocks. @@ -143,7 +144,7 @@ impl Rule for NoUnsafeFinally { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUnsafeFinallyOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unsafe_optional_chaining.rs b/crates/biome_js_analyze/src/lint/correctness/no_unsafe_optional_chaining.rs index 3fad62add24a..1c3be453aa69 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unsafe_optional_chaining.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unsafe_optional_chaining.rs @@ -13,6 +13,7 @@ use biome_js_syntax::{ JsTemplateExpression, JsVariableDeclarator, JsWithStatement, }; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_unsafe_optional_chaining::NoUnsafeOptionalChainingOptions; declare_lint_rule! { /// Disallow the use of optional chaining in contexts where the undefined value is not allowed. @@ -78,7 +79,7 @@ impl Rule for NoUnsafeOptionalChaining { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoUnsafeOptionalChainingOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unused_function_parameters.rs b/crates/biome_js_analyze/src/lint/correctness/no_unused_function_parameters.rs index a8d53acc624d..5c03e86abf84 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unused_function_parameters.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unused_function_parameters.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ binding_ext::{AnyJsBindingDeclaration, AnyJsParameterParentFunction}, }; use biome_rowan::{AstNode, BatchMutationExt, Direction}; +use biome_rule_options::no_unused_function_parameters::NoUnusedFunctionParametersOptions; use crate::{JsRuleAction, services::semantic::Semantic, utils::rename::RenameSymbolExtensions}; @@ -93,7 +94,7 @@ impl Rule for NoUnusedFunctionParameters { type Query = Semantic; type State = SuggestedFix; type Signals = Option; - type Options = (); + type Options = NoUnusedFunctionParametersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let binding = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs b/crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs index 0ac928bff9d8..b6decc355789 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs @@ -3,6 +3,7 @@ use crate::{ JsRuleAction, react::{ReactLibrary, is_global_react_import}, }; +use biome_rule_options::no_unused_imports::NoUnusedImportsOptions; use biome_analyze::{ AddVisitor, FixKind, FromServices, Phase, Phases, QueryKey, Queryable, Rule, RuleDiagnostic, @@ -257,7 +258,7 @@ impl Rule for NoUnusedImports { type Query = NoUnusedImportsQuery; type State = Unused; type Signals = Option; - type Options = (); + type Options = NoUnusedImportsOptions; fn run(ctx: &RuleContext) -> Self::Signals { match ctx.query() { diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unused_labels.rs b/crates/biome_js_analyze/src/lint/correctness/no_unused_labels.rs index 5e05d6d18208..188e2d9018fb 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unused_labels.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unused_labels.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ AnyJsStatement, JsBreakStatement, JsContinueStatement, JsFileSource, JsLabeledStatement, JsLanguage, TextRange, WalkEvent, }; +use biome_rule_options::no_unused_labels::NoUnusedLabelsOptions; use biome_rowan::{AstNode, BatchMutationExt, Language, SyntaxNode, SyntaxResult, TokenText}; use rustc_hash::FxHashSet; @@ -163,7 +164,7 @@ impl Rule for NoUnusedLabels { type Query = UnusedLabel; type State = (); type Signals = Option; - type Options = (); + type Options = NoUnusedLabelsOptions; fn run(ctx: &RuleContext) -> Option { let label = ctx.query().label_token().ok()?; diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unused_private_class_members.rs b/crates/biome_js_analyze/src/lint/correctness/no_unused_private_class_members.rs index 9555061657f1..51ecec0a85e0 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unused_private_class_members.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unused_private_class_members.rs @@ -12,6 +12,7 @@ use biome_rowan::{ AstNode, AstNodeList, AstSeparatedList, BatchMutationExt, SyntaxNodeOptionExt, TextRange, declare_node_union, }; +use biome_rule_options::no_unused_private_class_members::NoUnusedPrivateClassMembersOptions; use rustc_hash::FxHashSet; use crate::{JsRuleAction, utils::is_node_equal}; @@ -79,7 +80,7 @@ impl Rule for NoUnusedPrivateClassMembers { type Query = Ast; type State = AnyMember; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoUnusedPrivateClassMembersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs b/crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs index aa6e4f1f61de..7a17cfaf95f7 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs @@ -13,29 +13,7 @@ use biome_js_syntax::{ TsConditionalType, TsDeclarationModule, TsInferType, }; use biome_rowan::{AstNode, BatchMutationExt, Direction, SyntaxResult}; -use serde::{Deserialize, Serialize}; - -#[derive( - Clone, - Debug, - Deserialize, - biome_deserialize_macros::Deserializable, - Eq, - PartialEq, - Serialize, - Default, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct NoUnusedVariablesOptions { - /// Whether to ignore unused variables from an object destructuring with a spread. - #[serde(default = "ignore_rest_siblings")] - ignore_rest_siblings: bool, -} - -const fn ignore_rest_siblings() -> bool { - true -} +use biome_rule_options::no_unused_variables::NoUnusedVariablesOptions; declare_lint_rule! { /// Disallow unused variables. diff --git a/crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs b/crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs index 79488ff35681..c1a515b7c35e 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsxSelfClosingElement, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_void_elements_with_children::NoVoidElementsWithChildrenOptions; declare_lint_rule! { /// This rules prevents void elements (AKA self-closing elements) from having children. @@ -183,7 +184,7 @@ impl Rule for NoVoidElementsWithChildren { type Query = Semantic; type State = NoVoidElementsWithChildrenState; type Signals = Option; - type Options = (); + type Options = NoVoidElementsWithChildrenOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/no_void_type_return.rs b/crates/biome_js_analyze/src/lint/correctness/no_void_type_return.rs index b0b5add03e88..58769371e4e3 100644 --- a/crates/biome_js_analyze/src/lint/correctness/no_void_type_return.rs +++ b/crates/biome_js_analyze/src/lint/correctness/no_void_type_return.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsSyntaxKind, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_void_type_return::NoVoidTypeReturnOptions; use crate::services::control_flow::AnyJsControlFlowRoot; @@ -99,7 +100,7 @@ impl Rule for NoVoidTypeReturn { type Query = Ast; type State = AnyJsFunctionMethodWithReturnType; type Signals = Option; - type Options = (); + type Options = NoVoidTypeReturnOptions; fn run(ctx: &RuleContext) -> Self::Signals { let ret = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs b/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs index ebdbfb9d0d0d..6cef0719933b 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs @@ -3,10 +3,6 @@ use std::collections::BTreeMap; use biome_analyze::{FixKind, RuleSource}; use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, context::RuleContext, declare_lint_rule}; use biome_console::markup; -use biome_deserialize::{ - DeserializableValidator, DeserializationContext, DeserializationDiagnostic, non_empty, -}; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_semantic::{Capture, SemanticModel}; @@ -19,14 +15,14 @@ use biome_js_syntax::{ }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxNodeCast, TriviaPieceKind}; use rustc_hash::{FxHashMap, FxHashSet}; -use serde::{Deserialize, Serialize}; use crate::JsRuleAction; use crate::react::hooks::*; use crate::services::semantic::Semantic; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::use_exhaustive_dependencies::{ + StableHookResult, UseExhaustiveDependenciesOptions, +}; declare_lint_rule! { /// Enforce all dependencies are correctly specified in a React hook. @@ -299,97 +295,6 @@ impl Default for HookConfigMaps { } } -/// Options for the rule `useExhaustiveDependencies` -#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseExhaustiveDependenciesOptions { - /// Whether to report an error when a dependency is listed in the dependencies array but isn't used. Defaults to true. - #[serde(default = "report_unnecessary_dependencies_default")] - pub report_unnecessary_dependencies: bool, - - /// Whether to report an error when a hook has no dependencies array. - #[serde(default)] - pub report_missing_dependencies_array: bool, - - /// List of hooks of which the dependencies should be validated. - #[serde(default)] - #[deserializable(validate = "non_empty")] - pub hooks: Box<[Hook]>, -} - -impl Default for UseExhaustiveDependenciesOptions { - fn default() -> Self { - Self { - report_unnecessary_dependencies: report_unnecessary_dependencies_default(), - report_missing_dependencies_array: false, - hooks: Vec::new().into_boxed_slice(), - } - } -} - -fn report_unnecessary_dependencies_default() -> bool { - true -} - -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -#[deserializable(with_validator)] -pub struct Hook { - /// The name of the hook. - #[deserializable(validate = "non_empty")] - pub name: Box, - - /// The "position" of the closure function, starting from zero. - /// - /// For example, for React's `useEffect()` hook, the closure index is 0. - pub closure_index: Option, - - /// The "position" of the array of dependencies, starting from zero. - /// - /// For example, for React's `useEffect()` hook, the dependencies index is 1. - pub dependencies_index: Option, - - /// Whether the result of the hook is stable. - /// - /// Set to `true` to mark the identity of the hook's return value as stable, - /// or use a number/an array of numbers to mark the "positions" in the - /// return array as stable. - /// - /// For example, for React's `useRef()` hook the value would be `true`, - /// while for `useState()` it would be `[1]`. - pub stable_result: Option, -} - -impl DeserializableValidator for Hook { - fn validate( - &mut self, - ctx: &mut impl DeserializationContext, - _name: &str, - range: TextRange, - ) -> bool { - match (self.closure_index, self.dependencies_index) { - (Some(closure_index), Some(dependencies_index)) - if closure_index == dependencies_index => - { - ctx.report( - DeserializationDiagnostic::new(markup! { - "closureIndex"" and ""dependenciesIndex"" may not be the same" - }) - .with_range(range), - ); - - self.closure_index = None; - self.dependencies_index = None; - } - _ => {} - } - - true - } -} - impl HookConfigMaps { pub fn new(hooks: &UseExhaustiveDependenciesOptions) -> Self { let mut result = Self::default(); @@ -748,7 +653,7 @@ impl Rule for UseExhaustiveDependencies { type Query = Semantic; type State = Fix; type Signals = Box<[Self::State]>; - type Options = Box; + type Options = UseExhaustiveDependenciesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let options = ctx.options(); diff --git a/crates/biome_js_analyze/src/lint/correctness/use_hook_at_top_level.rs b/crates/biome_js_analyze/src/lint/correctness/use_hook_at_top_level.rs index b654e3b947d0..24b24bc64682 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_hook_at_top_level.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_hook_at_top_level.rs @@ -7,10 +7,6 @@ use biome_analyze::{ }; use biome_analyze::{RuleDomain, RuleSource}; use biome_console::markup; -use biome_deserialize::{ - Deserializable, DeserializableTypes, DeserializableValue, DeserializationContext, - DeserializationDiagnostic, DeserializationVisitor, Text, -}; use biome_js_semantic::{CallsExtensions, SemanticModel}; use biome_js_syntax::{ AnyFunctionLike, AnyJsBinding, AnyJsClassMemberName, AnyJsExpression, AnyJsFunction, @@ -20,15 +16,13 @@ use biome_js_syntax::{ JsObjectBindingPatternShorthandProperty, JsReturnStatement, JsSetterClassMember, JsSetterObjectMember, JsSyntaxKind, JsSyntaxNode, JsTryFinallyStatement, TextRange, }; -use biome_rowan::{AstNode, Language, SyntaxNode, WalkEvent, declare_node_union}; +use biome_rowan::{AstNode, Language, SyntaxNode, Text, WalkEvent, declare_node_union}; use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; use std::ops::{Deref, DerefMut}; use crate::react::components::ReactComponentInfo; use biome_diagnostics::Severity; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::use_hook_at_top_level::UseHookAtTopLevelOptions; declare_lint_rule! { /// Enforce that all React hooks are being called from the Top Level component functions. @@ -431,7 +425,7 @@ impl Rule for UseHookAtTopLevel { type Query = FunctionCall; type State = Suggestion; type Signals = Option; - type Options = DeprecatedHooksOptions; + type Options = UseHookAtTopLevelOptions; fn run(ctx: &RuleContext) -> Self::Signals { let FunctionCall(call) = ctx.query(); @@ -574,63 +568,3 @@ impl Rule for UseHookAtTopLevel { } } } - -/// 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. -#[derive(Default, Deserialize, Serialize, Eq, PartialEq, Debug, Clone)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct DeprecatedHooksOptions {} - -impl Deserializable for DeprecatedHooksOptions { - fn deserialize( - ctx: &mut impl DeserializationContext, - value: &impl DeserializableValue, - name: &str, - ) -> Option { - value.deserialize(ctx, DeprecatedHooksOptionsVisitor, name) - } -} - -// TODO: remove in Biome 2.0 -struct DeprecatedHooksOptionsVisitor; -impl DeserializationVisitor for DeprecatedHooksOptionsVisitor { - type Output = DeprecatedHooksOptions; - - const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::MAP; - - fn visit_map( - self, - ctx: &mut impl DeserializationContext, - members: impl Iterator>, - _range: TextRange, - _name: &str, - ) -> Option { - const ALLOWED_KEYS: &[&str] = &["hooks"]; - for (key, value) in members.flatten() { - let Some(key_text) = Text::deserialize(ctx, &key, "") else { - continue; - }; - match key_text.text() { - "hooks" => { - ctx.report( - DeserializationDiagnostic::new_deprecated( - key_text.text(), - value.range() - ).with_note( - markup! { - "useHookAtTopLevel"" now uses the React hook naming convention to determine hook calls." - }) - ); - } - text => ctx.report(DeserializationDiagnostic::new_unknown_key( - text, - key.range(), - ALLOWED_KEYS, - )), - } - } - Some(Self::Output::default()) - } -} diff --git a/crates/biome_js_analyze/src/lint/correctness/use_import_extensions.rs b/crates/biome_js_analyze/src/lint/correctness/use_import_extensions.rs index 01f1d3d0563b..7208850c41c0 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_import_extensions.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_import_extensions.rs @@ -3,6 +3,7 @@ use biome_module_graph::ResolvedPath; use camino::{Utf8Component, Utf8Path}; use serde::{Deserialize, Serialize}; +use crate::{JsRuleAction, services::module_graph::ResolvedImports}; use biome_analyze::{ FixKind, Rule, RuleDiagnostic, RuleDomain, context::RuleContext, declare_lint_rule, }; @@ -11,11 +12,7 @@ use biome_deserialize_macros::Deserializable; use biome_js_factory::make; use biome_js_syntax::{AnyJsImportLike, JsSyntaxToken, inner_string_text}; use biome_rowan::BatchMutationExt; - -use crate::{JsRuleAction, services::module_graph::ResolvedImports}; - -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::use_import_extensions::UseImportExtensionsOptions; declare_lint_rule! { /// Enforce file extensions for relative imports. @@ -125,15 +122,6 @@ declare_lint_rule! { } } -#[derive(Clone, Debug, Default, Deserializable, Deserialize, Serialize, Eq, PartialEq)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseImportExtensionsOptions { - /// If `true`, the suggested extension is always `.js` regardless of what - /// extension the source file has in your project. - pub force_js_extensions: bool, -} - #[derive(Debug, Clone, Default, Deserializable, Deserialize, Serialize, Eq, PartialEq)] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields, default)] @@ -148,7 +136,7 @@ impl Rule for UseImportExtensions { type Query = ResolvedImports; type State = UseImportExtensionsState; type Signals = Option; - type Options = Box; + type Options = UseImportExtensionsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let module_info = ctx.module_info_for_path(ctx.file_path())?; diff --git a/crates/biome_js_analyze/src/lint/correctness/use_is_nan.rs b/crates/biome_js_analyze/src/lint/correctness/use_is_nan.rs index 4aa08ba2d707..c4ce7a2552e1 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_is_nan.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_is_nan.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsBinaryOperator, JsCaseClause, JsSwitchStatement, T, TextRange, global_identifier, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::use_is_nan::UseIsNanOptions; use crate::{JsRuleAction, services::semantic::Semantic}; @@ -101,7 +102,7 @@ impl Rule for UseIsNan { type Query = Semantic; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseIsNanOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs b/crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs index b55da94ce9a6..59375b521896 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs @@ -3,7 +3,6 @@ use crate::services::semantic::Semantic; use biome_analyze::RuleSource; use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, context::RuleContext, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_semantic::SemanticModel; use biome_js_syntax::{ @@ -13,7 +12,7 @@ use biome_js_syntax::{ JsxTagExpression, }; use biome_rowan::{AstNode, AstNodeList, AstSeparatedList, TextRange, declare_node_union}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::use_jsx_key_in_iterable::UseJsxKeyInIterableOptions; declare_lint_rule! { /// Disallow missing key props in iterators/collection literals. @@ -76,14 +75,6 @@ declare_node_union! { pub ReactComponentExpression = JsxTagExpression | JsCallExpression } -#[derive(Debug, Default, Clone, Serialize, Deserialize, Deserializable, Eq, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseJsxKeyInIterableOptions { - /// Set to `true` to check shorthand fragments (`<>`) - check_shorthand_fragments: bool, -} - impl Rule for UseJsxKeyInIterable { type Query = Semantic; type State = TextRange; diff --git a/crates/biome_js_analyze/src/lint/correctness/use_valid_for_direction.rs b/crates/biome_js_analyze/src/lint/correctness/use_valid_for_direction.rs index 34665b06e7c7..ebde1b28d433 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_valid_for_direction.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_valid_for_direction.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ AnyJsExpression, JsAssignmentOperator, JsBinaryOperator, JsForStatement, JsIdentifierAssignment, JsIdentifierExpression, JsPostUpdateOperator, JsUnaryOperator, }; +use biome_rule_options::use_valid_for_direction::UseValidForDirectionOptions; declare_lint_rule! { /// Enforce "for" loop update clause moving the counter in the right direction. @@ -55,7 +56,7 @@ impl Rule for UseValidForDirection { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseValidForDirectionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/use_valid_typeof.rs b/crates/biome_js_analyze/src/lint/correctness/use_valid_typeof.rs index 9283a15b6f9d..7485994b9387 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_valid_typeof.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_valid_typeof.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsLogicalOperator, JsUnaryOperator, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_valid_typeof::UseValidTypeofOptions; use biome_string_case::StrLikeExtension; use crate::JsRuleAction; @@ -74,7 +75,7 @@ impl Rule for UseValidTypeof { type Query = Ast; type State = AnyJsExpression; type Signals = Option; - type Options = (); + type Options = UseValidTypeofOptions; fn run(ctx: &RuleContext) -> Option { let n = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/correctness/use_yield.rs b/crates/biome_js_analyze/src/lint/correctness/use_yield.rs index 508ab0c53600..6323262bdf28 100644 --- a/crates/biome_js_analyze/src/lint/correctness/use_yield.rs +++ b/crates/biome_js_analyze/src/lint/correctness/use_yield.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyFunctionLike, JsLanguage, JsYieldExpression, TextRange, WalkEvent}; use biome_rowan::{AstNode, AstNodeList, Language, SyntaxNode, TextSize}; +use biome_rule_options::use_yield::UseYieldOptions; declare_lint_rule! { /// Require generator functions to contain `yield`. @@ -127,7 +128,7 @@ impl Rule for UseYield { type Query = MissingYield; type State = (); type Signals = Option; - type Options = (); + type Options = UseYieldOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_await_in_loop.rs b/crates/biome_js_analyze/src/lint/nursery/no_await_in_loop.rs index 92548bb9be70..63b3236f4fd2 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_await_in_loop.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_await_in_loop.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsWithStatement, }; use biome_rowan::{AstNode, WalkEvent, declare_node_union}; +use biome_rule_options::no_await_in_loop::NoAwaitInLoopOptions; declare_lint_rule! { /// Disallow `await` inside loops. @@ -51,7 +52,7 @@ impl Rule for NoAwaitInLoop { type Query = Ast; type State = JsSyntaxNode; type Signals = Option; - type Options = (); + type Options = NoAwaitInLoopOptions; fn run(ctx: &RuleContext) -> Self::Signals { let loop_node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_bitwise_operators.rs b/crates/biome_js_analyze/src/lint/nursery/no_bitwise_operators.rs index e929bc13882e..85d6989f18e0 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_bitwise_operators.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_bitwise_operators.rs @@ -2,15 +2,12 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_js_syntax::{ JsAssignmentExpression, JsAssignmentOperator, JsBinaryExpression, JsBinaryOperator, JsSyntaxToken, JsUnaryExpression, JsUnaryOperator, }; use biome_rowan::{AstNode, declare_node_union}; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use biome_rule_options::no_bitwise_operators::NoBitwiseOperatorsOptions; declare_lint_rule! { /// Disallow bitwise operators. @@ -163,13 +160,3 @@ impl Rule for NoBitwiseOperators { ) } } - -/// Rule's options -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoBitwiseOperatorsOptions { - /// Allows a list of bitwise operators to be used as exceptions. - #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub allow: Box<[Box]>, -} diff --git a/crates/biome_js_analyze/src/lint/nursery/no_constant_binary_expression.rs b/crates/biome_js_analyze/src/lint/nursery/no_constant_binary_expression.rs index 88055414555b..6c7eda95fe04 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_constant_binary_expression.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_constant_binary_expression.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsReferenceIdentifier, JsUnaryOperator, }; use biome_rowan::{AstNode, AstNodeList, AstSeparatedList, SyntaxResult, declare_node_union}; +use biome_rule_options::no_constant_binary_expression::NoConstantBinaryExpressionOptions; use crate::ast_utils::is_constant_condition; use crate::globals::is_js_language_global; @@ -153,7 +154,7 @@ impl Rule for NoConstantBinaryExpression { type Query = Semantic; type State = Issue; type Signals = Option; - type Options = (); + type Options = NoConstantBinaryExpressionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_destructured_props.rs b/crates/biome_js_analyze/src/lint/nursery/no_destructured_props.rs index de25c13065d3..523f5ef630ac 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_destructured_props.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_destructured_props.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsParameters, JsVariableDeclarator, JsxExpressionAttributeValue, }; use biome_rowan::{AstNode, AstSeparatedList, AstSeparatedListNodesIterator, TextRange}; +use biome_rule_options::no_destructured_props::NoDestructuredPropsOptions; use biome_string_case::Case; use std::collections::VecDeque; use std::iter::FusedIterator; @@ -80,7 +81,7 @@ impl Rule for NoDestructuredProps { type Query = Semantic; type State = Violation; type Signals = Vec; - type Options = (); + type Options = NoDestructuredPropsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let binding_pattern = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_function.rs b/crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_function.rs index ad72dad78c52..bc877acd9479 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_function.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_function.rs @@ -1,15 +1,11 @@ use crate::services::semantic::Semantic; -use ::serde::{Deserialize, Serialize}; use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_js_syntax::{ AnyFunctionLike, AnyJsFunction, JsCallExpression, JsParenthesizedExpression, }; use biome_rowan::AstNode; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use std::num::NonZeroU8; +use biome_rule_options::no_excessive_lines_per_function::NoExcessiveLinesPerFunctionOptions; declare_lint_rule! { /// Restrict the number of lines of code in a function. @@ -215,25 +211,3 @@ fn is_iife(func: &AnyJsFunction) -> bool { pub struct State { function_lines_count: usize, } - -#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoExcessiveLinesPerFunctionOptions { - /// The maximum number of lines allowed in a function body. - pub max_lines: NonZeroU8, - /// When this options is set to `true`, blank lines in the function body are not counted towards the maximum line limit. - pub skip_blank_lines: bool, - /// When this option is set to `true`, Immediately Invoked Function Expressions (IIFEs) are not checked for the maximum line limit. - pub skip_iifes: bool, -} - -impl Default for NoExcessiveLinesPerFunctionOptions { - fn default() -> Self { - Self { - max_lines: NonZeroU8::new(50).unwrap(), - skip_blank_lines: false, - skip_iifes: false, - } - } -} diff --git a/crates/biome_js_analyze/src/lint/nursery/no_floating_promises.rs b/crates/biome_js_analyze/src/lint/nursery/no_floating_promises.rs index 903cef2b2260..306d979c6dd1 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_floating_promises.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_floating_promises.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsMethodClassMember, JsMethodObjectMember, JsSyntaxKind, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxNodeCast, TriviaPieceKind}; +use biome_rule_options::no_floating_promises::NoFloatingPromisesOptions; use crate::{JsRuleAction, services::typed::Typed}; @@ -168,7 +169,7 @@ impl Rule for NoFloatingPromises { type Query = Typed; type State = (); type Signals = Option; - type Options = (); + type Options = NoFloatingPromisesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_global_dirname_filename.rs b/crates/biome_js_analyze/src/lint/nursery/no_global_dirname_filename.rs index ec5498dd51dd..c9d147dca36d 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_global_dirname_filename.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_global_dirname_filename.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsVariableDeclarator, global_identifier, }; use biome_rowan::{AstSeparatedList, BatchMutationExt, TriviaPieceKind, declare_node_union}; +use biome_rule_options::no_global_dirname_filename::NoGlobalDirnameFilenameOptions; declare_lint_rule! { /// Disallow the use of `__dirname` and `__filename` in the global scope. @@ -68,7 +69,7 @@ impl Rule for NoGlobalDirnameFilename { type Query = Semantic; type State = (JsSyntaxToken, String); type Signals = Option; - type Options = (); + type Options = NoGlobalDirnameFilenameOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_implicit_coercion.rs b/crates/biome_js_analyze/src/lint/nursery/no_implicit_coercion.rs index 730340315bec..6a943eb0b23d 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_implicit_coercion.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_implicit_coercion.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsBinaryOperator, JsLanguage, JsUnaryExpression, JsUnaryOperator, T, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPieceKind, declare_node_union}; +use biome_rule_options::no_implicit_coercion::NoImplicitCoercionOptions; declare_lint_rule! { /// Disallow shorthand type conversions. @@ -118,7 +119,7 @@ impl Rule for NoImplicitCoercion { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoImplicitCoercionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs b/crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs index dfddc42fa365..50dec47636fe 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs @@ -8,6 +8,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::AnyJsImportLike; use biome_module_graph::{JsModuleInfo, ResolvedPath}; use biome_rowan::AstNode; +use biome_rule_options::no_import_cycles::NoImportCyclesOptions; use camino::{Utf8Path, Utf8PathBuf}; use crate::services::module_graph::ResolvedImports; @@ -95,7 +96,7 @@ impl Rule for NoImportCycles { type Query = ResolvedImports; type State = Box<[Box]>; type Signals = Option; - type Options = (); + type Options = NoImportCyclesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let module_info = ctx.module_info_for_path(ctx.file_path())?; diff --git a/crates/biome_js_analyze/src/lint/nursery/no_magic_numbers.rs b/crates/biome_js_analyze/src/lint/nursery/no_magic_numbers.rs index 1a9bf58d52e4..0e8b8fdedb6a 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_magic_numbers.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_magic_numbers.rs @@ -13,6 +13,7 @@ use biome_js_syntax::{ TsUnionTypeVariantList, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_magic_numbers::NoMagicNumbersOptions; declare_lint_rule! { /// Reports usage of "magic numbers" — numbers used directly instead of being assigned to named constants. @@ -57,7 +58,7 @@ impl Rule for NoMagicNumbers { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoMagicNumbersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let literal_expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_nested_component_definitions.rs b/crates/biome_js_analyze/src/lint/nursery/no_nested_component_definitions.rs index 349789ee0a1b..1c77ce8c2ce1 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_nested_component_definitions.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_nested_component_definitions.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_deserialize::TextRange; use biome_diagnostics::Severity; use biome_rowan::AstNode; +use biome_rule_options::no_nested_component_definitions::NoNestedComponentDefinitionsOptions; declare_lint_rule! { /// Disallows defining React components inside other components. @@ -99,7 +100,7 @@ impl Rule for NoNestedComponentDefinitions { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoNestedComponentDefinitionsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_noninteractive_element_interactions.rs b/crates/biome_js_analyze/src/lint/nursery/no_noninteractive_element_interactions.rs index 45053dee55cd..19304bec0858 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_noninteractive_element_interactions.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_noninteractive_element_interactions.rs @@ -6,6 +6,7 @@ use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, decl use biome_console::markup; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; +use biome_rule_options::no_noninteractive_element_interactions::NoNoninteractiveElementInteractionsOptions; declare_lint_rule! { /// Disallow use event handlers on non-interactive elements. @@ -83,7 +84,7 @@ impl Rule for NoNoninteractiveElementInteractions { type Query = Aria; type State = (); type Signals = Option; - type Options = (); + type Options = NoNoninteractiveElementInteractionsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_process_global.rs b/crates/biome_js_analyze/src/lint/nursery/no_process_global.rs index dbf50b6f0a4e..897029936ae1 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_process_global.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_process_global.rs @@ -16,6 +16,7 @@ use biome_rowan::BatchMutationExt; use biome_rowan::SyntaxElement; use biome_rowan::SyntaxNode; use biome_rowan::TriviaPieceKind; +use biome_rule_options::no_process_global::NoProcessGlobalOptions; use smallvec::SmallVec; use smallvec::smallvec; @@ -63,7 +64,7 @@ impl Rule for NoProcessGlobal { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoProcessGlobalOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_react_prop_assign.rs b/crates/biome_js_analyze/src/lint/nursery/no_react_prop_assign.rs index 40cdd7fdaa78..5378bd9049de 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_react_prop_assign.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_react_prop_assign.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_js_semantic::SemanticModel; use biome_js_syntax::{AnyJsExpression, AnyJsStatement, JsParameterList}; use biome_rowan::{AstNode, AstSeparatedList}; +use biome_rule_options::no_react_prop_assign::NoReactPropAssignOptions; declare_lint_rule! { /// Disallow assigning to React component props. @@ -49,7 +50,7 @@ impl Rule for NoReactPropAssign { type Query = Semantic; type State = AnyJsExpression; type Signals = Option; - type Options = (); + type Options = NoReactPropAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_restricted_elements.rs b/crates/biome_js_analyze/src/lint/nursery/no_restricted_elements.rs index e5f79f1fdf88..d748a2534553 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_restricted_elements.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_restricted_elements.rs @@ -3,12 +3,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::AstNode; -use rustc_hash::FxHashMap; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use std::fmt::Debug; -use std::ops::Deref; +use biome_rule_options::no_restricted_elements::NoRestrictedElementsOptions; declare_lint_rule! { /// Disallow the use of configured elements. @@ -102,59 +97,3 @@ impl Rule for NoRestrictedElements { )) } } - -type CustomRestrictedElementsBaseType = FxHashMap, Box>; - -#[derive( - Clone, - Debug, - Default, - biome_deserialize_macros::Deserializable, - Eq, - PartialEq, - Deserialize, - Serialize, -)] -struct CustomRestrictedElements(CustomRestrictedElementsBaseType); - -impl Deref for CustomRestrictedElements { - type Target = CustomRestrictedElementsBaseType; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[cfg(feature = "schemars")] -impl JsonSchema for CustomRestrictedElements { - fn schema_name() -> String { - "CustomRestrictedElements".to_owned() - } - - fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { - let mut schema = generator - .subschema_for::() - .into_object(); - schema.object().min_properties = Some(1); - schemars::schema::Schema::Object(schema) - } -} - -#[derive( - Clone, - Debug, - Default, - biome_deserialize_macros::Deserializable, - Deserialize, - Serialize, - Eq, - PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoRestrictedElementsOptions { - /// Elements to restrict. - /// Each key is the element name, and the value is the message to show when the element is used. - #[serde(skip_serializing_if = "FxHashMap::is_empty")] - elements: CustomRestrictedElements, -} diff --git a/crates/biome_js_analyze/src/lint/nursery/no_shadow.rs b/crates/biome_js_analyze/src/lint/nursery/no_shadow.rs index 1b84cbc2eace..f009abc64073 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_shadow.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_shadow.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ TsTypeParameterName, }; use biome_rowan::{AstNode, SyntaxNodeCast, TokenText, declare_node_union}; +use biome_rule_options::no_shadow::NoShadowOptions; use crate::services::semantic::SemanticServices; @@ -81,7 +82,7 @@ impl Rule for NoShadow { type Query = SemanticServices; type State = ShadowedBinding; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoShadowOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut shadowed_bindings = Vec::new(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_ts_ignore.rs b/crates/biome_js_analyze/src/lint/nursery/no_ts_ignore.rs index 1735761b07e0..cb9e4cb0498b 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_ts_ignore.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_ts_ignore.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsModule, JsSyntaxToken, TextLen}; use biome_rowan::{AstNode, BatchMutationExt, Direction, TextRange, TextSize, TriviaPiece}; +use biome_rule_options::no_ts_ignore::NoTsIgnoreOptions; declare_lint_rule! { /// Prevents the use of the TypeScript directive `@ts-ignore`. @@ -51,7 +52,7 @@ impl Rule for NoTsIgnore { type Query = Ast; type State = RuleState; type Signals = Vec; - type Options = (); + type Options = NoTsIgnoreOptions; fn run(ctx: &RuleContext) -> Self::Signals { let module = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_unassigned_variables.rs b/crates/biome_js_analyze/src/lint/nursery/no_unassigned_variables.rs index a178c63d65e3..4b707f7c1b6f 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_unassigned_variables.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_unassigned_variables.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ TsDeclareStatement, }; use biome_rowan::AstNode; +use biome_rule_options::no_unassigned_variables::NoUnassignedVariablesOptions; use crate::services::semantic::Semantic; @@ -70,7 +71,7 @@ impl Rule for NoUnassignedVariables { type Query = Semantic; type State = JsIdentifierBinding; type Signals = Option; - type Options = (); + type Options = NoUnassignedVariablesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let declarator = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs b/crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs index 2f1b7e02eac4..ed969e45a56b 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ use biome_module_graph::{JsModuleInfo, ModuleGraph, SUPPORTED_EXTENSIONS}; use biome_resolver::ResolveError; use biome_rowan::{AstNode, SyntaxResult, Text, TextRange, TokenText}; +use biome_rule_options::no_unresolved_imports::NoUnresolvedImportsOptions; use camino::{Utf8Path, Utf8PathBuf}; use crate::services::module_graph::ResolvedImports; @@ -90,7 +91,7 @@ impl Rule for NoUnresolvedImports { type Query = ResolvedImports; type State = NoUnresolvedImportsState; type Signals = Vec; - type Options = (); + type Options = NoUnresolvedImportsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let Some(module_info) = ctx.module_info_for_path(ctx.file_path()) else { diff --git a/crates/biome_js_analyze/src/lint/nursery/no_unwanted_polyfillio.rs b/crates/biome_js_analyze/src/lint/nursery/no_unwanted_polyfillio.rs index 6b3b386d5174..12828e3878b6 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_unwanted_polyfillio.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_unwanted_polyfillio.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_unwanted_polyfillio::NoUnwantedPolyfillioOptions; use regex::Regex; use crate::{ @@ -67,7 +68,7 @@ impl Rule for NoUnwantedPolyfillio { type Query = Semantic; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoUnwantedPolyfillioOptions; fn run(ctx: &RuleContext) -> Self::Signals { let jsx_element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_useless_backref_in_regex.rs b/crates/biome_js_analyze/src/lint/nursery/no_useless_backref_in_regex.rs index e3e902905865..d5e2964f89bd 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_useless_backref_in_regex.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_useless_backref_in_regex.rs @@ -6,6 +6,7 @@ use biome_analyze::{ use biome_diagnostics::Severity; use biome_js_syntax::JsRegexLiteralExpression; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_useless_backref_in_regex::NoUselessBackrefInRegexOptions; declare_lint_rule! { /// Disallow useless backreferences in regular expression literals that always match an empty string. @@ -97,7 +98,7 @@ impl Rule for NoUselessBackrefInRegex { type Query = Ast; type State = BackRefIssue; type Signals = Option; - type Options = (); + type Options = NoUselessBackrefInRegexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_useless_escape_in_string.rs b/crates/biome_js_analyze/src/lint/nursery/no_useless_escape_in_string.rs index e4e65e2b94a0..e4ed8451c649 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_useless_escape_in_string.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_useless_escape_in_string.rs @@ -6,6 +6,7 @@ use biome_js_syntax::{ JsSyntaxToken, JsTemplateExpression, }; use biome_rowan::{BatchMutationExt, TextRange, declare_node_union}; +use biome_rule_options::no_useless_escape_in_string::NoUselessEscapeInStringOptions; use crate::JsRuleAction; @@ -65,7 +66,7 @@ impl Rule for NoUselessEscapeInString { type Query = Ast; type State = (JsSyntaxToken, usize); type Signals = Option; - type Options = (); + type Options = NoUselessEscapeInStringOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/no_useless_undefined.rs b/crates/biome_js_analyze/src/lint/nursery/no_useless_undefined.rs index c14d0ede6135..57cc8dc1cdff 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_useless_undefined.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_useless_undefined.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsVariableStatement, JsYieldArgument, T, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TokenText, declare_node_union}; +use biome_rule_options::no_useless_undefined::NoUselessUndefinedOptions; use crate::JsRuleAction; @@ -107,7 +108,7 @@ impl Rule for NoUselessUndefined { type Query = Ast; type State = RuleState; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoUselessUndefinedOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_adjacent_getter_setter.rs b/crates/biome_js_analyze/src/lint/nursery/use_adjacent_getter_setter.rs index ed031fd155dd..60984e390501 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_adjacent_getter_setter.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_adjacent_getter_setter.rs @@ -12,6 +12,7 @@ use biome_js_syntax::{ TsSetterSignatureTypeMember, TsTypeMemberList, }; use biome_rowan::{AstNode, AstNodeList, AstSeparatedList, SyntaxResult, declare_node_union}; +use biome_rule_options::use_adjacent_getter_setter::UseAdjacentGetterSetterOptions; declare_lint_rule! { /// Enforce that getters and setters for the same property are adjacent in class and object definitions. @@ -70,7 +71,7 @@ impl Rule for UseAdjacentGetterSetter { type Query = Ast; type State = MatchingPropertyAccessors; type Signals = Option; - type Options = (); + type Options = UseAdjacentGetterSetterOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_consistent_object_definition.rs b/crates/biome_js_analyze/src/lint/nursery/use_consistent_object_definition.rs index 2e572a5f5d51..fc3aa34a55fa 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_consistent_object_definition.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_consistent_object_definition.rs @@ -1,19 +1,18 @@ -use serde::{Deserialize, Serialize}; - +use crate::JsRuleAction; use biome_analyze::{ Ast, FixKind, Rule, RuleAction, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{ AnyJsExpression, AnyJsObjectMember, AnyJsObjectMemberName, JsLanguage, T, inner_string_text, }; use biome_rowan::{AstNode, BatchMutationExt, TriviaPieceKind}; - -use crate::JsRuleAction; +use biome_rule_options::use_consistent_object_definition::{ + ObjectPropertySyntax, UseConsistentObjectDefinitionOptions, +}; declare_lint_rule! { /// Require the consistent declaration of object literals. Defaults to explicit definitions. @@ -121,25 +120,6 @@ declare_lint_rule! { } } -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseConsistentObjectDefinitionOptions { - /// The preferred syntax to enforce. - syntax: ObjectPropertySyntax, -} - -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum ObjectPropertySyntax { - /// `{foo: foo}` - Explicit, - /// `{foo}` - #[default] - Shorthand, -} - impl Rule for UseConsistentObjectDefinition { type Query = Ast; type State = (); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_consistent_response.rs b/crates/biome_js_analyze/src/lint/nursery/use_consistent_response.rs index b466baa86c2a..cd141c8fd570 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_consistent_response.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_consistent_response.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ JsNewExpression, JsPropertyObjectMember, T, global_identifier, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, TokenText, TriviaPieceKind}; +use biome_rule_options::use_consistent_response::UseConsistentResponseOptions; use biome_string_case::StrLikeExtension; use crate::{JsRuleAction, services::semantic::Semantic}; @@ -86,7 +87,7 @@ impl Rule for UseConsistentResponse { type Query = Semantic; type State = ResponseSimplification; type Signals = Option; - type Options = (); + type Options = UseConsistentResponseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs b/crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs index dee3de3db78d..58f130051843 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ }; use biome_js_type_info::{Literal, Type, TypeData}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::use_exhaustive_switch_cases::UseExhaustiveSwitchCasesOptions; use crate::JsRuleAction; use crate::services::typed::Typed; @@ -104,7 +105,7 @@ impl Rule for UseExhaustiveSwitchCases { type Query = Typed; type State = Vec; type Signals = Option; - type Options = (); + type Options = UseExhaustiveSwitchCasesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let stmt = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_explicit_type.rs b/crates/biome_js_analyze/src/lint/nursery/use_explicit_type.rs index 621263f6e7ac..3764de7646f4 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_explicit_type.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_explicit_type.rs @@ -21,6 +21,7 @@ use biome_js_syntax::{ use biome_rowan::{ AstNode, AstSeparatedList, SyntaxNode, SyntaxNodeOptionExt, TextRange, declare_node_union, }; +use biome_rule_options::use_explicit_type::UseExplicitTypeOptions; declare_lint_rule! { /// Enforce types in functions, methods, variables, and parameters. @@ -415,7 +416,7 @@ impl Rule for UseExplicitType { type Query = Ast; type State = State; type Signals = Option; - type Options = (); + type Options = UseExplicitTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::().language(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_exports_last.rs b/crates/biome_js_analyze/src/lint/nursery/use_exports_last.rs index 1135297b2161..11a7abc1fbaf 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_exports_last.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_exports_last.rs @@ -4,6 +4,7 @@ use biome_analyze::{ use biome_console::markup; use biome_js_syntax::{AnyJsModuleItem, JsModuleItemList}; use biome_rowan::{AstNode, AstNodeList, TextRange}; +use biome_rule_options::use_exports_last::UseExportsLastOptions; declare_lint_rule! { /// Require that all exports are declared after all non-export statements. @@ -45,7 +46,7 @@ impl Rule for UseExportsLast { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseExportsLastOptions; fn run(ctx: &RuleContext) -> Self::Signals { let items = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_for_component.rs b/crates/biome_js_analyze/src/lint/nursery/use_for_component.rs index cb77bda356f0..6281fd519200 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_for_component.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_for_component.rs @@ -4,6 +4,7 @@ use biome_analyze::{ use biome_console::markup; use biome_js_syntax::{AnyJsMemberExpression, JsCallExpression, JsSyntaxKind, JsxExpressionChild}; use biome_rowan::{AstNode, AstSeparatedList, SyntaxNodeOptionExt}; +use biome_rule_options::use_for_component::UseForComponentOptions; declare_lint_rule! { /// Enforce using Solid's `` component for mapping an array to JSX elements. @@ -65,7 +66,7 @@ impl Rule for UseForComponent { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseForComponentOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_google_font_preconnect.rs b/crates/biome_js_analyze/src/lint/nursery/use_google_font_preconnect.rs index fb9f7631a94a..64c101350792 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_google_font_preconnect.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_google_font_preconnect.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsxAttribute, AnyJsxAttributeName, AnyJsxAttributeValue, T, jsx_ext::AnyJsxElement, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TextRange, TriviaPieceKind}; +use biome_rule_options::use_google_font_preconnect::UseGoogleFontPreconnectOptions; use crate::JsRuleAction; @@ -60,7 +61,7 @@ impl Rule for UseGoogleFontPreconnect { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseGoogleFontPreconnectOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_index_of.rs b/crates/biome_js_analyze/src/lint/nursery/use_index_of.rs index d6d09bbcd03a..fe870f7dc146 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_index_of.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_index_of.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsReturnStatement, JsSyntaxNode, JsSyntaxToken, JsVariableDeclaration, T, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxToken, Text}; +use biome_rule_options::use_index_of::UseIndexOfOptions; declare_lint_rule! { /// Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item. @@ -133,7 +134,7 @@ impl Rule for UseIndexOf { type Query = Ast; type State = JsSyntaxMatchPair; type Signals = Option; - type Options = (); + type Options = UseIndexOfOptions; fn run(ctx: &RuleContext) -> Self::Signals { let call = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_iterable_callback_return.rs b/crates/biome_js_analyze/src/lint/nursery/use_iterable_callback_return.rs index e5aab1942bdc..28ab72f14765 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_iterable_callback_return.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_iterable_callback_return.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsCallExpression, JsFunctionExpression, JsReturnStatement, global_identifier, }; use biome_rowan::{AstNode, AstSeparatedList, NodeOrToken, TextRange}; +use biome_rule_options::use_iterable_callback_return::UseIterableCallbackReturnOptions; use roaring::RoaringBitmap; use rustc_hash::FxHashMap; use std::io; @@ -89,7 +90,7 @@ impl Rule for UseIterableCallbackReturn { type Query = ControlFlowGraph; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseIterableCallbackReturnOptions; fn run(ctx: &RuleContext) -> Self::Signals { let cfg = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_json_import_attribute.rs b/crates/biome_js_analyze/src/lint/nursery/use_json_import_attribute.rs index 57e903e40e6e..b0d8bf0ea307 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_json_import_attribute.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_json_import_attribute.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{AnyJsImportAssertionEntry, JsImport, JsImportDefaultClause use biome_rowan::{ AstNode, AstSeparatedElement, AstSeparatedList, BatchMutationExt, TriviaPieceKind, }; +use biome_rule_options::use_json_import_attribute::UseJsonImportAttributeOptions; use crate::{JsRuleAction, services::module_graph::ResolvedImports}; @@ -64,7 +65,7 @@ impl Rule for UseJsonImportAttribute { type Query = ResolvedImports; type State = UseJsonImportAttributeState; type Signals = Option; - type Options = (); + type Options = UseJsonImportAttributeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_numeric_separators.rs b/crates/biome_js_analyze/src/lint/nursery/use_numeric_separators.rs index 728739bab26d..1dd2c90a9d93 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_numeric_separators.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_numeric_separators.rs @@ -4,6 +4,7 @@ use biome_analyze::{ use biome_console::markup; use biome_js_syntax::{JsNumberLiteralExpression, JsSyntaxToken}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_numeric_separators::UseNumericSeparatorsOptions; use crate::JsRuleAction; @@ -65,7 +66,7 @@ impl Rule for UseNumericSeparators { type Query = Ast; type State = State; type Signals = Option; - type Options = (); + type Options = UseNumericSeparatorsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let token = ctx.query().value_token().ok()?; diff --git a/crates/biome_js_analyze/src/lint/nursery/use_object_spread.rs b/crates/biome_js_analyze/src/lint/nursery/use_object_spread.rs index d51524f6b1a5..5816b972f69b 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_object_spread.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_object_spread.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsLanguage, JsSyntaxKind, T, global_identifier, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, TextRange}; +use biome_rule_options::use_object_spread::UseObjectSpreadOptions; declare_lint_rule! { /// Prefer object spread over `Object.assign()` when constructing new objects. @@ -67,7 +68,7 @@ impl Rule for UseObjectSpread { type Query = Semantic; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseObjectSpreadOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_parse_int_radix.rs b/crates/biome_js_analyze/src/lint/nursery/use_parse_int_radix.rs index 3bb392c13099..94ac633a0103 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_parse_int_radix.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_parse_int_radix.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsCallExpression, T, global_identifier, numbers::parse_js_number, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::use_parse_int_radix::UseParseIntRadixOptions; declare_lint_rule! { /// Enforce the consistent use of the radix argument when using `parseInt()`. @@ -63,7 +64,7 @@ impl Rule for UseParseIntRadix { type Query = Ast; type State = State; type Signals = Option; - type Options = (); + type Options = UseParseIntRadixOptions; fn run(ctx: &RuleContext) -> Self::Signals { let call_expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_readonly_class_properties.rs b/crates/biome_js_analyze/src/lint/nursery/use_readonly_class_properties.rs index bb7082885f46..72e66f5a11a4 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_readonly_class_properties.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_readonly_class_properties.rs @@ -3,7 +3,6 @@ use biome_analyze::{ Ast, FixKind, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_js_factory::make; use biome_js_syntax::{ AnyJsAssignment, AnyJsClassMember, AnyJsClassMemberName, AnyJsConstructorParameter, @@ -24,7 +23,7 @@ use biome_rowan::{ AstNode, AstNodeExt, AstNodeList, AstSeparatedList, BatchMutationExt, SyntaxNode, Text, TriviaPiece, declare_node_union, }; -use serde::{Deserialize, Serialize}; +use biome_rule_options::use_readonly_class_properties::UseReadonlyClassPropertiesOptions; use std::iter::once; declare_lint_rule! { @@ -135,7 +134,7 @@ impl Rule for UseReadonlyClassProperties { type Query = Ast; type State = PropOrParam; type Signals = Box<[Self::State]>; - type Options = ReadonlyClassPropertiesOptions; + type Options = UseReadonlyClassPropertiesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let root = ctx.query(); @@ -275,20 +274,6 @@ impl Rule for UseReadonlyClassProperties { } } -/// Rule's options -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct ReadonlyClassPropertiesOptions { - /// When `true`, the keywords `public`, `protected`, and `private` are analyzed by the rule. - #[serde(default, skip_serializing_if = "is_default")] - pub check_all_properties: bool, -} - -fn is_default(value: &T) -> bool { - value == &T::default() -} - declare_node_union! { pub AnyThisMemberLike = JsThisExpression | JsStaticMemberExpression } diff --git a/crates/biome_js_analyze/src/lint/nursery/use_single_js_doc_asterisk.rs b/crates/biome_js_analyze/src/lint/nursery/use_single_js_doc_asterisk.rs index 62e0d7dbb29d..a92ac3742664 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_single_js_doc_asterisk.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_single_js_doc_asterisk.rs @@ -9,6 +9,7 @@ use biome_jsdoc_comment::JsdocComment; use biome_rowan::{ AstNode, BatchMutationExt, Direction, TextLen, TextRange, TextSize, TriviaPiece, }; +use biome_rule_options::use_single_js_doc_asterisk::UseSingleJsDocAsteriskOptions; use crate::JsRuleAction; @@ -73,7 +74,7 @@ impl Rule for UseSingleJsDocAsterisk { type Query = Ast; type State = RuleState; type Signals = Vec; - type Options = (); + type Options = UseSingleJsDocAsteriskOptions; fn run(ctx: &RuleContext) -> Self::Signals { let module = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs index 21a705a88c9c..ccc9f51eb0db 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs @@ -1,12 +1,17 @@ mod any_class_string_like; mod class_info; mod class_lexer; -mod options; mod presets; mod sort; mod sort_config; mod tailwind_preset; +use self::{ + any_class_string_like::AnyClassStringLike, presets::UseSortedClassesPreset, + sort::get_sort_class_name_range, sort::should_ignore_postfix, sort::should_ignore_prefix, + sort::sort_class_name, sort_config::SortConfig, +}; +use crate::JsRuleAction; use biome_analyze::{Ast, FixKind, Rule, RuleDiagnostic, context::RuleContext, declare_lint_rule}; use biome_console::markup; use biome_js_factory::make::{ @@ -14,18 +19,10 @@ use biome_js_factory::make::{ js_string_literal_single_quotes, js_template_chunk, js_template_chunk_element, jsx_string, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_sorted_classes::UseSortedClassesOptions; use presets::get_config_preset; use std::sync::LazyLock; -use crate::JsRuleAction; - -pub use self::options::UtilityClassSortingOptions; -use self::{ - any_class_string_like::AnyClassStringLike, presets::UseSortedClassesPreset, - sort::get_sort_class_name_range, sort::should_ignore_postfix, sort::should_ignore_prefix, - sort::sort_class_name, sort_config::SortConfig, -}; - declare_lint_rule! { /// Enforce the sorting of CSS utility classes. /// @@ -170,7 +167,7 @@ impl Rule for UseSortedClasses { type Query = Ast; type State = Box; type Signals = Option; - type Options = Box; + type Options = UseSortedClassesOptions; fn run(ctx: &RuleContext) -> Option { let options = ctx.options(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/any_class_string_like.rs b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/any_class_string_like.rs index be514f4ee16e..624775797b2e 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/any_class_string_like.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/any_class_string_like.rs @@ -1,10 +1,10 @@ -use super::UtilityClassSortingOptions; use biome_js_syntax::{ AnyJsExpression, JsCallArguments, JsCallExpression, JsLiteralMemberName, JsStringLiteralExpression, JsSyntaxNode, JsTemplateChunkElement, JsTemplateExpression, JsxAttribute, JsxString, }; use biome_rowan::{AstNode, TokenText, declare_node_union}; +use biome_rule_options::use_sorted_classes::UseSortedClassesOptions; fn get_callee_name(call_expression: &JsCallExpression) -> Option { call_expression @@ -19,7 +19,7 @@ fn get_callee_name(call_expression: &JsCallExpression) -> Option { fn is_call_expression_of_target_function( call_expression: &JsCallExpression, - options: &UtilityClassSortingOptions, + options: &UseSortedClassesOptions, ) -> bool { get_callee_name(call_expression).is_some_and(|name| options.has_function(name.text())) } @@ -41,10 +41,7 @@ declare_node_union! { pub AnyClassStringLike = JsStringLiteralExpression | JsxString | JsTemplateChunkElement | JsLiteralMemberName } -fn inspect_string_literal( - node: &JsSyntaxNode, - options: &UtilityClassSortingOptions, -) -> Option { +fn inspect_string_literal(node: &JsSyntaxNode, options: &UseSortedClassesOptions) -> Option { let mut in_arguments = false; let mut in_function = false; for ancestor in node.ancestors().skip(1) { @@ -72,7 +69,7 @@ fn inspect_string_literal( } impl AnyClassStringLike { - pub(crate) fn should_visit(&self, options: &UtilityClassSortingOptions) -> Option { + pub(crate) fn should_visit(&self, options: &UseSortedClassesOptions) -> Option { match self { Self::JsStringLiteralExpression(string_literal) => { inspect_string_literal(string_literal.syntax(), options) diff --git a/crates/biome_js_analyze/src/lint/nursery/use_symbol_description.rs b/crates/biome_js_analyze/src/lint/nursery/use_symbol_description.rs index 77e553637eb0..adce7416f16c 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_symbol_description.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_symbol_description.rs @@ -2,6 +2,7 @@ use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, decl use biome_console::markup; use biome_js_syntax::{AnyJsExpression, JsCallExpression, global_identifier}; use biome_rowan::{AstNode, AstSeparatedList, TextRange}; +use biome_rule_options::use_symbol_description::UseSymbolDescriptionOptions; use crate::services::semantic::Semantic; @@ -44,7 +45,7 @@ impl Rule for UseSymbolDescription { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = UseSymbolDescriptionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let call_expression = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_unified_type_signature.rs b/crates/biome_js_analyze/src/lint/nursery/use_unified_type_signature.rs index 57c7452e3694..b8e6aabcc957 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_unified_type_signature.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_unified_type_signature.rs @@ -21,6 +21,7 @@ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutation, BatchMutationExt, SyntaxResult, TextRange, TriviaPieceKind, chain_trivia_pieces, declare_node_union, }; +use biome_rule_options::use_unified_type_signature::UseUnifiedTypeSignatureOptions; declare_lint_rule! { /// Disallow overload signatures that can be unified into a single signature. @@ -86,7 +87,7 @@ impl Rule for UseUnifiedTypeSignature { type Query = Ast; type State = MergeOverloadSignaturesInfo; type Signals = Option; - type Options = (); + type Options = UseUnifiedTypeSignatureOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/nursery/use_unique_element_ids.rs b/crates/biome_js_analyze/src/lint/nursery/use_unique_element_ids.rs index 0c184526b547..6bf8972e4840 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_unique_element_ids.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_unique_element_ids.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ jsx_ext::AnyJsxElement, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::use_unique_element_ids::UseUniqueElementIdsOptions; use crate::react::{ReactApiCall, ReactCreateElementCall}; use crate::services::semantic::Semantic; @@ -80,7 +81,7 @@ impl Rule for UseUniqueElementIds { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseUniqueElementIdsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_accumulating_spread.rs b/crates/biome_js_analyze/src/lint/performance/no_accumulating_spread.rs index 345d52f342e6..21b2774b4860 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_accumulating_spread.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_accumulating_spread.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsStaticMemberExpression, }; use biome_rowan::{AstNode, AstSeparatedList, TextRange, declare_node_union}; +use biome_rule_options::no_accumulating_spread::NoAccumulatingSpreadOptions; use crate::services::semantic::Semantic; @@ -85,7 +86,7 @@ impl Rule for NoAccumulatingSpread { type Query = Semantic; type State = FoundSpread; type Signals = Option; - type Options = (); + type Options = NoAccumulatingSpreadOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_barrel_file.rs b/crates/biome_js_analyze/src/lint/performance/no_barrel_file.rs index 114326da62df..0003c884d415 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_barrel_file.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_barrel_file.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsExport, JsExportFromClause, JsExportNamedFromClause, JsModule}; use biome_rowan::AstNode; +use biome_rule_options::no_barrel_file::NoBarrelFileOptions; declare_lint_rule! { /// Disallow the use of barrel file. @@ -54,7 +55,7 @@ impl Rule for NoBarrelFile { type Query = Ast; type State = JsExport; type Signals = Option; - type Options = (); + type Options = NoBarrelFileOptions; fn run(ctx: &RuleContext) -> Self::Signals { let items = ctx.query().items(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_delete.rs b/crates/biome_js_analyze/src/lint/performance/no_delete.rs index e60c66a277f3..bea2a2b91870 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_delete.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_delete.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ JsStaticMemberExpressionFields, JsUnaryExpression, JsUnaryOperator, T, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_delete::NoDeleteOptions; use crate::JsRuleAction; @@ -69,7 +70,7 @@ impl Rule for NoDelete { type Query = Ast; type State = AnyJsExpression; type Signals = Option; - type Options = (); + type Options = NoDeleteOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_dynamic_namespace_import_access.rs b/crates/biome_js_analyze/src/lint/performance/no_dynamic_namespace_import_access.rs index 6d5b9fbaaf29..b519cab59adc 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_dynamic_namespace_import_access.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_dynamic_namespace_import_access.rs @@ -4,6 +4,7 @@ use biome_diagnostics::Severity; use biome_js_semantic::ReferencesExtensions; use biome_js_syntax::{JsComputedMemberExpression, JsImportNamespaceClause}; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_dynamic_namespace_import_access::NoDynamicNamespaceImportAccessOptions; use crate::services::semantic::Semantic; @@ -70,7 +71,7 @@ impl Rule for NoDynamicNamespaceImportAccess { type Query = Semantic; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDynamicNamespaceImportAccessOptions; fn run(ctx: &RuleContext) -> Self::Signals { find_dynamic_namespace_import_accesses(ctx) diff --git a/crates/biome_js_analyze/src/lint/performance/no_img_element.rs b/crates/biome_js_analyze/src/lint/performance/no_img_element.rs index e2437a894780..7d11ca402fb5 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_img_element.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_img_element.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_js_syntax::{JsxChildList, JsxElement}; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::no_img_element::NoImgElementOptions; declare_lint_rule! { /// Prevent usage of `` element in a Next.js project. @@ -66,7 +67,7 @@ impl Rule for NoImgElement { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoImgElementOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_namespace_import.rs b/crates/biome_js_analyze/src/lint/performance/no_namespace_import.rs index 14c10fd9f724..7a343691bbe4 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_namespace_import.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_namespace_import.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsImportNamespaceClause; use biome_rowan::AstNode; +use biome_rule_options::no_namespace_import::NoNamespaceImportOptions; declare_lint_rule! { /// Disallow the use of namespace imports. @@ -43,7 +44,7 @@ impl Rule for NoNamespaceImport { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoNamespaceImportOptions; fn run(ctx: &RuleContext) -> Self::Signals { let import_namespace_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/performance/no_re_export_all.rs b/crates/biome_js_analyze/src/lint/performance/no_re_export_all.rs index 9081e23fd93a..3d36abe28cd7 100644 --- a/crates/biome_js_analyze/src/lint/performance/no_re_export_all.rs +++ b/crates/biome_js_analyze/src/lint/performance/no_re_export_all.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsExportFromClause; use biome_rowan::AstNode; +use biome_rule_options::no_re_export_all::NoReExportAllOptions; declare_lint_rule! { /// Avoid re-export all. @@ -50,7 +51,7 @@ impl Rule for NoReExportAll { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoReExportAllOptions; fn run(ctx: &RuleContext) -> Self::Signals { ctx.query().type_token().is_none().then_some(()) diff --git a/crates/biome_js_analyze/src/lint/performance/use_top_level_regex.rs b/crates/biome_js_analyze/src/lint/performance/use_top_level_regex.rs index 4e27d4c9d1a1..59f630775f3f 100644 --- a/crates/biome_js_analyze/src/lint/performance/use_top_level_regex.rs +++ b/crates/biome_js_analyze/src/lint/performance/use_top_level_regex.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsPropertyModifier, JsPropertyClassMember, JsRegexLiteralExpression}; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::use_top_level_regex::UseTopLevelRegexOptions; use crate::services::control_flow::AnyJsControlFlowRoot; @@ -55,7 +56,7 @@ impl Rule for UseTopLevelRegex { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseTopLevelRegexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let regex = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/security/no_blank_target.rs b/crates/biome_js_analyze/src/lint/security/no_blank_target.rs index aa996afb6d8e..bbe3a1767a90 100644 --- a/crates/biome_js_analyze/src/lint/security/no_blank_target.rs +++ b/crates/biome_js_analyze/src/lint/security/no_blank_target.rs @@ -2,7 +2,6 @@ use crate::JsRuleAction; use biome_analyze::context::RuleContext; use biome_analyze::{Ast, FixKind, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make::{ jsx_attribute, jsx_attribute_initializer_clause, jsx_attribute_list, jsx_ident, jsx_name, @@ -13,7 +12,7 @@ use biome_js_syntax::{ AnyJsxAttribute, AnyJsxAttributeName, AnyJsxAttributeValue, JsxAttribute, JsxAttributeList, T, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPieceKind}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::no_blank_target::NoBlankTargetOptions; // Elements to check, in the form of (node name, attribute name) tuples. // @@ -287,33 +286,6 @@ impl Rule for NoBlankTarget { } } -#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoBlankTargetOptions { - /// List of domains where `target="_blank"` is allowed without - /// `rel="noopener"`. - #[serde(skip_serializing_if = "Vec::is_empty")] - pub allow_domains: Vec, - - /// Whether `noreferrer` is allowed in addition to `noopener`. - #[serde(default = "default_allow_no_referrer")] - pub allow_no_referrer: bool, -} - -impl Default for NoBlankTargetOptions { - fn default() -> Self { - Self { - allow_domains: Default::default(), - allow_no_referrer: default_allow_no_referrer(), - } - } -} - -fn default_allow_no_referrer() -> bool { - true -} - fn is_allowed_domain(href: &str, allow_domains: &[&str]) -> bool { allow_domains .iter() diff --git a/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs b/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs index c5b1f861671a..25390d907843 100644 --- a/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs +++ b/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxAttributeName, JsCallExpression, JsxAttribute}; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_dangerously_set_inner_html::NoDangerouslySetInnerHtmlOptions; declare_lint_rule! { /// Prevent the usage of dangerous JSX props @@ -57,7 +58,7 @@ impl Rule for NoDangerouslySetInnerHtml { type Query = Semantic; type State = NoDangerState; type Signals = Option; - type Options = (); + type Options = NoDangerouslySetInnerHtmlOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs b/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs index d58a872abd5e..cad46cf2ae70 100644 --- a/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs +++ b/crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsxSelfClosingElement, }; use biome_rowan::{AstNode, AstNodeList, TextRange, declare_node_union}; +use biome_rule_options::no_dangerously_set_inner_html_with_children::NoDangerouslySetInnerHtmlWithChildrenOptions; declare_lint_rule! { /// Report when a DOM element or a component uses both `children` and `dangerouslySetInnerHTML` prop. @@ -156,7 +157,7 @@ impl Rule for NoDangerouslySetInnerHtmlWithChildren { type Query = Semantic; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoDangerouslySetInnerHtmlWithChildrenOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/security/no_global_eval.rs b/crates/biome_js_analyze/src/lint/security/no_global_eval.rs index 49b05c571786..b06a73ad7a2c 100644 --- a/crates/biome_js_analyze/src/lint/security/no_global_eval.rs +++ b/crates/biome_js_analyze/src/lint/security/no_global_eval.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, global_identifier}; use biome_rowan::AstNode; +use biome_rule_options::no_global_eval::NoGlobalEvalOptions; declare_lint_rule! { /// Disallow the use of global `eval()`. @@ -64,7 +65,7 @@ impl Rule for NoGlobalEval { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoGlobalEvalOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_common_js.rs b/crates/biome_js_analyze/src/lint/style/no_common_js.rs index 47e013cf252e..de1ad3555257 100644 --- a/crates/biome_js_analyze/src/lint/style/no_common_js.rs +++ b/crates/biome_js_analyze/src/lint/style/no_common_js.rs @@ -5,6 +5,7 @@ use biome_js_syntax::{ JsCallExpression, JsReferenceIdentifier, JsStaticMemberAssignment, global_identifier, }; use biome_rowan::{AstNode, declare_node_union}; +use biome_rule_options::no_common_js::NoCommonJsOptions; use crate::services::semantic::Semantic; @@ -67,7 +68,7 @@ impl Rule for NoCommonJs { type Query = Semantic; type State = bool; type Signals = Option; - type Options = (); + type Options = NoCommonJsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let file_ext = ctx.file_path().extension(); diff --git a/crates/biome_js_analyze/src/lint/style/no_default_export.rs b/crates/biome_js_analyze/src/lint/style/no_default_export.rs index 06de2f2d11c2..e1f469c79e68 100644 --- a/crates/biome_js_analyze/src/lint/style/no_default_export.rs +++ b/crates/biome_js_analyze/src/lint/style/no_default_export.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::AnyJsExportClause; use biome_rowan::{AstNode, AstSeparatedList, TextRange}; +use biome_rule_options::no_default_export::NoDefaultExportOptions; declare_lint_rule! { /// Disallow default exports. @@ -73,7 +74,7 @@ impl Rule for NoDefaultExport { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoDefaultExportOptions; fn run(ctx: &RuleContext) -> Self::Signals { let export_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_done_callback.rs b/crates/biome_js_analyze/src/lint/style/no_done_callback.rs index 091b154065fc..4455a37f26fc 100644 --- a/crates/biome_js_analyze/src/lint/style/no_done_callback.rs +++ b/crates/biome_js_analyze/src/lint/style/no_done_callback.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsTemplateExpression, }; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_done_callback::NoDoneCallbackOptions; declare_lint_rule! { /// Disallow using a callback in asynchronous tests and hooks. @@ -61,7 +62,7 @@ impl Rule for NoDoneCallback { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoDoneCallbackOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_enum.rs b/crates/biome_js_analyze/src/lint/style/no_enum.rs index ae771b870dc1..ece75332cb7d 100644 --- a/crates/biome_js_analyze/src/lint/style/no_enum.rs +++ b/crates/biome_js_analyze/src/lint/style/no_enum.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsFileSource, TsEnumDeclaration}; use biome_rowan::AstNode; +use biome_rule_options::no_enum::NoEnumOptions; declare_lint_rule! { /// Disallow TypeScript enum. @@ -58,7 +59,7 @@ impl Rule for NoEnum { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoEnumOptions; fn run(ctx: &RuleContext) -> Self::Signals { let enum_decl = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_exported_imports.rs b/crates/biome_js_analyze/src/lint/style/no_exported_imports.rs index 4c36f49c04ef..9dee4174ea48 100644 --- a/crates/biome_js_analyze/src/lint/style/no_exported_imports.rs +++ b/crates/biome_js_analyze/src/lint/style/no_exported_imports.rs @@ -4,6 +4,7 @@ use biome_diagnostics::Severity; use biome_js_semantic::CanBeImportedExported; use biome_js_syntax::AnyJsImportSpecifier; use biome_rowan::AstNode; +use biome_rule_options::no_exported_imports::NoExportedImportsOptions; use crate::services::semantic::Semantic; @@ -56,7 +57,7 @@ impl Rule for NoExportedImports { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoExportedImportsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let specifier = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_head_element.rs b/crates/biome_js_analyze/src/lint/style/no_head_element.rs index 08da90cd7ae1..3342b242e49d 100644 --- a/crates/biome_js_analyze/src/lint/style/no_head_element.rs +++ b/crates/biome_js_analyze/src/lint/style/no_head_element.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsxOpeningElement; use biome_rowan::AstNode; use biome_rowan::TextRange; +use biome_rule_options::no_head_element::NoHeadElementOptions; declare_lint_rule! { /// Prevent usage of `` element in a Next.js project. @@ -58,7 +59,7 @@ impl Rule for NoHeadElement { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoHeadElementOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_implicit_boolean.rs b/crates/biome_js_analyze/src/lint/style/no_implicit_boolean.rs index 424a48a849d7..ca0f6764dcfd 100644 --- a/crates/biome_js_analyze/src/lint/style/no_implicit_boolean.rs +++ b/crates/biome_js_analyze/src/lint/style/no_implicit_boolean.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsLiteralExpression, AnyJsxAttributeValue, JsSyntaxKind, JsxAttribute, JsxAttributeFields, T, }; use biome_rowan::{AstNode, AstNodeExt, BatchMutationExt}; +use biome_rule_options::no_implicit_boolean::NoImplicitBooleanOptions; use crate::JsRuleAction; @@ -58,7 +59,7 @@ impl Rule for NoImplicitBoolean { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoImplicitBooleanOptions; fn run(ctx: &RuleContext) -> Option { let n = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_inferrable_types.rs b/crates/biome_js_analyze/src/lint/style/no_inferrable_types.rs index 3e1da4a125fa..9dda36b5ff7f 100644 --- a/crates/biome_js_analyze/src/lint/style/no_inferrable_types.rs +++ b/crates/biome_js_analyze/src/lint/style/no_inferrable_types.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ }; use biome_rowan::AstNode; use biome_rowan::BatchMutationExt; +use biome_rule_options::no_inferrable_types::NoInferrableTypesOptions; declare_lint_rule! { /// Disallow type annotations for variables, parameters, and class properties initialized with a literal expression. @@ -107,7 +108,7 @@ impl Rule for NoInferrableTypes { type Query = Ast; type State = TsTypeAnnotation; type Signals = Option; - type Options = (); + type Options = NoInferrableTypesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let init = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_namespace.rs b/crates/biome_js_analyze/src/lint/style/no_namespace.rs index c1fc6bc0df52..7924d67d7124 100644 --- a/crates/biome_js_analyze/src/lint/style/no_namespace.rs +++ b/crates/biome_js_analyze/src/lint/style/no_namespace.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::TsModuleDeclaration; use biome_rowan::AstNode; +use biome_rule_options::no_namespace::NoNamespaceOptions; declare_lint_rule! { /// Disallow the use of TypeScript's `namespace`s. @@ -62,7 +63,7 @@ impl Rule for NoNamespace { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoNamespaceOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_js_analyze/src/lint/style/no_negation_else.rs b/crates/biome_js_analyze/src/lint/style/no_negation_else.rs index 07b833c50654..03008e365c04 100644 --- a/crates/biome_js_analyze/src/lint/style/no_negation_else.rs +++ b/crates/biome_js_analyze/src/lint/style/no_negation_else.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsExpression, AnyJsStatement, JsConditionalExpression, JsIfStatement, JsUnaryOperator, T, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_negation_else::NoNegationElseOptions; use crate::JsRuleAction; @@ -61,7 +62,7 @@ impl Rule for NoNegationElse { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoNegationElseOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs b/crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs index 29536030bf53..66d3e018c851 100644 --- a/crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs +++ b/crates/biome_js_analyze/src/lint/style/no_nested_ternary.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsConditionalExpression}; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_nested_ternary::NoNestedTernaryOptions; declare_lint_rule! { /// Disallow nested ternary expressions. @@ -55,7 +56,7 @@ impl Rule for NoNestedTernary { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoNestedTernaryOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_non_null_assertion.rs b/crates/biome_js_analyze/src/lint/style/no_non_null_assertion.rs index 708d2224303e..adfe3a0db734 100644 --- a/crates/biome_js_analyze/src/lint/style/no_non_null_assertion.rs +++ b/crates/biome_js_analyze/src/lint/style/no_non_null_assertion.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ AnyJsExpression, T, TsNonNullAssertionAssignment, TsNonNullAssertionExpression, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_non_null_assertion::NoNonNullAssertionOptions; declare_lint_rule! { /// Disallow non-null assertions using the `!` postfix operator. @@ -63,7 +64,7 @@ impl Rule for NoNonNullAssertion { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoNonNullAssertionOptions; fn run(ctx: &RuleContext) -> Self::Signals { match ctx.query() { diff --git a/crates/biome_js_analyze/src/lint/style/no_parameter_assign.rs b/crates/biome_js_analyze/src/lint/style/no_parameter_assign.rs index 75e3eaba4e7c..b781c2cd6864 100644 --- a/crates/biome_js_analyze/src/lint/style/no_parameter_assign.rs +++ b/crates/biome_js_analyze/src/lint/style/no_parameter_assign.rs @@ -2,7 +2,6 @@ use crate::services::semantic::Semantic; use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule}; use biome_console::markup; use biome_deserialize::TextRange; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_semantic::{Reference, ReferencesExtensions}; use biome_js_syntax::AnyJsAssignment; @@ -13,7 +12,7 @@ use biome_js_syntax::{ use biome_js_syntax::{JsAssignmentExpression, JsPostUpdateExpression, JsPreUpdateExpression}; use biome_rowan::AstNode; use biome_rowan::declare_node_union; -use serde::{Deserialize, Serialize}; +use biome_rule_options::no_parameter_assign::{NoParameterAssignOptions, PropertyAssignmentMode}; declare_lint_rule! { /// Disallow reassigning `function` parameters. @@ -120,31 +119,6 @@ declare_lint_rule! { } } -/// Options for the rule `NoParameterAssign` -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoParameterAssignOptions { - /// Whether to report an error when a dependency is listed in the dependencies array but isn't used. Defaults to `allow`. - #[serde(default)] - pub property_assignment: PropertyAssignmentMode, -} - -#[derive(Copy, Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -/// Specifies whether property assignments on function parameters are allowed or denied. -pub enum PropertyAssignmentMode { - /// Allows property assignments on function parameters. - /// This is the default behavior, enabling flexibility in parameter usage. - #[default] - Allow, - - /// Disallows property assignments on function parameters. - /// Enforces stricter immutability to prevent unintended side effects. - Deny, -} - impl Rule for NoParameterAssign { type Query = Semantic; type State = ProblemType; diff --git a/crates/biome_js_analyze/src/lint/style/no_parameter_properties.rs b/crates/biome_js_analyze/src/lint/style/no_parameter_properties.rs index e937a6283216..b67476fe9c4e 100644 --- a/crates/biome_js_analyze/src/lint/style/no_parameter_properties.rs +++ b/crates/biome_js_analyze/src/lint/style/no_parameter_properties.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::TsPropertyParameter; use biome_rowan::AstNode; +use biome_rule_options::no_parameter_properties::NoParameterPropertiesOptions; declare_lint_rule! { /// Disallow the use of parameter properties in class constructors. @@ -45,7 +46,7 @@ impl Rule for NoParameterProperties { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoParameterPropertiesOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_js_analyze/src/lint/style/no_process_env.rs b/crates/biome_js_analyze/src/lint/style/no_process_env.rs index 4963949ba97d..e9d8672356df 100644 --- a/crates/biome_js_analyze/src/lint/style/no_process_env.rs +++ b/crates/biome_js_analyze/src/lint/style/no_process_env.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsStaticMemberExpression, global_identifier}; use biome_rowan::AstNode; +use biome_rule_options::no_process_env::NoProcessEnvOptions; use crate::services::semantic::Semantic; @@ -50,7 +51,7 @@ impl Rule for NoProcessEnv { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoProcessEnvOptions; fn run(ctx: &RuleContext) -> Self::Signals { let static_member_expr = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_restricted_globals.rs b/crates/biome_js_analyze/src/lint/style/no_restricted_globals.rs index b2300d175291..fb46db4df43c 100644 --- a/crates/biome_js_analyze/src/lint/style/no_restricted_globals.rs +++ b/crates/biome_js_analyze/src/lint/style/no_restricted_globals.rs @@ -2,13 +2,12 @@ use crate::services::semantic::SemanticServices; use biome_analyze::context::RuleContext; use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_semantic::{Binding, BindingExtensions}; use biome_js_syntax::{AnyJsIdentifierUsage, TextRange}; use biome_rowan::AstNode; +use biome_rule_options::no_restricted_globals::NoRestrictedGlobalsOptions; use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; declare_lint_rule! { /// This rule allows you to specify global variable names that you don’t want to use in your application. @@ -16,7 +15,7 @@ declare_lint_rule! { /// References to the global identifiers `error` and `event` are always disallowed by this rule. /// /// > Disallowing usage of specific global variables can be useful if you want to allow a set of - /// global variables by enabling an environment, but still want to disallow some of those. + /// global variables by enabling an environment but still want to disallow some of those. /// /// ## Examples /// @@ -63,21 +62,11 @@ declare_lint_rule! { const RESTRICTED_GLOBALS: [&str; 2] = ["event", "error"]; -/// Options for the rule `noRestrictedGlobals`. -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct RestrictedGlobalsOptions { - /// A list of names that should trigger the rule - #[serde(skip_serializing_if = "FxHashMap::is_empty")] - pub denied_globals: FxHashMap, Box>, -} - impl Rule for NoRestrictedGlobals { type Query = SemanticServices; type State = (TextRange, Box, Option>); type Signals = Box<[Self::State]>; - type Options = Box; + type Options = NoRestrictedGlobalsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let model = ctx.model(); diff --git a/crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs b/crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs index c63e6b5c5942..17f3f1c0fdf4 100644 --- a/crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs +++ b/crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs @@ -1,9 +1,6 @@ use biome_analyze::context::RuleContext; use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize::{ - Deserializable, DeserializableType, DeserializableValue, DeserializationContext, -}; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsArrowFunctionParameters, AnyJsBindingPattern, AnyJsCombinedSpecifier, AnyJsExpression, @@ -17,8 +14,11 @@ use biome_js_syntax::{ JsObjectBindingPatternShorthandProperty, JsShorthandNamedImportSpecifier, JsStaticMemberExpression, JsSyntaxKind, JsVariableDeclarator, inner_string_text, }; -use biome_rowan::{AstNode, AstSeparatedList, SyntaxNode, SyntaxNodeCast, SyntaxToken, TextRange}; -use rustc_hash::FxHashMap; +use biome_rowan::{AstNode, AstSeparatedList, SyntaxNode, SyntaxNodeCast, SyntaxToken}; +use biome_rule_options::no_restricted_imports::{ + CustomRestrictedImportOptions, ImportRestrictionCause, NoRestrictedImportsOptions, + RestrictedImportMessage, RestrictedImportVisitor, +}; use serde::{Deserialize, Serialize}; declare_lint_rule! { @@ -328,637 +328,11 @@ declare_lint_rule! { } } -/// Options for the rule `noRestrictedImports`. -#[derive( - Clone, - Debug, - Default, - Deserialize, - biome_deserialize_macros::Deserializable, - Eq, - PartialEq, - Serialize, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct RestrictedImportsOptions { - /// A list of import paths that should trigger the rule. - #[serde(skip_serializing_if = "FxHashMap::is_empty")] - paths: FxHashMap, CustomRestrictedImport>, -} - -/// Specifies why a specific import is allowed or disallowed. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -enum ImportRestrictionCause { - /// Reason: The import source is forbidden or allowed. - ImportSource, - /// Reason: A set of forbidden import names has been defined via `importNames`. - ImportNames, - /// Reason: A set of allowed import names has been defined via `allowImportNames`. - AllowImportNames, -} - -/// Specifies whether a specific import is (dis)allowed, and why it is allowed/disallowed. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -struct ImportRestrictionStatus(bool, ImportRestrictionCause); - -impl ImportRestrictionStatus { - pub fn is_allowed(&self) -> bool { - self.0 - } - - pub fn is_forbidden(&self) -> bool { - !self.0 - } - - pub fn reason(&self) -> ImportRestrictionCause { - self.1 - } -} - -#[derive( - Clone, - Debug, - Default, - Deserialize, - biome_deserialize_macros::Deserializable, - Eq, - PartialEq, - Serialize, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct CustomRestrictedImportOptions { - /// The message to display when this module is imported. - #[serde(skip_serializing_if = "str::is_empty")] - message: Box, - - /// Names of the exported members that should not be used. - #[serde(skip_serializing_if = "<[_]>::is_empty")] - import_names: Box<[Box]>, - - /// Names of the exported members that allowed to be not be used. - #[serde(skip_serializing_if = "<[_]>::is_empty")] - allow_import_names: Box<[Box]>, -} - -impl CustomRestrictedImportOptions { - pub fn has_import_name_patterns(&self) -> bool { - !self.import_names.is_empty() || !self.allow_import_names.is_empty() - } - - fn is_import_allowed(&self, imported_name: &str) -> ImportRestrictionStatus { - if !self.allow_import_names.is_empty() { - // Deny all imports except for the names specified in allow_import_names - let is_allowed = self - .allow_import_names - .iter() - .any(|name| &**name == imported_name); - - ImportRestrictionStatus(is_allowed, ImportRestrictionCause::AllowImportNames) - } else if !self.import_names.is_empty() { - // Allow all imports except for the names specified in import_names - let is_forbidden = self - .import_names - .iter() - .any(|name| &**name == imported_name); - - ImportRestrictionStatus(!is_forbidden, ImportRestrictionCause::ImportNames) - } else { - // Deny all imports from this module - ImportRestrictionStatus(false, ImportRestrictionCause::ImportSource) - } - } - - fn get_message_for_restriction( - &self, - import_source: &str, - imported_name: &str, - reason: ImportRestrictionCause, - ) -> String { - if !self.message.is_empty() { - self.message.to_string() - } else { - match reason { - ImportRestrictionCause::ImportSource => { - format!("Do not import '{import_source}'.") - } - ImportRestrictionCause::ImportNames | ImportRestrictionCause::AllowImportNames => { - if imported_name == RestrictedImportVisitor::BARE_IMPORT_ALIAS { - format!("Do not import '{import_source}' through a side-effect import.") - } else { - format!("Do not import '{imported_name}' from '{import_source}'.") - } - } - } - } - } -} - -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(untagged)] -pub enum CustomRestrictedImport { - /// The message to display when this module is imported. - Plain(Box), - /// Additional options to configure the message and allowed/disallowed import names. - WithOptions(CustomRestrictedImportOptions), -} - -impl From for CustomRestrictedImportOptions { - fn from(options: CustomRestrictedImport) -> Self { - match options { - CustomRestrictedImport::Plain(message) => Self { - message, - import_names: [].into(), - allow_import_names: [].into(), - }, - CustomRestrictedImport::WithOptions(options) => options, - } - } -} - -impl Deserializable for CustomRestrictedImport { - fn deserialize( - ctx: &mut impl DeserializationContext, - value: &impl DeserializableValue, - name: &str, - ) -> Option { - if value.visitable_type()? == DeserializableType::Str { - biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::Plain) - } else { - biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::WithOptions) - } - } -} - -struct RestrictedImportVisitor<'a> { - import_source: &'a str, - restricted_import: CustomRestrictedImportOptions, - results: Vec, -} - -impl RestrictedImportVisitor<'_> { - pub const BARE_IMPORT_ALIAS: &'static str = ""; - pub const NAMESPACE_IMPORT_ALIAS: &'static str = "*"; - pub const DEFAULT_IMPORT_ALIAS: &'static str = "default"; - - /// Analyze the context of an `import(...)` call to find the imported names, - /// then validate that each of the names is allowed to be imported. - pub fn visit_import_call(&mut self, import_call: &JsImportCallExpression) -> Option<()> { - // An import() call can appear by itself, but might also appear within - // the following contexts, where we can infer more details about what is - // being imported, and thus better target our emitted diagnostics: - // - // import("imported-module") - // import("imported-module").then((namespaceImport) => /* ... */) - // import("imported-module").then(({ import1, import2: localName2 }) => /* ... */) - // import("imported-module").then(function(namespaceImport) { /* ... */ }) - // import("imported-module").then(function({ import1, import2: localName2 }) { /* ... */ }) - // const namespaceImport = await import("imported-module") - // const { default: localName1, import1, import2: localName2, "import3": localName3 } = await import("imported-module") - // - // To make this diagnostic a bit tolerant to other errors in the source code, - // we also allow the "await" keyword to be missing, and just act as if it was - // there in that case. We also try to ignore parentheses and thus treat "(expr)" - // the same as "expr". - // - // Given the import_call node, we navigate up the parent chain to see - // whether we are in one of the mentioned contexts: - if let Some(bindings) = Self::get_context_for_import_call(import_call) { - match bindings { - AnyJsBindingPattern::AnyJsBinding(namespace_binding) => match namespace_binding { - // const ... = import(...) - biome_js_syntax::AnyJsBinding::JsIdentifierBinding(namespace_binding) => { - // const namespaceImport = import(...) - return self.visit_namespace_binding(&namespace_binding); - } - _ => { - // Use fallback instead - } - }, - AnyJsBindingPattern::JsObjectBindingPattern(named_bindings) => { - // const { ... } = await import(...) - return self.visit_named_bindings(&named_bindings); - } - AnyJsBindingPattern::JsArrayBindingPattern(_) => { - // const [ ... ] = await import(...) - // - // Array binding patterns do not really make sense for an import, - // so discard the additonal information and use fallback instead. - } - } - }; - - // We failed to find any additional context, and are therefore - // restricted to analyzing "import(...)" as a namespace import, - // because that what is returned by "import(...)". - // - // The diagnostic will be associated with "import('module-name')" - // instead of just "'module_name'" to indicate that not the - // imported module itself is forbidden, but the ways in which - // it can be imported are restricted. - self.visit_special_import_node(import_call.syntax(), Self::NAMESPACE_IMPORT_ALIAS) - } - - fn get_context_for_import_call( - import_call: &JsImportCallExpression, - ) -> Option { - let mut current = import_call.syntax().parent()?; - - while current.kind() == JsSyntaxKind::JS_PARENTHESIZED_EXPRESSION { - // #1: const { ... } = (await **(import(""))**) - // #2: **(import(""))**.then(...) - current = current.parent()?; - } - - if current.kind() == JsSyntaxKind::JS_AWAIT_EXPRESSION { - // #1: const { ... } = (**await (import(""))**) - current = current.parent()?; - - while current.kind() == JsSyntaxKind::JS_PARENTHESIZED_EXPRESSION { - // #1: const { ... } = **(await (import("")))** - current = current.parent()?; - } - } else if current.kind() == JsSyntaxKind::JS_STATIC_MEMBER_EXPRESSION { - // #2: **(import("")).then**(...) - let static_member_expr = current.cast::()?; - let member_name = static_member_expr.member().ok()?; - if member_name.as_js_name()?.syntax().text_trimmed() != "then" { - return None; - } - current = static_member_expr.syntax().parent()?; - - if current.kind() == JsSyntaxKind::JS_CALL_EXPRESSION { - // #2: **(import("")).then(...)** - let then_call_expr = current.cast::()?; - let then_call_arg = then_call_expr - .arguments() - .ok()? - .args() - .iter() - .next()? - .ok()? - .as_any_js_expression()? - .clone() - .omit_parentheses(); - - return match then_call_arg { - // then(... => ...) - AnyJsExpression::JsArrowFunctionExpression(arrow_expr) => { - match arrow_expr.parameters().ok()? { - // then(arg => ...) - AnyJsArrowFunctionParameters::AnyJsBinding(binding) => { - Some(AnyJsBindingPattern::AnyJsBinding(binding)) - } - // then ({ ... } => ...) - AnyJsArrowFunctionParameters::JsParameters(parameters) => Some( - parameters - .items() - .iter() - .next()? - .ok()? - .as_any_js_formal_parameter()? - .as_js_formal_parameter()? - .binding() - .ok()?, - ), - } - } - // then(function(...) { ... }) - AnyJsExpression::JsFunctionExpression(function_expr) => Some( - function_expr - .parameters() - .ok()? - .items() - .iter() - .next()? - .ok()? - .as_any_js_formal_parameter()? - .as_js_formal_parameter()? - .binding() - .ok()?, - ), - _ => None, - }; - } - } - - // #1: const { ... } = **(await (import("")))** - if current.kind() == JsSyntaxKind::JS_INITIALIZER_CLAUSE { - // #1: const { ... } **= (await (import("")))** - current = current.parent()?; - } else { - return None; - } - - if current.kind() == JsSyntaxKind::JS_VARIABLE_DECLARATOR { - // #1: const **{ ... } = (await (import("")))** - let variable_declarator = current.cast::()?; - - // #1: const **{ ... }** = (await (import(""))) - variable_declarator.id().ok() - } else { - None - } - } - - /// Analyze a static `import ... from ...` or `export ... from ...`declaration - /// (including all the different variants of `import` and `export`) to find the names - /// that are being imported, then validate that each of the names is allowed to be imported. - pub fn visit_import(&mut self, module_source_node: &JsModuleSource) -> Option<()> { - // Only certain imports are allowed/disallowed, add diagnostic to each disallowed import - let clause = module_source_node.syntax().parent()?; - match clause.kind() { - JsSyntaxKind::JS_IMPORT_BARE_CLAUSE => { - let side_effect_import: JsImportBareClause = clause.cast()?; - self.visit_side_effect_import(&side_effect_import) - } - JsSyntaxKind::JS_IMPORT_COMBINED_CLAUSE => { - let import_combined_clause: JsImportCombinedClause = clause.cast()?; - if let Ok(default_specifier) = import_combined_clause.default_specifier() { - self.visit_default_import(&default_specifier); - } - if let Ok(combined_specifier) = import_combined_clause.specifier() { - self.visit_combined_specifier(&combined_specifier); - } - Some(()) - } - JsSyntaxKind::JS_IMPORT_NAMED_CLAUSE => { - let import_named_clause: JsImportNamedClause = clause.cast()?; - let import_specifiers = import_named_clause.named_specifiers().ok()?; - self.visit_named_imports(&import_specifiers) - } - JsSyntaxKind::JS_EXPORT_NAMED_FROM_CLAUSE => { - let export_named_from_clause = clause.cast::()?; - let import_specifiers = export_named_from_clause.specifiers(); - self.visit_named_reexports(&import_specifiers) - } - JsSyntaxKind::JS_IMPORT_DEFAULT_CLAUSE => { - let import_default_clause: JsImportDefaultClause = clause.cast()?; - let default_specifier = import_default_clause.default_specifier().ok()?; - self.visit_default_import(&default_specifier) - } - JsSyntaxKind::JS_IMPORT_NAMESPACE_CLAUSE => { - let import_namespace_clause: JsImportNamespaceClause = clause.cast()?; - let namespace_specifier = import_namespace_clause.namespace_specifier().ok()?; - self.visit_namespace_import(&namespace_specifier) - } - JsSyntaxKind::JS_EXPORT_FROM_CLAUSE => { - let reexport_namespace_clause: JsExportFromClause = clause.cast()?; - self.visit_namespace_reexport(&reexport_namespace_clause) - } - _ => None, - } - } - - fn visit_combined_specifier( - &mut self, - combined_specifier: &AnyJsCombinedSpecifier, - ) -> Option<()> { - match combined_specifier { - AnyJsCombinedSpecifier::JsNamedImportSpecifiers(named_imports) => { - self.visit_named_imports(named_imports) - } - AnyJsCombinedSpecifier::JsNamespaceImportSpecifier(namespace_import) => { - self.visit_namespace_import(namespace_import) - } - } - } - - fn visit_named_imports(&mut self, named_imports: &JsNamedImportSpecifiers) -> Option<()> { - let import_specifiers = named_imports.specifiers(); - for import_specifier in import_specifiers.iter().flatten() { - self.visit_named_or_shorthand_import(&import_specifier); - } - Some(()) - } - - fn visit_named_reexports( - &mut self, - named_reexports: &JsExportNamedFromSpecifierList, - ) -> Option<()> { - for export_specifier in named_reexports.iter().flatten() { - self.visit_named_or_shorthand_reexport(&export_specifier); - } - Some(()) - } - - fn visit_named_bindings(&mut self, named_imports: &JsObjectBindingPattern) -> Option<()> { - let import_bindings = named_imports.properties(); - for import_binding in import_bindings.iter().flatten() { - self.visit_named_or_shorthand_binding(&import_binding); - } - Some(()) - } - - fn visit_named_or_shorthand_import( - &mut self, - import_specifier: &AnyJsNamedImportSpecifier, - ) -> Option<()> { - match import_specifier { - AnyJsNamedImportSpecifier::JsShorthandNamedImportSpecifier(shorthand_import) => { - self.visit_shorthand_import(shorthand_import) - } - AnyJsNamedImportSpecifier::JsNamedImportSpecifier(named_import) => { - self.visit_named_import(named_import) - } - AnyJsNamedImportSpecifier::JsBogusNamedImportSpecifier(_) => None, - } - } - - fn visit_named_or_shorthand_binding( - &mut self, - import_binding: &AnyJsObjectBindingPatternMember, - ) -> Option<()> { - match import_binding { - AnyJsObjectBindingPatternMember::JsObjectBindingPatternShorthandProperty( - shorthand_import, - ) => self.visit_shorthand_binding(shorthand_import), - AnyJsObjectBindingPatternMember::JsObjectBindingPatternProperty(named_import) => { - self.visit_named_binding(named_import) - } - _ => None, - } - } - - /// Checks whether this bare import of the form `import from 'source'` is allowed. - fn visit_side_effect_import(&mut self, bare_import: &JsImportBareClause) -> Option<()> { - let source_token = bare_import - .source() - .ok()? - .as_js_module_source()? - .value_token() - .ok()?; - self.visit_special_import_token(&source_token, Self::BARE_IMPORT_ALIAS) - } - - /// Checks whether this import of the form `local_name` (as in `import local_name from 'source'`) is allowed. - fn visit_default_import(&mut self, default_import: &JsDefaultImportSpecifier) -> Option<()> { - let local_name = default_import - .local_name() - .ok()? - .as_js_identifier_binding()? - .name_token() - .ok()?; - self.visit_special_import_token(&local_name, Self::DEFAULT_IMPORT_ALIAS) - } - - /// Checks whether this import of the form `* as local_name` is allowed. - fn visit_namespace_import( - &mut self, - namespace_import: &JsNamespaceImportSpecifier, - ) -> Option<()> { - self.visit_special_import_token( - &namespace_import.star_token().ok()?, - Self::NAMESPACE_IMPORT_ALIAS, - ) - } - - /// Checks whether this namespace reexport of the form `export * from ...` is allowed. - fn visit_namespace_reexport(&mut self, namespace_reexport: &JsExportFromClause) -> Option<()> { - self.visit_special_import_token( - &namespace_reexport.star_token().ok()?, - Self::NAMESPACE_IMPORT_ALIAS, - ) - } - - /// Checks whether this import of the form `const local_name = import(...)` is allowed. - fn visit_namespace_binding(&mut self, namespace_import: &JsIdentifierBinding) -> Option<()> { - self.visit_special_import_node(namespace_import.syntax(), Self::NAMESPACE_IMPORT_ALIAS) - } - - /// Checks whether this import of the form `{ imported_name }` is allowed. - fn visit_shorthand_import( - &mut self, - shorthand_import: &JsShorthandNamedImportSpecifier, - ) -> Option<()> { - self.visit_imported_identifier( - &shorthand_import - .local_name() - .ok()? - .as_js_identifier_binding()? - .name_token() - .ok()?, - ) - } - - /// Checks whether this import of the form `{ imported_name }` is allowed. - fn visit_shorthand_binding( - &mut self, - shorthand_import: &JsObjectBindingPatternShorthandProperty, - ) -> Option<()> { - self.visit_imported_identifier( - &shorthand_import - .identifier() - .ok()? - .as_js_identifier_binding()? - .name_token() - .ok()?, - ) - } - - /// Checks whether this import of the form `{ imported_name as local_name }` - /// (including `{ default as local_name }`) is allowed. - fn visit_named_import(&mut self, named_import: &JsNamedImportSpecifier) -> Option<()> { - self.visit_imported_identifier(&named_import.name().ok()?.value().ok()?) - } - - /// Checks whether this import of the form `{ imported_name }` or `{ imported_name as exported_name }` - /// (including `{ default as exported_name }`) is allowed. - fn visit_named_or_shorthand_reexport( - &mut self, - named_reexport: &JsExportNamedFromSpecifier, - ) -> Option<()> { - self.visit_imported_identifier(&named_reexport.source_name().ok()?.value().ok()?) - } - - /// Checks whether this import of the form `{ imported_name: local_name }` - /// (including `{ default: local_name }` and `{ "imported name": local_name `) is allowed. - fn visit_named_binding(&mut self, named_import: &JsObjectBindingPatternProperty) -> Option<()> { - self.visit_imported_identifier( - &named_import - .member() - .ok()? - .as_js_literal_member_name()? - .value() - .ok()?, - ) - } - - /// Checks whether the import specified by `name_token` is allowed, - /// and records a diagnostic for `name_token.text_trimmed_range()` if not. - /// - /// `name_token` can be either a string literal or an identifier. - fn visit_imported_identifier(&mut self, name_token: &SyntaxToken) -> Option<()> { - // TODO: inner_string_text removes quotes but does not e.g. decode escape sequences. - // If the imported name uses e.g. Unicode escape sequences, this may cause - // problems because restricted_import.(allow_)import_names contains decoded - // strings, while inner_string_text(name_token) returns encoded strings. - self.visit_special_import_token(name_token, inner_string_text(name_token).text()) - } - - /// Checks whether the import specified by `name_or_alias` is allowed. - /// and records a diagnostic for `import_node.text_trimmed_range()` if not. - fn visit_special_import_node( - &mut self, - import_node: &SyntaxNode, - name_or_alias: &str, - ) -> Option<()> { - let status = self.restricted_import.is_import_allowed(name_or_alias); - if status.is_allowed() { - return None; - } - self.results.push(RestrictedImportMessage { - location: import_node.text_trimmed_range(), - message: self.restricted_import.get_message_for_restriction( - self.import_source, - name_or_alias, - status.reason(), - ), - import_source: self.import_source.to_string(), - allowed_import_names: self.restricted_import.allow_import_names.clone(), - }); - Some(()) - } - - /// Checks whether the import specified by `name_or_alias` is allowed. - /// and records a diagnostic for `import_token.text_trimmed_range()` if not. - fn visit_special_import_token( - &mut self, - import_token: &SyntaxToken, - name_or_alias: &str, - ) -> Option<()> { - let status = self.restricted_import.is_import_allowed(name_or_alias); - if status.is_allowed() { - return None; - } - self.results.push(RestrictedImportMessage { - location: import_token.text_trimmed_range(), - message: self.restricted_import.get_message_for_restriction( - self.import_source, - name_or_alias, - status.reason(), - ), - import_source: self.import_source.to_string(), - allowed_import_names: self.restricted_import.allow_import_names.clone(), - }); - Some(()) - } -} - -pub struct RestrictedImportMessage { - location: TextRange, - message: String, - import_source: String, - allowed_import_names: Box<[Box]>, -} - impl Rule for NoRestrictedImports { type Query = Ast; type State = RestrictedImportMessage; type Signals = Vec; - type Options = Box; + type Options = NoRestrictedImportsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); @@ -998,7 +372,7 @@ impl Rule for NoRestrictedImports { restricted_import, results: Vec::new(), }; - visitor.visit_import(module_source_node); + visit_import(&mut visitor, module_source_node); visitor.results } } @@ -1026,7 +400,7 @@ impl Rule for NoRestrictedImports { restricted_import, results: Vec::new(), }; - visitor.visit_import_call(import_call); + visit_import_call(&mut visitor, import_call); visitor.results } } @@ -1088,3 +462,515 @@ impl Rule for NoRestrictedImports { Some(rule_diagnostic) } } + +/// Options for the rule `noRestrictedImports`. +#[derive( + Clone, + Debug, + Default, + Deserialize, + biome_deserialize_macros::Deserializable, + Eq, + PartialEq, + Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct RestrictedImportsOptions {} + +/// Analyze the context of an `import(...)` call to find the imported names, +/// then validate that each of the names is allowed to be imported. +pub fn visit_import_call( + visitor: &mut RestrictedImportVisitor, + import_call: &JsImportCallExpression, +) -> Option<()> { + // An import() call can appear by itself, but might also appear within + // the following contexts, where we can infer more details about what is + // being imported, and thus better target our emitted diagnostics: + // + // import("imported-module") + // import("imported-module").then((namespaceImport) => /* ... */) + // import("imported-module").then(({ import1, import2: localName2 }) => /* ... */) + // import("imported-module").then(function(namespaceImport) { /* ... */ }) + // import("imported-module").then(function({ import1, import2: localName2 }) { /* ... */ }) + // const namespaceImport = await import("imported-module") + // const { default: localName1, import1, import2: localName2, "import3": localName3 } = await import("imported-module") + // + // To make this diagnostic a bit tolerant to other errors in the source code, + // we also allow the "await" keyword to be missing, and just act as if it was + // there in that case. We also try to ignore parentheses and thus treat "(expr)" + // the same as "expr". + // + // Given the import_call node, we navigate up the parent chain to see + // whether we are in one of the mentioned contexts: + if let Some(bindings) = get_context_for_import_call(import_call) { + match bindings { + AnyJsBindingPattern::AnyJsBinding(namespace_binding) => match namespace_binding { + // const ... = import(...) + biome_js_syntax::AnyJsBinding::JsIdentifierBinding(namespace_binding) => { + // const namespaceImport = import(...) + return visit_namespace_binding(visitor, &namespace_binding); + } + _ => { + // Use fallback instead + } + }, + AnyJsBindingPattern::JsObjectBindingPattern(named_bindings) => { + // const { ... } = await import(...) + return visit_named_bindings(visitor, &named_bindings); + } + AnyJsBindingPattern::JsArrayBindingPattern(_) => { + // const [ ... ] = await import(...) + // + // Array binding patterns do not really make sense for an import, + // so discard the additonal information and use fallback instead. + } + } + }; + + // We failed to find any additional context, and are therefore + // restricted to analyzing "import(...)" as a namespace import, + // because that what is returned by "import(...)". + // + // The diagnostic will be associated with "import('module-name')" + // instead of just "'module_name'" to indicate that not the + // imported module itself is forbidden, but the ways in which + // it can be imported are restricted. + visit_special_import_node( + visitor, + import_call.syntax(), + RestrictedImportVisitor::NAMESPACE_IMPORT_ALIAS, + ) +} + +fn get_context_for_import_call( + import_call: &JsImportCallExpression, +) -> Option { + let mut current = import_call.syntax().parent()?; + + while current.kind() == JsSyntaxKind::JS_PARENTHESIZED_EXPRESSION { + // #1: const { ... } = (await **(import(""))**) + // #2: **(import(""))**.then(...) + current = current.parent()?; + } + + if current.kind() == JsSyntaxKind::JS_AWAIT_EXPRESSION { + // #1: const { ... } = (**await (import(""))**) + current = current.parent()?; + + while current.kind() == JsSyntaxKind::JS_PARENTHESIZED_EXPRESSION { + // #1: const { ... } = **(await (import("")))** + current = current.parent()?; + } + } else if current.kind() == JsSyntaxKind::JS_STATIC_MEMBER_EXPRESSION { + // #2: **(import("")).then**(...) + let static_member_expr = current.cast::()?; + let member_name = static_member_expr.member().ok()?; + if member_name.as_js_name()?.syntax().text_trimmed() != "then" { + return None; + } + current = static_member_expr.syntax().parent()?; + + if current.kind() == JsSyntaxKind::JS_CALL_EXPRESSION { + // #2: **(import("")).then(...)** + let then_call_expr = current.cast::()?; + let then_call_arg = then_call_expr + .arguments() + .ok()? + .args() + .iter() + .next()? + .ok()? + .as_any_js_expression()? + .clone() + .omit_parentheses(); + + return match then_call_arg { + // then(... => ...) + AnyJsExpression::JsArrowFunctionExpression(arrow_expr) => { + match arrow_expr.parameters().ok()? { + // then(arg => ...) + AnyJsArrowFunctionParameters::AnyJsBinding(binding) => { + Some(AnyJsBindingPattern::AnyJsBinding(binding)) + } + // then ({ ... } => ...) + AnyJsArrowFunctionParameters::JsParameters(parameters) => Some( + parameters + .items() + .iter() + .next()? + .ok()? + .as_any_js_formal_parameter()? + .as_js_formal_parameter()? + .binding() + .ok()?, + ), + } + } + // then(function(...) { ... }) + AnyJsExpression::JsFunctionExpression(function_expr) => Some( + function_expr + .parameters() + .ok()? + .items() + .iter() + .next()? + .ok()? + .as_any_js_formal_parameter()? + .as_js_formal_parameter()? + .binding() + .ok()?, + ), + _ => None, + }; + } + } + + // #1: const { ... } = **(await (import("")))** + if current.kind() == JsSyntaxKind::JS_INITIALIZER_CLAUSE { + // #1: const { ... } **= (await (import("")))** + current = current.parent()?; + } else { + return None; + } + + if current.kind() == JsSyntaxKind::JS_VARIABLE_DECLARATOR { + // #1: const **{ ... } = (await (import("")))** + let variable_declarator = current.cast::()?; + + // #1: const **{ ... }** = (await (import(""))) + variable_declarator.id().ok() + } else { + None + } +} + +/// Analyze a static `import ... from ...` or `export ... from ...`declaration +/// (including all the different variants of `import` and `export`) to find the names +/// that are being imported, then validate that each of the names is allowed to be imported. +pub fn visit_import( + visitor: &mut RestrictedImportVisitor, + module_source_node: &JsModuleSource, +) -> Option<()> { + // Only certain imports are allowed/disallowed, add diagnostic to each disallowed import + let clause = module_source_node.syntax().parent()?; + match clause.kind() { + JsSyntaxKind::JS_IMPORT_BARE_CLAUSE => { + let side_effect_import: JsImportBareClause = clause.cast()?; + visit_side_effect_import(visitor, &side_effect_import) + } + JsSyntaxKind::JS_IMPORT_COMBINED_CLAUSE => { + let import_combined_clause: JsImportCombinedClause = clause.cast()?; + if let Ok(default_specifier) = import_combined_clause.default_specifier() { + visit_default_import(visitor, &default_specifier); + } + if let Ok(combined_specifier) = import_combined_clause.specifier() { + visit_combined_specifier(visitor, &combined_specifier); + } + Some(()) + } + JsSyntaxKind::JS_IMPORT_NAMED_CLAUSE => { + let import_named_clause: JsImportNamedClause = clause.cast()?; + let import_specifiers = import_named_clause.named_specifiers().ok()?; + visit_named_imports(visitor, &import_specifiers) + } + JsSyntaxKind::JS_EXPORT_NAMED_FROM_CLAUSE => { + let export_named_from_clause = clause.cast::()?; + let import_specifiers = export_named_from_clause.specifiers(); + visit_named_reexports(visitor, &import_specifiers) + } + JsSyntaxKind::JS_IMPORT_DEFAULT_CLAUSE => { + let import_default_clause: JsImportDefaultClause = clause.cast()?; + let default_specifier = import_default_clause.default_specifier().ok()?; + visit_default_import(visitor, &default_specifier) + } + JsSyntaxKind::JS_IMPORT_NAMESPACE_CLAUSE => { + let import_namespace_clause: JsImportNamespaceClause = clause.cast()?; + let namespace_specifier = import_namespace_clause.namespace_specifier().ok()?; + visit_namespace_import(visitor, &namespace_specifier) + } + JsSyntaxKind::JS_EXPORT_FROM_CLAUSE => { + let reexport_namespace_clause: JsExportFromClause = clause.cast()?; + visit_namespace_reexport(visitor, &reexport_namespace_clause) + } + _ => None, + } +} + +fn visit_combined_specifier( + visitor: &mut RestrictedImportVisitor, + combined_specifier: &AnyJsCombinedSpecifier, +) -> Option<()> { + match combined_specifier { + AnyJsCombinedSpecifier::JsNamedImportSpecifiers(named_imports) => { + visit_named_imports(visitor, named_imports) + } + AnyJsCombinedSpecifier::JsNamespaceImportSpecifier(namespace_import) => { + visit_namespace_import(visitor, namespace_import) + } + } +} + +fn visit_named_imports( + visitor: &mut RestrictedImportVisitor, + named_imports: &JsNamedImportSpecifiers, +) -> Option<()> { + let import_specifiers = named_imports.specifiers(); + for import_specifier in import_specifiers.iter().flatten() { + visit_named_or_shorthand_import(visitor, &import_specifier); + } + Some(()) +} + +fn visit_named_reexports( + visitor: &mut RestrictedImportVisitor, + named_reexports: &JsExportNamedFromSpecifierList, +) -> Option<()> { + for export_specifier in named_reexports.iter().flatten() { + visit_named_or_shorthand_reexport(visitor, &export_specifier); + } + Some(()) +} + +fn visit_named_bindings( + visitor: &mut RestrictedImportVisitor, + named_imports: &JsObjectBindingPattern, +) -> Option<()> { + let import_bindings = named_imports.properties(); + for import_binding in import_bindings.iter().flatten() { + visit_named_or_shorthand_binding(visitor, &import_binding); + } + Some(()) +} + +fn visit_named_or_shorthand_import( + visitor: &mut RestrictedImportVisitor, + import_specifier: &AnyJsNamedImportSpecifier, +) -> Option<()> { + match import_specifier { + AnyJsNamedImportSpecifier::JsShorthandNamedImportSpecifier(shorthand_import) => { + visit_shorthand_import(visitor, shorthand_import) + } + AnyJsNamedImportSpecifier::JsNamedImportSpecifier(named_import) => { + visit_named_import(visitor, named_import) + } + AnyJsNamedImportSpecifier::JsBogusNamedImportSpecifier(_) => None, + } +} + +fn visit_named_or_shorthand_binding( + visitor: &mut RestrictedImportVisitor, + import_binding: &AnyJsObjectBindingPatternMember, +) -> Option<()> { + match import_binding { + AnyJsObjectBindingPatternMember::JsObjectBindingPatternShorthandProperty( + shorthand_import, + ) => visit_shorthand_binding(visitor, shorthand_import), + AnyJsObjectBindingPatternMember::JsObjectBindingPatternProperty(named_import) => { + visit_named_binding(visitor, named_import) + } + _ => None, + } +} + +/// Checks whether this bare import of the form `import from 'source'` is allowed. +fn visit_side_effect_import( + visitor: &mut RestrictedImportVisitor, + bare_import: &JsImportBareClause, +) -> Option<()> { + let source_token = bare_import + .source() + .ok()? + .as_js_module_source()? + .value_token() + .ok()?; + visit_special_import_token( + visitor, + &source_token, + RestrictedImportVisitor::BARE_IMPORT_ALIAS, + ) +} + +/// Checks whether this import of the form `local_name` (as in `import local_name from 'source'`) is allowed. +fn visit_default_import( + visitor: &mut RestrictedImportVisitor, + default_import: &JsDefaultImportSpecifier, +) -> Option<()> { + let local_name = default_import + .local_name() + .ok()? + .as_js_identifier_binding()? + .name_token() + .ok()?; + visit_special_import_token( + visitor, + &local_name, + RestrictedImportVisitor::DEFAULT_IMPORT_ALIAS, + ) +} + +/// Checks whether this import of the form `* as local_name` is allowed. +fn visit_namespace_import( + visitor: &mut RestrictedImportVisitor, + namespace_import: &JsNamespaceImportSpecifier, +) -> Option<()> { + visit_special_import_token( + visitor, + &namespace_import.star_token().ok()?, + RestrictedImportVisitor::NAMESPACE_IMPORT_ALIAS, + ) +} + +/// Checks whether this namespace reexport of the form `export * from ...` is allowed. +fn visit_namespace_reexport( + visitor: &mut RestrictedImportVisitor, + namespace_reexport: &JsExportFromClause, +) -> Option<()> { + visit_special_import_token( + visitor, + &namespace_reexport.star_token().ok()?, + RestrictedImportVisitor::NAMESPACE_IMPORT_ALIAS, + ) +} + +/// Checks whether this import of the form `const local_name = import(...)` is allowed. +fn visit_namespace_binding( + visitor: &mut RestrictedImportVisitor, + namespace_import: &JsIdentifierBinding, +) -> Option<()> { + visit_special_import_node( + visitor, + namespace_import.syntax(), + RestrictedImportVisitor::NAMESPACE_IMPORT_ALIAS, + ) +} + +/// Checks whether this import of the form `{ imported_name }` is allowed. +fn visit_shorthand_import( + visitor: &mut RestrictedImportVisitor, + shorthand_import: &JsShorthandNamedImportSpecifier, +) -> Option<()> { + visit_imported_identifier( + visitor, + &shorthand_import + .local_name() + .ok()? + .as_js_identifier_binding()? + .name_token() + .ok()?, + ) +} + +/// Checks whether this import of the form `{ imported_name }` is allowed. +fn visit_shorthand_binding( + visitor: &mut RestrictedImportVisitor, + shorthand_import: &JsObjectBindingPatternShorthandProperty, +) -> Option<()> { + visit_imported_identifier( + visitor, + &shorthand_import + .identifier() + .ok()? + .as_js_identifier_binding()? + .name_token() + .ok()?, + ) +} + +/// Checks whether this import of the form `{ imported_name as local_name }` +/// (including `{ default as local_name }`) is allowed. +fn visit_named_import( + visitor: &mut RestrictedImportVisitor, + named_import: &JsNamedImportSpecifier, +) -> Option<()> { + visit_imported_identifier(visitor, &named_import.name().ok()?.value().ok()?) +} + +/// Checks whether this import of the form `{ imported_name }` or `{ imported_name as exported_name }` +/// (including `{ default as exported_name }`) is allowed. +fn visit_named_or_shorthand_reexport( + visitor: &mut RestrictedImportVisitor, + named_reexport: &JsExportNamedFromSpecifier, +) -> Option<()> { + visit_imported_identifier(visitor, &named_reexport.source_name().ok()?.value().ok()?) +} + +/// Checks whether this import of the form `{ imported_name: local_name }` +/// (including `{ default: local_name }` and `{ "imported name": local_name `) is allowed. +fn visit_named_binding( + visitor: &mut RestrictedImportVisitor, + named_import: &JsObjectBindingPatternProperty, +) -> Option<()> { + visit_imported_identifier( + visitor, + &named_import + .member() + .ok()? + .as_js_literal_member_name()? + .value() + .ok()?, + ) +} + +/// Checks whether the import specified by `name_token` is allowed, +/// and records a diagnostic for `name_token.text_trimmed_range()` if not. +/// +/// `name_token` can be either a string literal or an identifier. +fn visit_imported_identifier( + visitor: &mut RestrictedImportVisitor, + name_token: &SyntaxToken, +) -> Option<()> { + // TODO: inner_string_text removes quotes but does not e.g. decode escape sequences. + // If the imported name uses e.g. Unicode escape sequences, this may cause + // problems because restricted_import.(allow_)import_names contains decoded + // strings, while inner_string_text(name_token) returns encoded strings. + visit_special_import_token(visitor, name_token, inner_string_text(name_token).text()) +} + +/// Checks whether the import specified by `name_or_alias` is allowed. +/// and records a diagnostic for `import_node.text_trimmed_range()` if not. +fn visit_special_import_node( + visitor: &mut RestrictedImportVisitor, + import_node: &SyntaxNode, + name_or_alias: &str, +) -> Option<()> { + let status = visitor.restricted_import.is_import_allowed(name_or_alias); + if status.is_allowed() { + return None; + } + visitor.results.push(RestrictedImportMessage { + location: import_node.text_trimmed_range(), + message: visitor.restricted_import.get_message_for_restriction( + visitor.import_source, + name_or_alias, + status.reason(), + ), + import_source: visitor.import_source.to_string(), + allowed_import_names: visitor.restricted_import.allow_import_names.clone(), + }); + Some(()) +} + +/// Checks whether the import specified by `name_or_alias` is allowed. +/// and records a diagnostic for `import_token.text_trimmed_range()` if not. +fn visit_special_import_token( + visitor: &mut RestrictedImportVisitor, + import_token: &SyntaxToken, + name_or_alias: &str, +) -> Option<()> { + let status = visitor.restricted_import.is_import_allowed(name_or_alias); + if status.is_allowed() { + return None; + } + visitor.results.push(RestrictedImportMessage { + location: import_token.text_trimmed_range(), + message: visitor.restricted_import.get_message_for_restriction( + visitor.import_source, + name_or_alias, + status.reason(), + ), + import_source: visitor.import_source.to_string(), + allowed_import_names: visitor.restricted_import.allow_import_names.clone(), + }); + Some(()) +} diff --git a/crates/biome_js_analyze/src/lint/style/no_restricted_types.rs b/crates/biome_js_analyze/src/lint/style/no_restricted_types.rs index 8e7cedfba853..6e2bc8eb98cf 100644 --- a/crates/biome_js_analyze/src/lint/style/no_restricted_types.rs +++ b/crates/biome_js_analyze/src/lint/style/no_restricted_types.rs @@ -1,21 +1,17 @@ use crate::JsRuleAction; -use ::serde::{Deserialize, Serialize}; use biome_analyze::context::RuleContext; use biome_analyze::{Ast, FixKind, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize::{ - Deserializable, DeserializableType, DeserializableValue, DeserializationContext, -}; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::TsReferenceType; use biome_rowan::AstNode; use biome_rowan::BatchMutationExt; use biome_unicode_table::is_js_ident; -use rustc_hash::FxHashMap; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::no_restricted_types::{ + CustomRestrictedTypeOptions, NoRestrictedTypesOptions, +}; declare_lint_rule! { /// Disallow user defined types. @@ -111,71 +107,3 @@ impl Rule for NoRestrictedTypes { )) } } - -#[derive( - Clone, - Debug, - Default, - biome_deserialize_macros::Deserializable, - Deserialize, - Serialize, - Eq, - PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoRestrictedTypesOptions { - types: FxHashMap, CustomRestrictedType>, -} - -#[derive( - Debug, - Clone, - Default, - biome_deserialize_macros::Deserializable, - Deserialize, - Serialize, - Eq, - PartialEq, -)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct CustomRestrictedTypeOptions { - message: Box, - #[serde(rename = "use")] - use_instead: Option, -} - -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(untagged)] -pub enum CustomRestrictedType { - Plain(Box), - WithOptions(CustomRestrictedTypeOptions), -} - -impl From for CustomRestrictedTypeOptions { - fn from(options: CustomRestrictedType) -> Self { - match options { - CustomRestrictedType::Plain(message) => Self { - message, - use_instead: None, - }, - CustomRestrictedType::WithOptions(options) => options, - } - } -} - -impl Deserializable for CustomRestrictedType { - fn deserialize( - ctx: &mut impl DeserializationContext, - value: &impl DeserializableValue, - name: &str, - ) -> Option { - if value.visitable_type()? == DeserializableType::Str { - biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::Plain) - } else { - biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::WithOptions) - } - } -} diff --git a/crates/biome_js_analyze/src/lint/style/no_shouty_constants.rs b/crates/biome_js_analyze/src/lint/style/no_shouty_constants.rs index 6000166beb6c..c76da1184a00 100644 --- a/crates/biome_js_analyze/src/lint/style/no_shouty_constants.rs +++ b/crates/biome_js_analyze/src/lint/style/no_shouty_constants.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsVariableDeclaratorList, }; use biome_rowan::{AstNode, BatchMutationExt, SyntaxNodeCast, SyntaxToken}; +use biome_rule_options::no_shouty_constants::NoShoutyConstantsOptions; declare_lint_rule! { /// Disallow the use of constants which its value is the upper-case version of its name. @@ -91,7 +92,7 @@ impl Rule for NoShoutyConstants { type Query = Semantic; type State = State; type Signals = Option; - type Options = (); + type Options = NoShoutyConstantsOptions; fn run(ctx: &RuleContext) -> Option { let declarator = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_substr.rs b/crates/biome_js_analyze/src/lint/style/no_substr.rs index b1b9270cdee8..4a5515196b85 100644 --- a/crates/biome_js_analyze/src/lint/style/no_substr.rs +++ b/crates/biome_js_analyze/src/lint/style/no_substr.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsName, JsCallArguments, JsExpressionStatement, JsSyntaxToken, JsVariableStatement, }; use biome_rowan::{AstSeparatedList, BatchMutationExt, TextRange, TokenText, declare_node_union}; +use biome_rule_options::no_substr::NoSubstrOptions; use crate::JsRuleAction; @@ -55,7 +56,7 @@ impl Rule for NoSubstr { type Query = Ast; type State = NoSubstrState; type Signals = Option; - type Options = (); + type Options = NoSubstrOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_unused_template_literal.rs b/crates/biome_js_analyze/src/lint/style/no_unused_template_literal.rs index b24f5ba6ab5e..9bd91a880ff5 100644 --- a/crates/biome_js_analyze/src/lint/style/no_unused_template_literal.rs +++ b/crates/biome_js_analyze/src/lint/style/no_unused_template_literal.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsExpression, AnyJsLiteralExpression, AnyJsTemplateElement, JsTemplateExpression, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::no_unused_template_literal::NoUnusedTemplateLiteralOptions; declare_lint_rule! { /// Disallow template literals if interpolation and special-character handling are not needed @@ -52,7 +53,7 @@ impl Rule for NoUnusedTemplateLiteral { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUnusedTemplateLiteralOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/no_useless_else.rs b/crates/biome_js_analyze/src/lint/style/no_useless_else.rs index 6f4b726876d8..f1d83a6b35e2 100644 --- a/crates/biome_js_analyze/src/lint/style/no_useless_else.rs +++ b/crates/biome_js_analyze/src/lint/style/no_useless_else.rs @@ -11,6 +11,7 @@ use biome_rowan::{ AstNode, AstNodeList, BatchMutationExt, SyntaxNodeOptionExt, chain_trivia_pieces, trim_leading_trivia_pieces, }; +use biome_rule_options::no_useless_else::NoUselessElseOptions; use crate::JsRuleAction; @@ -102,7 +103,7 @@ impl Rule for NoUselessElse { type Query = Ast; type State = JsIfStatement; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoUselessElseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut result = Vec::new(); diff --git a/crates/biome_js_analyze/src/lint/style/no_yoda_expression.rs b/crates/biome_js_analyze/src/lint/style/no_yoda_expression.rs index ca6f3562b72b..0c4d4a08e0c9 100644 --- a/crates/biome_js_analyze/src/lint/style/no_yoda_expression.rs +++ b/crates/biome_js_analyze/src/lint/style/no_yoda_expression.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsYieldExpression, T, }; use biome_rowan::{AstNode, BatchMutationExt, NodeOrToken, SyntaxTriviaPiece, TriviaPieceKind}; +use biome_rule_options::no_yoda_expression::NoYodaExpressionOptions; declare_lint_rule! { /// Disallow the use of yoda expressions. @@ -74,7 +75,7 @@ impl Rule for NoYodaExpression { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoYodaExpressionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_array_literals.rs b/crates/biome_js_analyze/src/lint/style/use_array_literals.rs index 8e7ec4933723..fc5522a9d694 100644 --- a/crates/biome_js_analyze/src/lint/style/use_array_literals.rs +++ b/crates/biome_js_analyze/src/lint/style/use_array_literals.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsNewOrCallExpression, JsSyntaxKind, JsVariableDeclarator, T, global_identifier, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::use_array_literals::UseArrayLiteralsOptions; use crate::{JsRuleAction, services::semantic::Semantic}; @@ -70,7 +71,7 @@ impl Rule for UseArrayLiterals { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseArrayLiteralsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_as_const_assertion.rs b/crates/biome_js_analyze/src/lint/style/use_as_const_assertion.rs index 0b47365b3d84..39dfb3aa93d8 100644 --- a/crates/biome_js_analyze/src/lint/style/use_as_const_assertion.rs +++ b/crates/biome_js_analyze/src/lint/style/use_as_const_assertion.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ TsTypeAssertionExpression, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, declare_node_union}; +use biome_rule_options::use_as_const_assertion::UseAsConstAssertionOptions; declare_lint_rule! { /// Enforce the use of `as const` over literal type and type annotation. @@ -70,7 +71,7 @@ impl Rule for UseAsConstAssertion { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseAsConstAssertionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_at_index.rs b/crates/biome_js_analyze/src/lint/style/use_at_index.rs index 954c1d5ba6e7..8a26431e5926 100644 --- a/crates/biome_js_analyze/src/lint/style/use_at_index.rs +++ b/crates/biome_js_analyze/src/lint/style/use_at_index.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsStaticMemberExpression, JsUnaryExpression, T, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, declare_node_union}; +use biome_rule_options::use_at_index::UseAtIndexOptions; declare_lint_rule! { /// Use `at()` instead of integer index access. @@ -127,7 +128,7 @@ impl Rule for UseAtIndex { type Query = Ast; type State = UseAtIndexState; type Signals = Option; - type Options = (); + type Options = UseAtIndexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let exp = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_block_statements.rs b/crates/biome_js_analyze/src/lint/style/use_block_statements.rs index 9c24c9982202..69cd7e7b022e 100644 --- a/crates/biome_js_analyze/src/lint/style/use_block_statements.rs +++ b/crates/biome_js_analyze/src/lint/style/use_block_statements.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsForStatement, JsIfStatement, JsLanguage, JsSyntaxTrivia, JsWhileStatement, JsWithStatement, T, TriviaPieceKind, }; +use biome_rule_options::use_block_statements::UseBlockStatementsOptions; use biome_rowan::{AstNode, BatchMutationExt, SyntaxTriviaPiece, declare_node_union}; @@ -82,7 +83,7 @@ impl Rule for UseBlockStatements { type Query = Ast; type State = UseBlockStatementsOperationType; type Signals = Option; - type Options = (); + type Options = UseBlockStatementsOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_collapsed_else_if.rs b/crates/biome_js_analyze/src/lint/style/use_collapsed_else_if.rs index 8141439b7aad..34fd8f1decbb 100644 --- a/crates/biome_js_analyze/src/lint/style/use_collapsed_else_if.rs +++ b/crates/biome_js_analyze/src/lint/style/use_collapsed_else_if.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsStatement, JsBlockStatement, JsElseClause, JsIfStatement}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::use_collapsed_else_if::UseCollapsedElseIfOptions; declare_lint_rule! { /// Enforce using `else if` instead of nested `if` in `else` clauses. @@ -103,7 +104,7 @@ impl Rule for UseCollapsedElseIf { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseCollapsedElseIfOptions; fn run(ctx: &RuleContext) -> Self::Signals { let else_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_collapsed_if.rs b/crates/biome_js_analyze/src/lint/style/use_collapsed_if.rs index f56e3816ac2d..f31619ef5d0c 100644 --- a/crates/biome_js_analyze/src/lint/style/use_collapsed_if.rs +++ b/crates/biome_js_analyze/src/lint/style/use_collapsed_if.rs @@ -8,6 +8,7 @@ use biome_js_factory::make; use biome_js_syntax::parentheses::NeedsParentheses; use biome_js_syntax::{AnyJsStatement, JsIfStatement, T}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::use_collapsed_if::UseCollapsedIfOptions; use crate::JsRuleAction; @@ -87,7 +88,7 @@ impl Rule for UseCollapsedIf { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseCollapsedIfOptions; fn run(ctx: &RuleContext) -> Self::Signals { let if_stmt = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_component_export_only_modules.rs b/crates/biome_js_analyze/src/lint/style/use_component_export_only_modules.rs index 77886591fa89..f912077599e9 100644 --- a/crates/biome_js_analyze/src/lint/style/use_component_export_only_modules.rs +++ b/crates/biome_js_analyze/src/lint/style/use_component_export_only_modules.rs @@ -3,12 +3,11 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsModuleItem, AnyJsStatement, JsModule, export_ext::AnyJsExported}; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::use_component_export_only_modules::UseComponentExportOnlyModulesOptions; use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; declare_lint_rule! { /// Enforce declaring components only within modules that export React Components exclusively. @@ -106,19 +105,6 @@ declare_lint_rule! { severity: Severity::Warning, } } - -#[derive(Debug, Clone, Deserialize, Deserializable, Eq, PartialEq, Serialize, Default)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseComponentExportOnlyModulesOptions { - /// Allows the export of constants. This option is for environments that support it, such as [Vite](https://vitejs.dev/) - #[serde(default)] - allow_constant_export: bool, - /// A list of names that can be additionally exported from the module This option is for exports that do not hinder [React Fast Refresh](https://github.com/facebook/react/tree/main/packages/react-refresh), such as [`meta` in Remix](https://remix.run/docs/en/main/route/meta) - #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - allow_export_names: Box<[Box]>, -} - enum ErrorType { ExportedNonComponentWithComponent, UnexportedComponent, diff --git a/crates/biome_js_analyze/src/lint/style/use_consistent_array_type.rs b/crates/biome_js_analyze/src/lint/style/use_consistent_array_type.rs index 7bdfa2339e9a..be419edd9921 100644 --- a/crates/biome_js_analyze/src/lint/style/use_consistent_array_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_consistent_array_type.rs @@ -3,7 +3,6 @@ use biome_analyze::{ Ast, FixKind, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::{Markup, MarkupBuf, markup}; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{ @@ -11,10 +10,9 @@ use biome_js_syntax::{ TsTypeArguments, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxNodeOptionExt, TriviaPiece}; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use std::str::FromStr; +use biome_rule_options::use_consistent_array_type::{ + ConsistentArrayType, UseConsistentArrayTypeOptions, +}; declare_lint_rule! { /// Require consistently using either `T[]` or `Array` @@ -95,7 +93,7 @@ impl Rule for UseConsistentArrayType { type Query = Ast; type State = AnyTsType; type Signals = Option; - type Options = ConsistentArrayTypeOptions; + type Options = UseConsistentArrayTypeOptions; fn run(ctx: &RuleContext) -> Option { let query = ctx.query(); @@ -477,33 +475,3 @@ where .build(), ) } - -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct ConsistentArrayTypeOptions { - pub syntax: ConsistentArrayType, -} - -#[derive(Clone, Copy, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase")] -pub enum ConsistentArrayType { - /// `ItemType[]` - #[default] - Shorthand, - /// `Array` - Generic, -} - -impl FromStr for ConsistentArrayType { - type Err = &'static str; - - fn from_str(s: &str) -> Result { - match s { - "shorthand" => Ok(Self::Shorthand), - "generic" => Ok(Self::Generic), - _ => Err("Value not supported for array type syntax"), - } - } -} diff --git a/crates/biome_js_analyze/src/lint/style/use_consistent_builtin_instantiation.rs b/crates/biome_js_analyze/src/lint/style/use_consistent_builtin_instantiation.rs index b5492559726d..cb5ba820a475 100644 --- a/crates/biome_js_analyze/src/lint/style/use_consistent_builtin_instantiation.rs +++ b/crates/biome_js_analyze/src/lint/style/use_consistent_builtin_instantiation.rs @@ -12,6 +12,7 @@ use biome_js_syntax::{ AnyJsExpression, JsNewOrCallExpression, global_identifier, static_value::StaticValue, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_consistent_builtin_instantiation::UseConsistentBuiltinInstantiationOptions; use crate::lint::style::use_throw_new_error::convert_call_expression_to_new_expression; @@ -88,7 +89,7 @@ impl Rule for UseConsistentBuiltinInstantiation { type Query = Semantic; type State = UseConsistentBuiltinInstantiationState; type Signals = Option; - type Options = (); + type Options = UseConsistentBuiltinInstantiationOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs b/crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs index 000b04484a38..aad5751887c6 100644 --- a/crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs +++ b/crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsxChildList, JsxExpressionAttributeValue, T, }; use biome_rowan::{AstNode, BatchMutationExt, TextRange, TriviaPiece, declare_node_union}; +use biome_rule_options::use_consistent_curly_braces::UseConsistentCurlyBracesOptions; use crate::JsRuleAction; @@ -83,7 +84,7 @@ impl Rule for UseConsistentCurlyBraces { type Query = Ast; type State = CurlyBraceResolution; type Signals = Option; - type Options = (); + type Options = UseConsistentCurlyBracesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_consistent_member_accessibility.rs b/crates/biome_js_analyze/src/lint/style/use_consistent_member_accessibility.rs index c411f689a1f8..e21bcd225146 100644 --- a/crates/biome_js_analyze/src/lint/style/use_consistent_member_accessibility.rs +++ b/crates/biome_js_analyze/src/lint/style/use_consistent_member_accessibility.rs @@ -2,7 +2,6 @@ use biome_analyze::{ Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsClassMemberName, JsConstructorClassMember, JsGetterClassMember, JsMethodClassMember, @@ -11,7 +10,9 @@ use biome_js_syntax::{ TsPropertyParameter, TsPropertySignatureClassMember, TsSetterSignatureClassMember, }; use biome_rowan::{AstNode, TextRange, declare_node_union}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::use_consistent_member_accessibility::{ + Accessibility, UseConsistentMemberAccessibilityOptions, +}; declare_lint_rule! { /// Require consistent accessibility modifiers on class properties and methods. @@ -324,28 +325,11 @@ declare_lint_rule! { } } -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct ConsistentMemberAccessibilityOptions { - pub accessibility: Accessibility, -} - -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum Accessibility { - #[default] - NoPublic, - Explicit, - None, -} - impl Rule for UseConsistentMemberAccessibility { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = ConsistentMemberAccessibilityOptions; + type Options = UseConsistentMemberAccessibilityOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_const.rs b/crates/biome_js_analyze/src/lint/style/use_const.rs index c3f97e61ca21..74222059c369 100644 --- a/crates/biome_js_analyze/src/lint/style/use_const.rs +++ b/crates/biome_js_analyze/src/lint/style/use_const.rs @@ -12,6 +12,7 @@ use biome_js_factory::make; use biome_js_semantic::{ReferencesExtensions, Scope, SemanticModel, SemanticScopeExtensions}; use biome_js_syntax::*; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::use_const::UseConstOptions; declare_lint_rule! { /// Require `const` declarations for variables that are only assigned once. @@ -88,7 +89,7 @@ impl Rule for UseConst { type Query = Semantic; type State = ConstBindings; type Signals = Option; - type Options = (); + type Options = UseConstOptions; fn run(ctx: &RuleContext) -> Self::Signals { let declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_default_parameter_last.rs b/crates/biome_js_analyze/src/lint/style/use_default_parameter_last.rs index d711e03679c8..ada74c8e6652 100644 --- a/crates/biome_js_analyze/src/lint/style/use_default_parameter_last.rs +++ b/crates/biome_js_analyze/src/lint/style/use_default_parameter_last.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsFormalParameter, JsInitializerClause, JsSyntaxToken, TsPropertyParameter}; use biome_rowan::{AstNode, BatchMutationExt, Direction, declare_node_union}; +use biome_rule_options::use_default_parameter_last::UseDefaultParameterLastOptions; use crate::JsRuleAction; @@ -98,7 +99,7 @@ impl Rule for UseDefaultParameterLast { type Query = Ast; type State = AnyFormalParameter; type Signals = Option; - type Options = (); + type Options = UseDefaultParameterLastOptions; fn run(ctx: &RuleContext) -> Self::Signals { let formal_param = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_default_switch_clause.rs b/crates/biome_js_analyze/src/lint/style/use_default_switch_clause.rs index 8086836eae0c..5b5fa3ac2274 100644 --- a/crates/biome_js_analyze/src/lint/style/use_default_switch_clause.rs +++ b/crates/biome_js_analyze/src/lint/style/use_default_switch_clause.rs @@ -7,6 +7,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsSwitchStatement; use biome_rowan::AstNode; +use biome_rule_options::use_default_switch_clause::UseDefaultSwitchClauseOptions; declare_lint_rule! { /// Require the default clause in switch statements. @@ -53,7 +54,7 @@ impl Rule for UseDefaultSwitchClause { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseDefaultSwitchClauseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_enum_initializers.rs b/crates/biome_js_analyze/src/lint/style/use_enum_initializers.rs index 36f3c15a3cf0..79253fe02acc 100644 --- a/crates/biome_js_analyze/src/lint/style/use_enum_initializers.rs +++ b/crates/biome_js_analyze/src/lint/style/use_enum_initializers.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, AnyJsLiteralExpression, JsSyntaxKind, TsEnumDeclaration}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_enum_initializers::UseEnumInitializersOptions; declare_lint_rule! { /// Require that each enum member value be explicitly initialized. @@ -81,7 +82,7 @@ impl Rule for UseEnumInitializers { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseEnumInitializersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let enum_declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_explicit_length_check.rs b/crates/biome_js_analyze/src/lint/style/use_explicit_length_check.rs index 86f4c1edc438..23b7480b62cb 100644 --- a/crates/biome_js_analyze/src/lint/style/use_explicit_length_check.rs +++ b/crates/biome_js_analyze/src/lint/style/use_explicit_length_check.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ is_in_boolean_context, is_negation, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, TokenText}; +use biome_rule_options::use_explicit_length_check::UseExplicitLengthCheckOptions; use crate::JsRuleAction; @@ -139,7 +140,7 @@ impl Rule for UseExplicitLengthCheck { type Query = Ast; type State = UseExplicitLengthCheckState; type Signals = Option; - type Options = (); + type Options = UseExplicitLengthCheckOptions; fn run(ctx: &RuleContext) -> Self::Signals { let member_expr = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_exponentiation_operator.rs b/crates/biome_js_analyze/src/lint/style/use_exponentiation_operator.rs index 9db30bab213a..bc814b931192 100644 --- a/crates/biome_js_analyze/src/lint/style/use_exponentiation_operator.rs +++ b/crates/biome_js_analyze/src/lint/style/use_exponentiation_operator.rs @@ -14,6 +14,7 @@ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutationExt, SyntaxResult, chain_trivia_pieces, trim_leading_trivia_pieces, }; +use biome_rule_options::use_exponentiation_operator::UseExponentiationOperatorOptions; declare_lint_rule! { /// Disallow the use of `Math.pow` in favor of the `**` operator. @@ -68,7 +69,7 @@ impl Rule for UseExponentiationOperator { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseExponentiationOperatorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_export_type.rs b/crates/biome_js_analyze/src/lint/style/use_export_type.rs index e015d20e76e9..d5562316f372 100644 --- a/crates/biome_js_analyze/src/lint/style/use_export_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_export_type.rs @@ -13,6 +13,7 @@ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutationExt, TriviaPieceKind, chain_trivia_pieces, declare_node_union, trim_leading_trivia_pieces, }; +use biome_rule_options::use_export_type::UseExportTypeOptions; declare_lint_rule! { /// Promotes the use of `export type` for types. @@ -75,7 +76,7 @@ impl Rule for UseExportType { type Query = Semantic; type State = ExportTypeFix; type Signals = Option; - type Options = (); + type Options = UseExportTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::(); diff --git a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs index 0bf371835958..2bc52811d364 100644 --- a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs +++ b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs @@ -1,16 +1,14 @@ -use crate::{services::semantic::SemanticServices, utils::restricted_regex::RestrictedRegex}; +use crate::services::semantic::SemanticServices; use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule}; use biome_console::markup; -use biome_deserialize::DeserializationContext; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsIdentifierUsage, JsExportNamedSpecifier, binding_ext::AnyJsIdentifierBinding, }; use biome_rowan::{AstNode, TextRange}; -use biome_string_case::{Case, Cases}; +use biome_rule_options::use_filenaming_convention::UseFilenamingConventionOptions; +use biome_string_case::Case; use smallvec::SmallVec; -use std::{hash::Hash, str::FromStr}; declare_lint_rule! { /// Enforce naming conventions for JavaScript and TypeScript filenames. @@ -152,7 +150,7 @@ impl Rule for UseFilenamingConvention { type Query = SemanticServices; type State = FileNamingConventionState; type Signals = Option; - type Options = Box; + type Options = UseFilenamingConventionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let file_name = ctx.file_path().file_name()?; @@ -393,215 +391,3 @@ pub enum FileNamingConventionState { /// The filename doesn't match the provided regex Match, } - -/// Rule's options. -#[derive(Clone, Debug, serde::Deserialize, Deserializable, Eq, PartialEq, serde::Serialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct FilenamingConventionOptions { - /// If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. - /// This does not affect other [Case]. - #[serde(default = "enabled", skip_serializing_if = "bool::clone")] - pub strict_case: bool, - - /// If `false`, then non-ASCII characters are allowed. - #[serde(default = "enabled", skip_serializing_if = "bool::clone")] - pub require_ascii: bool, - - /// Regular expression to enforce - #[serde(default, rename = "match", skip_serializing_if = "Option::is_none")] - pub matching: Option, - - /// Allowed cases for file names. - #[serde(default, skip_serializing_if = "is_default")] - pub filename_cases: FilenameCases, -} - -const fn enabled() -> bool { - true -} - -fn is_default(value: &T) -> bool { - value == &T::default() -} - -impl Default for FilenamingConventionOptions { - fn default() -> Self { - Self { - strict_case: true, - require_ascii: true, - matching: None, - filename_cases: FilenameCases::default(), - } - } -} - -#[derive( - Clone, Copy, Debug, Deserializable, Eq, Hash, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[serde( - from = "SmallVec<[FilenameCase; 5]>", - into = "SmallVec<[FilenameCase; 5]>" -)] -#[deserializable(with_validator)] -pub struct FilenameCases { - cases: Cases, - /// `true` is the filename can be equal to the name of an export. - allow_export: bool, -} -impl From> for FilenameCases { - fn from(values: SmallVec<[FilenameCase; 5]>) -> Self { - Self::from_iter(values) - } -} -impl FromIterator for FilenameCases { - fn from_iter>(values: T) -> Self { - let mut result = Self { - cases: Cases::empty(), - allow_export: false, - }; - for filename_case in values { - if let Ok(case) = Case::try_from(filename_case) { - result.cases |= case; - } else { - result.allow_export = true; - } - } - result - } -} -impl From for SmallVec<[FilenameCase; 5]> { - fn from(value: FilenameCases) -> Self { - let maybe_export = if value.allow_export { - &[FilenameCase::Export][..] - } else { - &[] - }; - value - .cases - .into_iter() - .filter_map(|case| FilenameCase::try_from(case).ok()) - .chain(maybe_export.iter().copied()) - .collect() - } -} -#[cfg(feature = "schemars")] -impl schemars::JsonSchema for FilenameCases { - fn schema_name() -> String { - "FilenameCases".to_string() - } - fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { - >::json_schema(generator) - } -} -impl Default for FilenameCases { - fn default() -> Self { - Self { - cases: Case::Camel | Case::Kebab | Case::Snake, - allow_export: true, - } - } -} - -impl biome_deserialize::DeserializableValidator for FilenameCases { - fn validate( - &mut self, - ctx: &mut impl DeserializationContext, - name: &str, - range: TextRange, - ) -> bool { - if !self.allow_export && self.cases.is_empty() { - ctx.report( - biome_deserialize::DeserializationDiagnostic::new(markup! { - ""{name}" cannot be an empty array." - }) - .with_range(range), - ); - false - } else { - true - } - } -} - -/// Supported cases for file names. -#[derive( - Clone, Copy, Debug, serde::Deserialize, Deserializable, Eq, Hash, PartialEq, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub enum FilenameCase { - /// camelCase - #[serde(rename = "camelCase")] - Camel, - - /// Match an export name - #[serde(rename = "export")] - Export, - - /// kebab-case - #[serde(rename = "kebab-case")] - Kebab, - - /// PascalCase - #[serde(rename = "PascalCase")] - Pascal, - - /// snake_case - #[serde(rename = "snake_case")] - Snake, -} -impl FilenameCase { - pub const ALLOWED_VARIANTS: &'static [&'static str] = &[ - "camelCase", - "export", - "kebab-case", - "PascalCase", - "snake_case", - ]; -} -impl FromStr for FilenameCase { - type Err = &'static str; - - fn from_str(s: &str) -> Result { - match s { - "camelCase" => Ok(Self::Camel), - "export" => Ok(Self::Export), - "kebab-case" => Ok(Self::Kebab), - "PascalCase" => Ok(Self::Pascal), - "snake_case" => Ok(Self::Snake), - _ => Err("Value not supported for enum member case"), - } - } -} -impl TryFrom for Case { - type Error = &'static str; - - fn try_from(case: FilenameCase) -> Result { - match case { - FilenameCase::Camel => Ok(Self::Camel), - FilenameCase::Export => Err("`export` is not a valid case"), - FilenameCase::Kebab => Ok(Self::Kebab), - FilenameCase::Pascal => Ok(Self::Pascal), - FilenameCase::Snake => Ok(Self::Snake), - } - } -} -impl TryFrom for FilenameCase { - type Error = &'static str; - - fn try_from(value: Case) -> Result { - match value { - Case::Camel => Ok(Self::Camel), - Case::Kebab => Ok(Self::Kebab), - Case::Pascal => Ok(Self::Pascal), - Case::Snake => Ok(Self::Snake), - Case::Constant - | Case::Lower - | Case::Number - | Case::NumberableCapital - | Case::Uni - | Case::Upper - | Case::Unknown => Err("Unsupported case"), - } - } -} diff --git a/crates/biome_js_analyze/src/lint/style/use_for_of.rs b/crates/biome_js_analyze/src/lint/style/use_for_of.rs index 5da5393cef33..9ee88c81473c 100644 --- a/crates/biome_js_analyze/src/lint/style/use_for_of.rs +++ b/crates/biome_js_analyze/src/lint/style/use_for_of.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsVariableDeclarator, }; use biome_rowan::{AstNode, AstSeparatedList, TextRange, declare_node_union}; +use biome_rule_options::use_for_of::UseForOfOptions; use crate::{services::semantic::Semantic, utils::is_node_equal}; @@ -72,7 +73,7 @@ impl Rule for UseForOf { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseForOfOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_fragment_syntax.rs b/crates/biome_js_analyze/src/lint/style/use_fragment_syntax.rs index ff7b0bbe46f4..922fe797b5b9 100644 --- a/crates/biome_js_analyze/src/lint/style/use_fragment_syntax.rs +++ b/crates/biome_js_analyze/src/lint/style/use_fragment_syntax.rs @@ -10,6 +10,7 @@ use biome_js_factory::make::{ }; use biome_js_syntax::{AnyJsxElementName, JsxElement}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt}; +use biome_rule_options::use_fragment_syntax::UseFragmentSyntaxOptions; declare_lint_rule! { /// This rule enforces the use of `<>...` over `...`. @@ -42,7 +43,7 @@ impl Rule for UseFragmentSyntax { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseFragmentSyntaxOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_import_type.rs b/crates/biome_js_analyze/src/lint/style/use_import_type.rs index 4ad655b68736..7ad0fbd2df94 100644 --- a/crates/biome_js_analyze/src/lint/style/use_import_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_import_type.rs @@ -22,6 +22,7 @@ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutation, BatchMutationExt, SyntaxElement, SyntaxResult, TriviaPieceKind, chain_trivia_pieces, trim_leading_trivia_pieces, trim_trailing_trivia_pieces, }; +use biome_rule_options::use_import_type::{Style, UseImportTypeOptions}; use rustc_hash::FxHashSet; declare_lint_rule! { @@ -165,7 +166,7 @@ impl Rule for UseImportType { type Query = Semantic; type State = ImportTypeFix; type Signals = Option; - type Options = ImportTypeOptions; + type Options = UseImportTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::(); @@ -774,25 +775,7 @@ impl Rule for UseImportType { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ImportTypeOptions { - pub style: Style, -} - -/// Rule's options. -#[derive( - Debug, Default, Copy, Clone, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum Style { - /// Use the best fitting style according to the situation - #[default] - Auto, - /// Always use inline type keywords - InlineType, - /// Always separate types in a dedicated `import type` - SeparatedType, -} +pub struct ImportTypeOptions {} #[derive(Debug)] pub enum ImportTypeFix { diff --git a/crates/biome_js_analyze/src/lint/style/use_literal_enum_members.rs b/crates/biome_js_analyze/src/lint/style/use_literal_enum_members.rs index d2341c557761..54deae0cd372 100644 --- a/crates/biome_js_analyze/src/lint/style/use_literal_enum_members.rs +++ b/crates/biome_js_analyze/src/lint/style/use_literal_enum_members.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ TsEnumDeclaration, }; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::use_literal_enum_members::UseLiteralEnumMembersOptions; use rustc_hash::FxHashSet; declare_lint_rule! { @@ -78,7 +79,7 @@ impl Rule for UseLiteralEnumMembers { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = UseLiteralEnumMembersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let enum_declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs b/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs index 7f44b37fd2f1..be9a5c53b87a 100644 --- a/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs +++ b/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs @@ -1,32 +1,23 @@ -use std::ops::{Deref, Range}; +use std::ops::Range; use crate::{ JsRuleAction, lint::correctness::no_unused_variables::is_unused, services::{control_flow::AnyJsControlFlowRoot, semantic::Semantic}, - utils::{ - rename::{AnyJsRenamableDeclaration, RenameSymbolExtensions}, - restricted_regex::RestrictedRegex, - }, + utils::rename::{AnyJsRenamableDeclaration, RenameSymbolExtensions}, }; use biome_analyze::{ FixKind, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize::{ - DeserializableValidator, DeserializationContext, DeserializationDiagnostic, -}; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_semantic::{CanBeImportedExported, SemanticModel}; use biome_js_syntax::{ AnyJsClassMember, AnyJsObjectMember, AnyJsVariableDeclaration, AnyTsTypeMember, JsFileSource, - JsIdentifierBinding, JsLiteralExportName, JsLiteralMemberName, JsMethodModifierList, - JsModuleItemList, JsPrivateClassMemberName, JsPropertyModifierList, - JsShorthandPropertyObjectMember, JsSyntaxKind, JsSyntaxToken, JsVariableDeclarator, - JsVariableKind, Modifier, TsDeclarationModule, TsIdentifierBinding, - TsIndexSignatureModifierList, TsLiteralEnumMemberName, TsMethodSignatureModifierList, - TsPropertySignatureModifierList, TsTypeParameterName, + JsIdentifierBinding, JsLiteralExportName, JsLiteralMemberName, JsModuleItemList, + JsPrivateClassMemberName, JsShorthandPropertyObjectMember, JsSyntaxKind, JsSyntaxToken, + JsVariableDeclarator, JsVariableKind, Modifier, TsDeclarationModule, TsIdentifierBinding, + TsLiteralEnumMemberName, TsTypeParameterName, binding_ext::{AnyJsBindingDeclaration, AnyJsIdentifierBinding}, }; use biome_rowan::{ @@ -37,8 +28,10 @@ use biome_unicode_table::is_js_ident; use enumflags2::BitFlags; use smallvec::SmallVec; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +pub use biome_rule_options::use_naming_convention::{ + Convention, Formats, Kind, RestrictedModifier, RestrictedModifiers, Scope, Selector, + UseNamingConventionOptions, +}; declare_lint_rule! { /// Enforce naming conventions for everything across a codebase. @@ -746,7 +739,7 @@ impl Rule for UseNamingConvention { type Query = Semantic; type State = State; type Signals = Option; - type Options = NamingConventionOptions; + type Options = UseNamingConventionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); @@ -781,7 +774,7 @@ impl Rule for UseNamingConvention { suggestion: Suggestion::Ascii, }); } - let node_selector = Selector::from_name(node)?; + let node_selector = selector_from_name(node)?; let mut is_not_trimmed = true; for convention in options .conventions @@ -829,7 +822,7 @@ impl Rule for UseNamingConvention { }); } } - let default_convention = node_selector.default_convention(); + let default_convention = default_convention(node_selector); // We only tim the name if it was not trimmed yet if is_not_trimmed { let (prefix_len, trimmed_name) = trim_underscore_dollar(name); @@ -1102,352 +1095,113 @@ fn renamable( } } -/// Rule's options. -#[derive(Debug, Clone, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct NamingConventionOptions { - /// If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. - /// This does not affect other [Case]. - #[serde(default = "enabled", skip_serializing_if = "bool::clone")] - pub strict_case: bool, - - /// If `false`, then non-ASCII characters are allowed. - #[serde(default = "enabled", skip_serializing_if = "bool::clone")] - pub require_ascii: bool, - - /// Custom conventions. - #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub conventions: Box<[Convention]>, -} -impl Default for NamingConventionOptions { - fn default() -> Self { - Self { - strict_case: true, - require_ascii: true, - conventions: Vec::new().into_boxed_slice(), +fn selector_from_name(js_name: &AnyIdentifierBindingLike) -> Option { + match js_name { + AnyIdentifierBindingLike::JsIdentifierBinding(binding) => { + selector_from_binding_declaration(&binding.declaration()?) } - } -} - -const fn enabled() -> bool { - true -} -fn is_default(value: &T) -> bool { - value == &T::default() -} - -#[derive( - Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(deny_unknown_fields)] -#[deserializable(with_validator)] -pub struct Convention { - /// Declarations concerned by this convention - #[serde(default, skip_serializing_if = "is_default")] - pub selector: Selector, - - /// Regular expression to enforce - #[serde(default, rename = "match", skip_serializing_if = "Option::is_none")] - pub matching: Option, - - /// String cases to enforce - #[serde(default, skip_serializing_if = "is_default")] - pub formats: Formats, -} - -impl DeserializableValidator for Convention { - fn validate( - &mut self, - ctx: &mut impl DeserializationContext, - _name: &str, - range: biome_rowan::TextRange, - ) -> bool { - if self.formats.is_empty() && self.matching.is_none() { - ctx.report( - DeserializationDiagnostic::new( - "At least one field among `formats` and `match` must be set.", - ) - .with_range(range), - ); - false - } else { - true + AnyIdentifierBindingLike::TsIdentifierBinding(binding) => { + selector_from_binding_declaration(&binding.declaration()?) } - } -} - -#[derive(Copy, Clone, Debug)] -pub enum InvalidSelector { - IncompatibleModifiers(Modifier, Modifier), - UnsupportedModifiers(Kind, Modifier), - UnsupportedScope(Kind, Scope), -} -impl std::error::Error for InvalidSelector {} -impl std::fmt::Display for InvalidSelector { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::IncompatibleModifiers(modifier1, modifier2) => { - write!( - f, - "The `{modifier1}` and `{modifier2}` modifiers cannot be used together.", - ) - } - Self::UnsupportedModifiers(kind, modifier) => { - write!( - f, - "The `{modifier}` modifier cannot be used with the `{kind}` kind." - ) + AnyIdentifierBindingLike::JsLiteralMemberName(member_name) => { + if let Some(member) = member_name.parent::() { + selector_from_class_member(&member) + } else if let Some(member) = member_name.parent::() { + selector_from_type_member(&member) + } else if let Some(member) = member_name.parent::() { + selector_from_object_member(&member) + } else { + None } - Self::UnsupportedScope(kind, scope) => { - let scope = scope.to_string(); - let scope = scope.trim_end(); - write!( - f, - "The `{scope}` scope cannot be used with the `{kind}` kind." - ) + } + AnyIdentifierBindingLike::JsShorthandPropertyObjectMember(_) => { + Some(Kind::ObjectLiteralProperty.into()) + } + AnyIdentifierBindingLike::JsPrivateClassMemberName(member_name) => { + selector_from_class_member(&member_name.parent::()?) + } + AnyIdentifierBindingLike::JsLiteralExportName(export_name) => { + let parent = export_name.syntax().parent()?; + match parent.kind() { + JsSyntaxKind::JS_NAMED_IMPORT_SPECIFIER + | JsSyntaxKind::JS_EXPORT_NAMED_FROM_SPECIFIER => None, + JsSyntaxKind::JS_EXPORT_NAMED_SPECIFIER => Some(Kind::ExportAlias.into()), + JsSyntaxKind::JS_EXPORT_AS_CLAUSE => { + if parent.parent()?.kind() == JsSyntaxKind::JS_EXPORT_FROM_CLAUSE { + Some(Kind::ExportNamespace.into()) + } else { + Some(Kind::ExportAlias.into()) + } + } + _ => None, } } + AnyIdentifierBindingLike::TsLiteralEnumMemberName(_) => Some(Kind::EnumMember.into()), + AnyIdentifierBindingLike::TsTypeParameterName(_) => Some(Kind::TypeParameter.into()), } } -#[derive( - Clone, Copy, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[deserializable(with_validator)] -#[serde(deny_unknown_fields)] -pub struct Selector { - /// Declaration kind - #[serde(default, skip_serializing_if = "is_default")] - pub kind: Kind, - - /// Modifiers used on the declaration - #[serde(default, skip_serializing_if = "is_default")] - pub modifiers: Modifiers, - - /// Scope of the declaration - #[serde(default, skip_serializing_if = "is_default")] - pub scope: Scope, -} - -impl Selector { - /// Returns an error if the current selector is not valid. - pub fn check(self) -> Result<(), InvalidSelector> { - if self.modifiers.contains(Modifier::Abstract) { - if self.kind != Kind::Class && !Kind::ClassMember.contains(self.kind) { - return Err(InvalidSelector::UnsupportedModifiers( - self.kind, - Modifier::Abstract, - )); - } - if self.modifiers.contains(Modifier::Static) { - return Err(InvalidSelector::IncompatibleModifiers( - Modifier::Abstract, - Modifier::Static, - )); - } +fn selector_from_class_member(member: &AnyJsClassMember) -> Option { + let (kind, modifiers): (_, BitFlags<_>) = match member { + AnyJsClassMember::JsBogusMember(_) + | AnyJsClassMember::JsMetavariable(_) + | AnyJsClassMember::JsConstructorClassMember(_) + | AnyJsClassMember::TsConstructorSignatureClassMember(_) + | AnyJsClassMember::JsEmptyClassMember(_) + | AnyJsClassMember::JsStaticInitializationBlockClassMember(_) => return None, + AnyJsClassMember::TsIndexSignatureClassMember(member) => { + (Kind::ClassProperty, (&member.modifiers()).into()) } - if self.modifiers.contains(Modifier::Readonly) - && !matches!( - self.kind, - Kind::ClassProperty | Kind::IndexParameter | Kind::TypeProperty - ) - { - return Err(InvalidSelector::UnsupportedModifiers( - self.kind, - Modifier::Readonly, - )); + AnyJsClassMember::JsGetterClassMember(getter) => { + (Kind::ClassGetter, (&getter.modifiers()).into()) } - if self.modifiers.intersects(Modifier::CLASS_MEMBER_ONLY) - && !Kind::ClassMember.contains(self.kind) - { - let modifiers = self.modifiers.0 & Modifier::CLASS_MEMBER_ONLY; - if let Some(modifier) = modifiers.iter().next() { - return Err(InvalidSelector::UnsupportedModifiers(self.kind, modifier)); - } + AnyJsClassMember::TsGetterSignatureClassMember(member) => { + (Kind::ClassGetter, (&member.modifiers()).into()) } - // The rule doesn't allow `Modifier::Public`. - // So we only need to check for `Modifier::Private`/`Modifier::Protected` incompatibility. - let accessibility = Modifier::Private | Modifier::Protected; - if *self.modifiers & accessibility == accessibility { - return Err(InvalidSelector::IncompatibleModifiers( - Modifier::Private, - Modifier::Protected, - )); + AnyJsClassMember::JsMethodClassMember(member) => { + (Kind::ClassMethod, (&member.modifiers()).into()) } - let abstarct_or_static = Modifier::Abstract | Modifier::Static; - if *self.modifiers & abstarct_or_static == abstarct_or_static { - return Err(InvalidSelector::IncompatibleModifiers( - Modifier::Abstract, - Modifier::Static, - )); + AnyJsClassMember::TsMethodSignatureClassMember(member) => { + (Kind::ClassMethod, (&member.modifiers()).into()) } - if self.scope == Scope::Global - && !Kind::Variable.contains(self.kind) - && !Kind::Function.contains(self.kind) - && !Kind::TypeLike.contains(self.kind) - { - return Err(InvalidSelector::UnsupportedScope(self.kind, Scope::Global)); + AnyJsClassMember::JsPropertyClassMember(member) => { + (Kind::ClassProperty, (&member.modifiers()).into()) } - Ok(()) - } -} - -impl DeserializableValidator for Selector { - fn validate( - &mut self, - ctx: &mut impl DeserializationContext, - _name: &str, - range: biome_rowan::TextRange, - ) -> bool { - if let Err(error) = self.check() { - ctx.report(DeserializationDiagnostic::new(format_args!("{error}")).with_range(range)); - return false; + AnyJsClassMember::TsPropertySignatureClassMember(member) => { + (Kind::ClassProperty, (&member.modifiers()).into()) } - true - } -} - -impl From for Selector { - fn from(kind: Kind) -> Self { - Self { - kind, - modifiers: Modifiers::default(), - scope: Scope::Any, - } - } -} -impl std::fmt::Display for Selector { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}{}{}", self.scope, self.modifiers, self.kind) - } -} -impl Selector { - fn with_modifiers(kind: Kind, modifiers: impl Into) -> Self { - Self { - kind, - modifiers: modifiers.into(), - ..Default::default() + AnyJsClassMember::TsInitializedPropertySignatureClassMember(member) => { + (Kind::ClassProperty, (&member.modifiers()).into()) } - } - - fn with_scope(kind: Kind, scope: Scope) -> Self { - Self { - kind, - scope, - ..Default::default() + AnyJsClassMember::JsSetterClassMember(member) => { + (Kind::ClassSetter, (&member.modifiers()).into()) } - } - - fn from_name(js_name: &AnyIdentifierBindingLike) -> Option { - match js_name { - AnyIdentifierBindingLike::JsIdentifierBinding(binding) => { - Self::from_binding_declaration(&binding.declaration()?) - } - AnyIdentifierBindingLike::TsIdentifierBinding(binding) => { - Self::from_binding_declaration(&binding.declaration()?) - } - AnyIdentifierBindingLike::JsLiteralMemberName(member_name) => { - if let Some(member) = member_name.parent::() { - Self::from_class_member(&member) - } else if let Some(member) = member_name.parent::() { - Self::from_type_member(&member) - } else if let Some(member) = member_name.parent::() { - Self::from_object_member(&member) - } else { - None - } - } - AnyIdentifierBindingLike::JsShorthandPropertyObjectMember(_) => { - Some(Kind::ObjectLiteralProperty.into()) - } - AnyIdentifierBindingLike::JsPrivateClassMemberName(member_name) => { - Self::from_class_member(&member_name.parent::()?) - } - AnyIdentifierBindingLike::JsLiteralExportName(export_name) => { - let parent = export_name.syntax().parent()?; - match parent.kind() { - JsSyntaxKind::JS_NAMED_IMPORT_SPECIFIER - | JsSyntaxKind::JS_EXPORT_NAMED_FROM_SPECIFIER => None, - JsSyntaxKind::JS_EXPORT_NAMED_SPECIFIER => Some(Kind::ExportAlias.into()), - JsSyntaxKind::JS_EXPORT_AS_CLAUSE => { - if parent.parent()?.kind() == JsSyntaxKind::JS_EXPORT_FROM_CLAUSE { - Some(Kind::ExportNamespace.into()) - } else { - Some(Kind::ExportAlias.into()) - } - } - _ => None, - } - } - AnyIdentifierBindingLike::TsLiteralEnumMemberName(_) => Some(Kind::EnumMember.into()), - AnyIdentifierBindingLike::TsTypeParameterName(_) => Some(Kind::TypeParameter.into()), + AnyJsClassMember::TsSetterSignatureClassMember(member) => { + (Kind::ClassSetter, (&member.modifiers()).into()) } - } - - fn from_class_member(member: &AnyJsClassMember) -> Option { - let Self { - kind, - modifiers, - scope, - } = match member { - AnyJsClassMember::JsBogusMember(_) - | AnyJsClassMember::JsMetavariable(_) - | AnyJsClassMember::JsConstructorClassMember(_) - | AnyJsClassMember::TsConstructorSignatureClassMember(_) - | AnyJsClassMember::JsEmptyClassMember(_) - | AnyJsClassMember::JsStaticInitializationBlockClassMember(_) => return None, - AnyJsClassMember::TsIndexSignatureClassMember(getter) => { - Self::with_modifiers(Kind::IndexParameter, getter.modifiers()) - } - AnyJsClassMember::JsGetterClassMember(getter) => { - Self::with_modifiers(Kind::ClassGetter, getter.modifiers()) - } - AnyJsClassMember::TsGetterSignatureClassMember(getter) => { - Self::with_modifiers(Kind::ClassGetter, getter.modifiers()) - } - AnyJsClassMember::JsMethodClassMember(method) => { - Self::with_modifiers(Kind::ClassMethod, method.modifiers()) - } - AnyJsClassMember::TsMethodSignatureClassMember(method) => { - Self::with_modifiers(Kind::ClassMethod, method.modifiers()) - } - AnyJsClassMember::JsPropertyClassMember(property) => { - Self::with_modifiers(Kind::ClassProperty, property.modifiers()) - } - AnyJsClassMember::TsPropertySignatureClassMember(property) => { - Self::with_modifiers(Kind::ClassProperty, property.modifiers()) - } - AnyJsClassMember::TsInitializedPropertySignatureClassMember(property) => { - Self::with_modifiers(Kind::ClassProperty, property.modifiers()) - } - AnyJsClassMember::JsSetterClassMember(setter) => { - Self::with_modifiers(Kind::ClassSetter, setter.modifiers()) - } - AnyJsClassMember::TsSetterSignatureClassMember(setter) => { - Self::with_modifiers(Kind::ClassSetter, setter.modifiers()) - } - }; + }; + if modifiers.contains(Modifier::Override) { // Ignore explicitly overridden members - (!modifiers.contains(Modifier::Override)).then_some(Self { + None + } else { + Some(Selector::with_modifiers( kind, - modifiers, - scope, - }) + to_restricted_modifiers(modifiers), + )) } +} - fn from_binding_declaration(decl: &AnyJsBindingDeclaration) -> Option { - match decl { +fn selector_from_binding_declaration(decl: &AnyJsBindingDeclaration) -> Option { + match decl { AnyJsBindingDeclaration::JsArrayBindingPatternElement(_) | AnyJsBindingDeclaration::JsArrayBindingPatternRestElement(_) | AnyJsBindingDeclaration::JsObjectBindingPatternProperty(_) | AnyJsBindingDeclaration::JsObjectBindingPatternRest(_) => { - Self::from_parent_binding_pattern_declaration(&decl.parent_binding_pattern_declaration()?) + + selector_from_parent_binding_pattern_declaration(&decl.parent_binding_pattern_declaration()?) } AnyJsBindingDeclaration::JsVariableDeclarator(var) => { - Self::from_variable_declarator(var, Scope::from_declaration(decl)?) + selector_from_variable_declarator(var, scope_from_declaration(decl)?) } AnyJsBindingDeclaration::JsArrowFunctionExpression(_) | AnyJsBindingDeclaration::JsBogusParameter(_) @@ -1457,55 +1211,56 @@ impl Selector { AnyJsBindingDeclaration::TsPropertyParameter(_) => Some(Kind::ClassProperty.into()), AnyJsBindingDeclaration::TsIndexSignatureParameter(member_name) => { if let Some(member) = member_name.parent::<>() { - Self::from_class_member(&member) + selector_from_class_member(&member) } else if let Some(member) = member_name.parent::() { - Self::from_type_member(&member) + selector_from_type_member(&member) } else if let Some(member) = member_name.parent::() { - Self::from_object_member(&member) + selector_from_object_member(&member) } else { Some(Kind::IndexParameter.into()) } } - AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_) => Some(Self::with_scope(Kind::ImportNamespace, Scope::Global)), + AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_) => Some( + Selector::with_scope(Kind::ImportNamespace, Scope::Global)), AnyJsBindingDeclaration::JsFunctionDeclaration(_) | AnyJsBindingDeclaration::JsFunctionExpression(_) | AnyJsBindingDeclaration::JsFunctionExportDefaultDeclaration(_) | AnyJsBindingDeclaration::TsDeclareFunctionDeclaration(_) | AnyJsBindingDeclaration::TsDeclareFunctionExportDefaultDeclaration(_) => { - Some(Self::with_scope(Kind::Function, Scope::from_declaration(decl)?)) + Some(Selector::with_scope(Kind::Function, scope_from_declaration(decl)?)) } AnyJsBindingDeclaration::TsImportEqualsDeclaration(_) | AnyJsBindingDeclaration::JsDefaultImportSpecifier(_) - | AnyJsBindingDeclaration::JsNamedImportSpecifier(_) => Some(Self::with_scope(Kind::ImportAlias, Scope::Global)), - AnyJsBindingDeclaration::TsModuleDeclaration(_) => Some(Self::with_scope(Kind::Namespace, Scope::Global)), - AnyJsBindingDeclaration::TsTypeAliasDeclaration(_) => Some(Self::with_scope(Kind::TypeAlias, Scope::from_declaration(decl)?)), + | AnyJsBindingDeclaration::JsNamedImportSpecifier(_) => Some(Selector::with_scope(Kind::ImportAlias, Scope::Global)), + AnyJsBindingDeclaration::TsModuleDeclaration(_) => Some(Selector::with_scope(Kind::Namespace, Scope::Global)), + AnyJsBindingDeclaration::TsTypeAliasDeclaration(_) => Some(Selector::with_scope(Kind::TypeAlias, scope_from_declaration(decl)?)), AnyJsBindingDeclaration::JsClassDeclaration(class) => { - Some(Self { + Some(Selector { kind: Kind::Class, modifiers: if class.abstract_token().is_some() { - Modifier::Abstract.into() + RestrictedModifier::Abstract.into() } else { - Modifiers::default() + RestrictedModifiers::default() }, - scope: Scope::from_declaration(decl)?, + scope: scope_from_declaration(decl)?, }) } AnyJsBindingDeclaration::JsClassExportDefaultDeclaration(class) => { - Some(Self { + Some(Selector { kind: Kind::Class, modifiers: if class.abstract_token().is_some() { - Modifier::Abstract.into() + RestrictedModifier::Abstract.into() } else { - Modifiers::default() + RestrictedModifiers::default() }, - scope: Scope::from_declaration(decl)?, + scope: scope_from_declaration(decl)?, }) } AnyJsBindingDeclaration::JsClassExpression(_) => { - Some(Self::with_scope(Kind::Class, Scope::from_declaration(decl)?)) + Some(Selector::with_scope(Kind::Class, scope_from_declaration(decl)?)) } - AnyJsBindingDeclaration::TsInterfaceDeclaration(_) => Some(Self::with_scope(Kind::Interface, Scope::from_declaration(decl)?)), - AnyJsBindingDeclaration::TsEnumDeclaration(_) => Some(Self::with_scope(Kind::Enum, Scope::from_declaration(decl)?)), + AnyJsBindingDeclaration::TsInterfaceDeclaration(_) => Some(Selector::with_scope(Kind::Interface, scope_from_declaration(decl)?)), + AnyJsBindingDeclaration::TsEnumDeclaration(_) => Some(Selector::with_scope(Kind::Enum, scope_from_declaration(decl)?)), AnyJsBindingDeclaration::JsObjectBindingPatternShorthandProperty(_) | AnyJsBindingDeclaration::JsShorthandNamedImportSpecifier(_) | AnyJsBindingDeclaration::JsBogusNamedImportSpecifier(_) @@ -1518,638 +1273,189 @@ impl Selector { // of scope of this rule. AnyJsBindingDeclaration::TsExternalModuleDeclaration(_) => None } - } - - fn from_parent_binding_pattern_declaration(decl: &AnyJsBindingDeclaration) -> Option { - let scope = Scope::from_declaration(decl)?; - if let AnyJsBindingDeclaration::JsVariableDeclarator(declarator) = decl { - Self::from_variable_declarator(declarator, scope) - } else { - Some(Self::with_scope(Kind::Variable, scope)) - } - } - - fn from_variable_declarator(var: &JsVariableDeclarator, scope: Scope) -> Option { - let var_declaration = var - .syntax() - .ancestors() - .find_map(AnyJsVariableDeclaration::cast)?; - let var_kind = var_declaration.variable_kind().ok()?; - let kind = match var_kind { - JsVariableKind::Const => Kind::Const, - JsVariableKind::Let => Kind::Let, - JsVariableKind::Using => Kind::Using, - JsVariableKind::Var => Kind::Var, - }; - Some(Self::with_scope(kind, scope)) - } - - fn from_object_member(member: &AnyJsObjectMember) -> Option { - match member { - AnyJsObjectMember::JsBogusMember(_) | AnyJsObjectMember::JsSpread(_) => None, - AnyJsObjectMember::JsGetterObjectMember(_) => Some(Kind::ObjectLiteralGetter.into()), - AnyJsObjectMember::JsMethodObjectMember(_) => Some(Kind::ObjectLiteralMethod.into()), - AnyJsObjectMember::JsPropertyObjectMember(_) - | AnyJsObjectMember::JsShorthandPropertyObjectMember(_) => { - Some(Kind::ObjectLiteralProperty.into()) - } - AnyJsObjectMember::JsSetterObjectMember(_) => Some(Kind::ObjectLiteralSetter.into()), - } - } - - fn from_type_member(member: &AnyTsTypeMember) -> Option { - match member { - AnyTsTypeMember::JsBogusMember(_) - | AnyTsTypeMember::TsCallSignatureTypeMember(_) - | AnyTsTypeMember::TsConstructSignatureTypeMember(_) => None, - AnyTsTypeMember::TsIndexSignatureTypeMember(property) => { - Some(if property.readonly_token().is_some() { - Self::with_modifiers(Kind::IndexParameter, Modifier::Readonly) - } else { - Kind::IndexParameter.into() - }) - } - AnyTsTypeMember::TsGetterSignatureTypeMember(_) => Some(Kind::TypeGetter.into()), - AnyTsTypeMember::TsMethodSignatureTypeMember(_) => Some(Kind::TypeMethod.into()), - AnyTsTypeMember::TsPropertySignatureTypeMember(property) => { - Some(if property.readonly_token().is_some() { - Self::with_modifiers(Kind::TypeProperty, Modifier::Readonly) - } else { - Kind::TypeProperty.into() - }) - } - AnyTsTypeMember::TsSetterSignatureTypeMember(_) => Some(Kind::TypeSetter.into()), - } - } - - /// Returns the list of default [Case] for `self`. - /// The preferred case comes first in the list. - fn default_convention(self) -> Convention { - let kind = self.kind; - match kind { - Kind::TypeProperty if self.modifiers.contains(Modifier::Readonly) => Convention { - selector: Self::with_modifiers(self.kind, Modifier::Readonly), - matching: None, - formats: Formats(Case::Camel | Case::Constant), - }, - Kind::TypeGetter => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Camel | Case::Constant), - }, - Kind::Function if Scope::Global.contains(self.scope) => Convention { - selector: Self::with_scope(kind, Scope::Global), - matching: None, - formats: Formats(Case::Camel | Case::Pascal | Case::Upper), - }, - Kind::Variable | Kind::Const | Kind::Var if Scope::Global.contains(self.scope) => { - Convention { - selector: Self::with_scope(kind, Scope::Global), - matching: None, - formats: Formats(Case::Camel | Case::Pascal | Case::Constant), - } - } - Kind::Any | Kind::ExportAlias | Kind::ImportAlias => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Camel | Case::Pascal | Case::Constant), - }, - Kind::ClassProperty | Kind::ClassGetter - if self.modifiers.contains(Modifier::Static) => - { - Convention { - selector: Self::with_modifiers(kind, Modifier::Static), - matching: None, - formats: Formats(Case::Camel | Case::Constant), - } - } - Kind::CatchParameter - | Kind::ClassGetter - | Kind::ClassMember - | Kind::ClassMethod - | Kind::ClassProperty - | Kind::ClassSetter - | Kind::IndexParameter - | Kind::ObjectLiteralGetter - | Kind::ObjectLiteralProperty - | Kind::ObjectLiteralMember - | Kind::ObjectLiteralMethod - | Kind::ObjectLiteralSetter - | Kind::TypeMember - | Kind::TypeMethod - | Kind::TypeProperty - | Kind::TypeSetter - | Kind::Using => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Camel.into()), - }, - Kind::TypeLike - | Kind::Class - | Kind::Enum - | Kind::Interface - | Kind::TypeAlias - | Kind::TypeParameter => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Pascal.into()), - }, - Kind::EnumMember => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Pascal.into()), - }, - Kind::Variable | Kind::Const | Kind::Var | Kind::Let => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Camel | Case::Pascal), - }, - Kind::Function - | Kind::ExportNamespace - | Kind::ImportNamespace - | Kind::Namespace - | Kind::NamespaceLike - | Kind::FunctionParameter => Convention { - selector: kind.into(), - matching: None, - formats: Formats(Case::Camel | Case::Pascal), - }, - } - } - - fn contains(&self, other: Self) -> bool { - other.kind.contains(self.kind) - && self.modifiers.contains(other.modifiers.0) - && other.scope.contains(self.scope) - } } -#[derive( - Clone, - Copy, - Debug, - Default, - Deserializable, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase")] -pub enum Kind { - /// All kinds - #[default] - Any, - /// All type definitions: classes, enums, interfaces, and type aliases - TypeLike, - Class, - Enum, - /// Named function declarations and expressions - Function, - Interface, - EnumMember, - /// TypeScript namespaces, import and export namespaces - NamespaceLike, - /// TypeScript namespaces - Namespace, - ImportNamespace, - ExportNamespace, - // All variable declaration: const, let, using, var - Variable, - Const, - Let, - Using, - Var, - /// All function parameters, but parameter properties - FunctionParameter, - CatchParameter, - IndexParameter, - /// All generic type parameters - TypeParameter, - // All re-export default exports and aliases of re-exported names - ExportAlias, - // All default imports and aliases of named imports - ImportAlias, - /// All class members: properties, methods, getters, and setters - ClassMember, - /// All class properties, including parameter properties - ClassProperty, - ClassGetter, - ClassSetter, - ClassMethod, - /// All object literal members: properties, methods, getters, and setters - ObjectLiteralMember, - ObjectLiteralProperty, - ObjectLiteralGetter, - ObjectLiteralSetter, - ObjectLiteralMethod, - TypeAlias, - /// All members defined in type alaises and interfaces - TypeMember, - /// All getters defined in type alaises and interfaces - TypeGetter, - /// All properties defined in type alaises and interfaces - TypeProperty, - /// All setters defined in type alaises and interfaces - TypeSetter, - /// All methods defined in type alaises and interfaces - TypeMethod, -} - -impl Kind { - pub fn contains(self, other: Self) -> bool { - self == other - || matches!( - (self, other), - (Self::Any, _) - | ( - Self::Variable, - Self::Const | Self::Let | Self::Using | Self::Var, - ) - | ( - Self::ClassMember, - Self::ClassGetter - | Self::ClassMethod - | Self::ClassProperty - | Self::ClassSetter - ) - | ( - Self::ObjectLiteralMember, - Self::ObjectLiteralGetter - | Self::ObjectLiteralMethod - | Self::ObjectLiteralProperty - | Self::ObjectLiteralSetter - ) - | ( - Self::TypeMember, - Self::TypeGetter - | Self::TypeMethod - | Self::TypeParameter - | Self::TypeProperty - | Self::TypeSetter - ) - | ( - Self::NamespaceLike, - Self::ExportNamespace | Self::ImportNamespace | Self::Namespace - ) - | ( - Self::TypeLike, - Self::Class - | Self::Enum - | Self::EnumMember - | Self::Interface - | Self::TypeAlias - | Self::TypeParameter - ) - ) - } -} -impl std::fmt::Display for Kind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let repr = match self { - Self::Any => "declaration", - Self::CatchParameter => "catch parameter", - Self::Class => "class", - Self::ClassGetter => "class getter", - Self::ClassMember => "class member", - Self::ClassMethod => "class method", - Self::ClassProperty => "class property", - Self::ClassSetter => "class setter", - Self::Const => "const", - Self::Enum => "enum", - Self::EnumMember => "enum member", - Self::ExportAlias => "export alias", - Self::ExportNamespace => "export namespace", - Self::Function => "function", - Self::ImportAlias => "import alias", - Self::ImportNamespace => "import namespace", - Self::IndexParameter => "index parameter", - Self::Interface => "interface", - Self::Let => "let", - Self::Namespace => "namespace", - Self::NamespaceLike => "namespace", - Self::ObjectLiteralGetter => "object getter", - Self::ObjectLiteralMember => "object member", - Self::ObjectLiteralMethod => "object method", - Self::ObjectLiteralProperty => "object property", - Self::ObjectLiteralSetter => "object setter", - Self::FunctionParameter => "function parameter", - Self::TypeAlias => "type alias", - Self::TypeGetter => "getter", - Self::TypeLike => "type", - Self::TypeMember => "type member", - Self::TypeMethod => "method", - Self::TypeParameter => "type parameter", - Self::TypeProperty => "property", - Self::TypeSetter => "setter", - Self::Using => "using", - Self::Var => "var", - Self::Variable => "variable", - }; - write!(f, "{repr}") +fn selector_from_parent_binding_pattern_declaration( + decl: &AnyJsBindingDeclaration, +) -> Option { + let scope = scope_from_declaration(decl)?; + if let AnyJsBindingDeclaration::JsVariableDeclarator(declarator) = decl { + selector_from_variable_declarator(declarator, scope) + } else { + Some(Selector::with_scope(Kind::Variable, scope)) } } -#[derive(Debug, Deserializable, Copy, Clone, serde::Deserialize, serde::Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase")] -#[repr(u16)] -pub enum RestrictedModifier { - Abstract = Modifier::Abstract as u16, - Private = Modifier::Private as u16, - Protected = Modifier::Protected as u16, - Readonly = Modifier::Readonly as u16, - Static = Modifier::Static as u16, +fn selector_from_variable_declarator(var: &JsVariableDeclarator, scope: Scope) -> Option { + let var_declaration = var + .syntax() + .ancestors() + .find_map(AnyJsVariableDeclaration::cast)?; + let var_kind = var_declaration.variable_kind().ok()?; + let kind = match var_kind { + JsVariableKind::Const => Kind::Const, + JsVariableKind::Let => Kind::Let, + JsVariableKind::Using => Kind::Using, + JsVariableKind::Var => Kind::Var, + }; + Some(Selector::with_scope(kind, scope)) } -impl From for Modifier { - fn from(modifier: RestrictedModifier) -> Self { - match modifier { - RestrictedModifier::Abstract => Self::Abstract, - RestrictedModifier::Private => Self::Private, - RestrictedModifier::Protected => Self::Protected, - RestrictedModifier::Readonly => Self::Readonly, - RestrictedModifier::Static => Self::Static, +fn selector_from_object_member(member: &AnyJsObjectMember) -> Option { + match member { + AnyJsObjectMember::JsBogusMember(_) | AnyJsObjectMember::JsSpread(_) => None, + AnyJsObjectMember::JsGetterObjectMember(_) => Some(Kind::ObjectLiteralGetter.into()), + AnyJsObjectMember::JsMethodObjectMember(_) => Some(Kind::ObjectLiteralMethod.into()), + AnyJsObjectMember::JsPropertyObjectMember(_) + | AnyJsObjectMember::JsShorthandPropertyObjectMember(_) => { + Some(Kind::ObjectLiteralProperty.into()) } + AnyJsObjectMember::JsSetterObjectMember(_) => Some(Kind::ObjectLiteralSetter.into()), } } -impl From for RestrictedModifier { - fn from(modifier: Modifier) -> Self { - match modifier { - Modifier::Abstract => Self::Abstract, - Modifier::Private => Self::Private, - Modifier::Protected => Self::Protected, - Modifier::Readonly => Self::Readonly, - Modifier::Static => Self::Static, - _ => unreachable!("Unsupported case"), - } - } -} -impl From for BitFlags { - fn from(modifier: RestrictedModifier) -> Self { - Modifier::from(modifier).into() - } -} - -#[derive( - Debug, - Copy, - Default, - Deserializable, - Clone, - Hash, - Eq, - PartialEq, - serde::Deserialize, - serde::Serialize, -)] -#[serde( - from = "SmallVec<[RestrictedModifier; 4]>", - into = "SmallVec<[RestrictedModifier; 4]>" -)] -pub struct Modifiers(BitFlags); - -impl Deref for Modifiers { - type Target = BitFlags; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl From for Modifiers { - fn from(value: Modifier) -> Self { - Self(value.into()) - } -} -impl From for SmallVec<[RestrictedModifier; 4]> { - fn from(value: Modifiers) -> Self { - value.into_iter().map(|modifier| modifier.into()).collect() - } -} -impl From> for Modifiers { - fn from(values: SmallVec<[RestrictedModifier; 4]>) -> Self { - Self::from_iter(values) - } -} -impl FromIterator for Modifiers { - fn from_iter>(values: T) -> Self { - Self( - values - .into_iter() - .map(Modifier::from) - .fold(BitFlags::empty(), |acc, m| acc | m), - ) - } -} -#[cfg(feature = "schemars")] -impl JsonSchema for Modifiers { - fn schema_name() -> String { - "Modifiers".to_string() - } - fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { - >::json_schema(generator) - } -} -impl From for Modifiers { - fn from(value: JsMethodModifierList) -> Self { - Self((&value).into()) - } -} -impl From for Modifiers { - fn from(value: JsPropertyModifierList) -> Self { - Self((&value).into()) - } -} -impl From for Modifiers { - fn from(value: TsIndexSignatureModifierList) -> Self { - Self((&value).into()) - } -} -impl From for Modifiers { - fn from(value: TsMethodSignatureModifierList) -> Self { - Self((&value).into()) - } -} -impl From for Modifiers { - fn from(value: TsPropertySignatureModifierList) -> Self { - Self((&value).into()) - } -} -impl std::fmt::Display for Modifiers { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - for value in self.0.iter() { - write!(f, "{value} ")?; +fn selector_from_type_member(member: &AnyTsTypeMember) -> Option { + match member { + AnyTsTypeMember::JsBogusMember(_) + | AnyTsTypeMember::TsCallSignatureTypeMember(_) + | AnyTsTypeMember::TsConstructSignatureTypeMember(_) => None, + AnyTsTypeMember::TsIndexSignatureTypeMember(property) => { + Some(if property.readonly_token().is_some() { + Selector::with_modifiers(Kind::IndexParameter, RestrictedModifier::Readonly) + } else { + Kind::IndexParameter.into() + }) } - Ok(()) - } -} - -#[derive( - Debug, - Copy, - Default, - Deserializable, - Clone, - Hash, - Eq, - PartialEq, - serde::Deserialize, - serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase")] -pub enum Scope { - #[default] - Any, - Global, -} - -impl Scope { - /// Returns the scope of `node` or `None` if the scope cannot be determined or - /// if the scope is an external module. - fn from_declaration(node: &AnyJsBindingDeclaration) -> Option { - let control_flow_root = node.syntax().ancestors().skip(1).find(|x| { - AnyJsControlFlowRoot::can_cast(x.kind()) - || x.kind() == JsSyntaxKind::TS_DECLARATION_MODULE - || x.kind() == JsSyntaxKind::TS_EXTERNAL_MODULE_DECLARATION - })?; - match control_flow_root.kind() { - JsSyntaxKind::JS_MODULE - | JsSyntaxKind::JS_SCRIPT - | JsSyntaxKind::TS_DECLARATION_MODULE - | JsSyntaxKind::TS_MODULE_DECLARATION => Some(Self::Global), - // Ignore declarations in an external module declaration - JsSyntaxKind::TS_EXTERNAL_MODULE_DECLARATION => None, - _ => Some(Self::Any), + AnyTsTypeMember::TsGetterSignatureTypeMember(_) => Some(Kind::TypeGetter.into()), + AnyTsTypeMember::TsMethodSignatureTypeMember(_) => Some(Kind::TypeMethod.into()), + AnyTsTypeMember::TsPropertySignatureTypeMember(property) => { + Some(if property.readonly_token().is_some() { + Selector::with_modifiers(Kind::TypeProperty, RestrictedModifier::Readonly) + } else { + Kind::TypeProperty.into() + }) } - } - - fn contains(self, scope: Self) -> bool { - matches!(self, Self::Any) || self == scope + AnyTsTypeMember::TsSetterSignatureTypeMember(_) => Some(Kind::TypeSetter.into()), } } -impl std::fmt::Display for Scope { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let repr = match self { - Self::Any => "", - Self::Global => "global ", - }; - write!(f, "{repr}") - } -} - -/// Supported cases. -#[derive( - Clone, - Copy, - Debug, - Default, - Deserializable, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -pub enum Format { - #[serde(rename = "camelCase")] - Camel, - #[serde(rename = "CONSTANT_CASE")] - Constant, - - #[serde(rename = "PascalCase")] - #[default] - Pascal, - - #[serde(rename = "snake_case")] - Snake, -} - -impl From for Case { - fn from(value: Format) -> Self { - match value { - Format::Camel => Self::Camel, - Format::Constant => Self::Constant, - Format::Pascal => Self::Pascal, - Format::Snake => Self::Snake, +/// Returns the list of default [Case] for `self`. +/// The preferred case comes first in the list. +fn default_convention(selector: Selector) -> Convention { + let kind = selector.kind; + match kind { + Kind::TypeProperty if selector.modifiers.contains(RestrictedModifier::Readonly) => { + Convention { + selector: Selector::with_modifiers(selector.kind, RestrictedModifier::Readonly), + matching: None, + formats: (Case::Camel | Case::Constant).into(), + } } - } -} -impl TryFrom for Format { - type Error = &'static str; - - fn try_from(value: Case) -> Result { - match value { - Case::Camel => Ok(Self::Camel), - Case::Constant => Ok(Self::Constant), - Case::Pascal => Ok(Self::Pascal), - Case::Snake => Ok(Self::Snake), - Case::Kebab - | Case::Lower - | Case::Number - | Case::NumberableCapital - | Case::Uni - | Case::Upper - | Case::Unknown => Err("Unsupported case"), + Kind::TypeGetter => Convention { + selector: kind.into(), + matching: None, + formats: (Case::Camel | Case::Constant).into(), + }, + Kind::Function if Scope::Global.contains(selector.scope) => Convention { + selector: Selector::with_scope(kind, Scope::Global), + matching: None, + formats: (Case::Camel | Case::Pascal | Case::Upper).into(), + }, + Kind::Variable | Kind::Const | Kind::Var if Scope::Global.contains(selector.scope) => { + Convention { + selector: Selector::with_scope(kind, Scope::Global), + matching: None, + formats: (Case::Camel | Case::Pascal | Case::Constant).into(), + } + } + Kind::Any | Kind::ExportAlias | Kind::ImportAlias => Convention { + selector: kind.into(), + matching: None, + formats: (Case::Camel | Case::Pascal | Case::Constant).into(), + }, + Kind::ClassProperty | Kind::ClassGetter + if selector.modifiers.contains(RestrictedModifier::Static) => + { + Convention { + selector: Selector::with_modifiers(kind, RestrictedModifier::Static), + matching: None, + formats: (Case::Camel | Case::Constant).into(), + } } + Kind::CatchParameter + | Kind::ClassGetter + | Kind::ClassMember + | Kind::ClassMethod + | Kind::ClassProperty + | Kind::ClassSetter + | Kind::IndexParameter + | Kind::ObjectLiteralGetter + | Kind::ObjectLiteralProperty + | Kind::ObjectLiteralMember + | Kind::ObjectLiteralMethod + | Kind::ObjectLiteralSetter + | Kind::TypeMember + | Kind::TypeMethod + | Kind::TypeProperty + | Kind::TypeSetter + | Kind::Using => Convention { + selector: kind.into(), + matching: None, + formats: (Cases::from(Case::Camel)).into(), + }, + Kind::TypeLike + | Kind::Class + | Kind::Enum + | Kind::Interface + | Kind::TypeAlias + | Kind::TypeParameter => Convention { + selector: kind.into(), + matching: None, + formats: Cases::from(Case::Pascal).into(), + }, + Kind::EnumMember => Convention { + selector: kind.into(), + matching: None, + formats: Cases::from(Case::Pascal).into(), + }, + Kind::Variable | Kind::Const | Kind::Var | Kind::Let => Convention { + selector: kind.into(), + matching: None, + formats: (Case::Camel | Case::Pascal).into(), + }, + Kind::Function + | Kind::ExportNamespace + | Kind::ImportNamespace + | Kind::Namespace + | Kind::NamespaceLike + | Kind::FunctionParameter => Convention { + selector: kind.into(), + matching: None, + formats: (Case::Camel | Case::Pascal).into(), + }, } } -#[derive( - Clone, - Copy, - Debug, - Default, - Deserializable, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, -)] -#[serde(from = "SmallVec<[Format; 4]>", into = "SmallVec<[Format; 4]>")] -pub struct Formats(Cases); - -impl Deref for Formats { - type Target = Cases; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl From> for Formats { - fn from(values: SmallVec<[Format; 4]>) -> Self { - Self::from_iter(values) - } -} -impl FromIterator for Formats { - fn from_iter>(values: T) -> Self { - Self(values.into_iter().map(|format| format.into()).collect()) - } -} -impl From for SmallVec<[Format; 4]> { - fn from(value: Formats) -> Self { - value - .0 - .into_iter() - .filter_map(|case| case.try_into().ok()) - .collect() - } -} -#[cfg(feature = "schemars")] -impl JsonSchema for Formats { - fn schema_name() -> String { - "Formats".to_string() - } - fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { - >::json_schema(generator) +/// Returns the scope of `node` or `None` if the scope cannot be determined or +/// if the scope is an external module. +fn scope_from_declaration(node: &AnyJsBindingDeclaration) -> Option { + let control_flow_root = node.syntax().ancestors().skip(1).find(|x| { + AnyJsControlFlowRoot::can_cast(x.kind()) + || x.kind() == JsSyntaxKind::TS_DECLARATION_MODULE + || x.kind() == JsSyntaxKind::TS_EXTERNAL_MODULE_DECLARATION + })?; + match control_flow_root.kind() { + JsSyntaxKind::JS_MODULE + | JsSyntaxKind::JS_SCRIPT + | JsSyntaxKind::TS_DECLARATION_MODULE + | JsSyntaxKind::TS_MODULE_DECLARATION => Some(Scope::Global), + // Ignore declarations in an external module declaration + JsSyntaxKind::TS_EXTERNAL_MODULE_DECLARATION => None, + _ => Some(Scope::Any), } } -/// trim underscores and dollar signs from `name` and returns the lengtj of the trimmed prefix. +/// trim underscores and dollar signs from `name` and returns the length of the trimmed prefix. fn trim_underscore_dollar(name: &str) -> (usize, &str) { let prefix_len = name .bytes() @@ -2164,3 +1470,22 @@ fn trim_underscore_dollar(name: &str) -> (usize, &str) { let name = &name[..(name.len() - suffix_len)]; (prefix_len, name) } + +fn to_restricted_modifiers(bitflag: enumflags2::BitFlags) -> RestrictedModifiers { + bitflag + .into_iter() + .filter_map(|modifier| match modifier { + Modifier::Private => Some(RestrictedModifier::Private), + Modifier::Protected => Some(RestrictedModifier::Protected), + Modifier::Static => Some(RestrictedModifier::Static), + Modifier::Abstract => Some(RestrictedModifier::Abstract), + Modifier::Readonly => Some(RestrictedModifier::Readonly), + Modifier::Decorator + | Modifier::BogusAccessibility + | Modifier::Public + | Modifier::Declare + | Modifier::Override + | Modifier::Accessor => None, + }) + .collect() +} diff --git a/crates/biome_js_analyze/src/lint/style/use_node_assert_strict.rs b/crates/biome_js_analyze/src/lint/style/use_node_assert_strict.rs index 04fa74db1ad1..1de95a18f746 100644 --- a/crates/biome_js_analyze/src/lint/style/use_node_assert_strict.rs +++ b/crates/biome_js_analyze/src/lint/style/use_node_assert_strict.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsImportLike, JsSyntaxKind, JsSyntaxToken, inner_string_text}; use biome_rowan::BatchMutationExt; +use biome_rule_options::use_node_assert_strict::UseNodeAssertStrictOptions; declare_lint_rule! { /// Promotes the usage of `node:assert/strict` over `node:assert`. @@ -38,7 +39,7 @@ impl Rule for UseNodeAssertStrict { type Query = Ast; type State = JsSyntaxToken; type Signals = Option; - type Options = (); + type Options = UseNodeAssertStrictOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_nodejs_import_protocol.rs b/crates/biome_js_analyze/src/lint/style/use_nodejs_import_protocol.rs index b70d894001bb..ab3e48b6b169 100644 --- a/crates/biome_js_analyze/src/lint/style/use_nodejs_import_protocol.rs +++ b/crates/biome_js_analyze/src/lint/style/use_nodejs_import_protocol.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsImportLike, JsSyntaxKind, JsSyntaxToken, inner_string_text}; use biome_resolver::is_builtin_node_module; use biome_rowan::BatchMutationExt; +use biome_rule_options::use_nodejs_import_protocol::UseNodejsImportProtocolOptions; use crate::JsRuleAction; use crate::services::manifest::Manifest; @@ -64,7 +65,7 @@ impl Rule for UseNodejsImportProtocol { type Query = Manifest; type State = JsSyntaxToken; type Signals = Option; - type Options = (); + type Options = UseNodejsImportProtocolOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_number_namespace.rs b/crates/biome_js_analyze/src/lint/style/use_number_namespace.rs index 2f242982916d..7039898e0225 100644 --- a/crates/biome_js_analyze/src/lint/style/use_number_namespace.rs +++ b/crates/biome_js_analyze/src/lint/style/use_number_namespace.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ static_value::StaticValue, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_number_namespace::UseNumberNamespaceOptions; declare_lint_rule! { /// Use the `Number` properties instead of global ones. @@ -82,7 +83,7 @@ impl Rule for UseNumberNamespace { type Query = Semantic; type State = StaticValue; type Signals = Option; - type Options = (); + type Options = UseNumberNamespaceOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_self_closing_elements.rs b/crates/biome_js_analyze/src/lint/style/use_self_closing_elements.rs index bd256fd3474c..9f81893905ce 100644 --- a/crates/biome_js_analyze/src/lint/style/use_self_closing_elements.rs +++ b/crates/biome_js_analyze/src/lint/style/use_self_closing_elements.rs @@ -1,17 +1,13 @@ +use crate::JsRuleAction; use biome_analyze::{ Ast, FixKind, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsxTag, JsSyntaxToken, JsxElement, JsxOpeningElementFields, T}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPiece}; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::JsRuleAction; +use biome_rule_options::use_self_closing_elements::UseSelfClosingElementsOptions; declare_lint_rule! { /// Prevent extra closing tags for components without children. @@ -99,7 +95,7 @@ impl Rule for UseSelfClosingElements { type Query = Ast; type State = (); type Signals = Option; - type Options = Box; + type Options = UseSelfClosingElementsOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); @@ -185,12 +181,3 @@ impl Rule for UseSelfClosingElements { )) } } - -/// Options for the `useSelfClosingElements` rule. -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UseSelfClosingElementsOptions { - // Whether or not to ignore checking native HTML elements. Default is false. - pub ignore_html_elements: bool, -} diff --git a/crates/biome_js_analyze/src/lint/style/use_shorthand_assign.rs b/crates/biome_js_analyze/src/lint/style/use_shorthand_assign.rs index a0ccc91f3888..95d833a4ab0f 100644 --- a/crates/biome_js_analyze/src/lint/style/use_shorthand_assign.rs +++ b/crates/biome_js_analyze/src/lint/style/use_shorthand_assign.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsBinaryExpression, JsBinaryOperator, JsSyntaxKind, T, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_shorthand_assign::UseShorthandAssignOptions; use crate::{ JsRuleAction, @@ -69,7 +70,7 @@ impl Rule for UseShorthandAssign { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = UseShorthandAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_shorthand_function_type.rs b/crates/biome_js_analyze/src/lint/style/use_shorthand_function_type.rs index 1323d2969cb1..f9d86886183a 100644 --- a/crates/biome_js_analyze/src/lint/style/use_shorthand_function_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_shorthand_function_type.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ TsFunctionType, TsInterfaceDeclaration, TsObjectType, TsTypeMemberList, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, SyntaxNodeOptionExt, TriviaPieceKind}; +use biome_rule_options::use_shorthand_function_type::UseShorthandFunctionTypeOptions; declare_lint_rule! { /// Enforce using function types instead of object type with call signatures. @@ -91,7 +92,7 @@ impl Rule for UseShorthandFunctionType { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseShorthandFunctionTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_single_var_declarator.rs b/crates/biome_js_analyze/src/lint/style/use_single_var_declarator.rs index b9d106318ff0..ec85989b3189 100644 --- a/crates/biome_js_analyze/src/lint/style/use_single_var_declarator.rs +++ b/crates/biome_js_analyze/src/lint/style/use_single_var_declarator.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ use biome_rowan::{ AstNode, AstSeparatedList, BatchMutationExt, TriviaPiece, trim_leading_trivia_pieces, }; +use biome_rule_options::use_single_var_declarator::UseSingleVarDeclaratorOptions; use crate::JsRuleAction; @@ -55,7 +56,7 @@ impl Rule for UseSingleVarDeclarator { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseSingleVarDeclaratorOptions; fn run(ctx: &RuleContext) -> Option { (ctx.query().declaration().ok()?.declarators().len() > 1).then_some(()) diff --git a/crates/biome_js_analyze/src/lint/style/use_template.rs b/crates/biome_js_analyze/src/lint/style/use_template.rs index 49a60c60530d..bb198d4750f2 100644 --- a/crates/biome_js_analyze/src/lint/style/use_template.rs +++ b/crates/biome_js_analyze/src/lint/style/use_template.rs @@ -10,6 +10,7 @@ use biome_js_syntax::{ JsTemplateElementList, JsTemplateExpression, T, }; use biome_rowan::{AstNode, BatchMutationExt, WalkEvent}; +use biome_rule_options::use_template::UseTemplateOptions; use crate::JsRuleAction; @@ -60,7 +61,7 @@ impl Rule for UseTemplate { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseTemplateOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_throw_new_error.rs b/crates/biome_js_analyze/src/lint/style/use_throw_new_error.rs index 0051b92e25d3..84d8b510189c 100644 --- a/crates/biome_js_analyze/src/lint/style/use_throw_new_error.rs +++ b/crates/biome_js_analyze/src/lint/style/use_throw_new_error.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsExpression, JsCallExpression, JsNewExpression, JsParenthesizedExpression, JsSyntaxKind, T, }; use biome_rowan::{AstNode, BatchMutationExt, TokenText, TriviaPieceKind}; +use biome_rule_options::use_throw_new_error::UseThrowNewErrorOptions; use crate::JsRuleAction; @@ -59,7 +60,7 @@ impl Rule for UseThrowNewError { type Query = Ast; type State = TokenText; type Signals = Option; - type Options = (); + type Options = UseThrowNewErrorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_throw_only_error.rs b/crates/biome_js_analyze/src/lint/style/use_throw_only_error.rs index 871341b84bbd..87edc36ca6b7 100644 --- a/crates/biome_js_analyze/src/lint/style/use_throw_only_error.rs +++ b/crates/biome_js_analyze/src/lint/style/use_throw_only_error.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsThrowStatement, }; use biome_rowan::AstNode; +use biome_rule_options::use_throw_only_error::UseThrowOnlyErrorOptions; declare_lint_rule! { /// Disallow throwing non-`Error` values. @@ -67,7 +68,7 @@ impl Rule for UseThrowOnlyError { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseThrowOnlyErrorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_trim_start_end.rs b/crates/biome_js_analyze/src/lint/style/use_trim_start_end.rs index 5f4014909ea3..fd8f6fcfc691 100644 --- a/crates/biome_js_analyze/src/lint/style/use_trim_start_end.rs +++ b/crates/biome_js_analyze/src/lint/style/use_trim_start_end.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsComputedMemberExpression, JsLanguage, JsSyntaxKind, JsSyntaxToken, JsTemplateExpression, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt, SyntaxToken, TextRange}; +use biome_rule_options::use_trim_start_end::UseTrimStartEndOptions; use crate::JsRuleAction; @@ -66,7 +67,7 @@ impl Rule for UseTrimStartEnd { type Query = Ast; type State = UseTrimStartEndState; type Signals = Option; - type Options = (); + type Options = UseTrimStartEndOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_alert.rs b/crates/biome_js_analyze/src/lint/suspicious/no_alert.rs index c8b57f259e6d..0ae18539d19b 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_alert.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_alert.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ JsStaticMemberExpression, global_identifier, }; use biome_rowan::AstNode; +use biome_rule_options::no_alert::NoAlertOptions; const FORBIDDEN_FUNCTIONS: &[&str] = &["alert", "confirm", "prompt"]; const GLOBAL_OBJECTS: &[&str] = &["window", "globalThis"]; @@ -68,7 +69,7 @@ impl Rule for NoAlert { type Query = Semantic; type State = String; type Signals = Option; - type Options = (); + type Options = NoAlertOptions; fn run(ctx: &RuleContext) -> Self::Signals { let call = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_approximative_numeric_constant.rs b/crates/biome_js_analyze/src/lint/suspicious/no_approximative_numeric_constant.rs index 01172ded7897..ef16068071b9 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_approximative_numeric_constant.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_approximative_numeric_constant.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ numbers::split_into_radix_and_number, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_approximative_numeric_constant::NoApproximativeNumericConstantOptions; use crate::JsRuleAction; @@ -57,7 +58,7 @@ impl Rule for NoApproximativeNumericConstant { type Query = Ast; type State = &'static str; type Signals = Option; - type Options = (); + type Options = NoApproximativeNumericConstantOptions; fn run(ctx: &RuleContext) -> Self::Signals { let token = ctx.query().value_token().ok()?; diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs b/crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs index 0d282834acb4..3cf3f55aa2e5 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ JsReferenceIdentifier, JsxAttribute, }; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_array_index_key::NoArrayIndexKeyOptions; declare_lint_rule! { /// Discourage the usage of Array index in keys. @@ -126,7 +127,7 @@ impl Rule for NoArrayIndexKey { type Query = Semantic; type State = NoArrayIndexKeyState; type Signals = Option; - type Options = (); + type Options = NoArrayIndexKeyOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_assign_in_expressions.rs b/crates/biome_js_analyze/src/lint/suspicious/no_assign_in_expressions.rs index c5fc6633202c..e6068299a325 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_assign_in_expressions.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_assign_in_expressions.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ JsSequenceExpression, }; use biome_rowan::AstNode; +use biome_rule_options::no_assign_in_expressions::NoAssignInExpressionsOptions; declare_lint_rule! { /// Disallow assignments in expressions. @@ -56,7 +57,7 @@ impl Rule for NoAssignInExpressions { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoAssignInExpressionsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let assign = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_async_promise_executor.rs b/crates/biome_js_analyze/src/lint/suspicious/no_async_promise_executor.rs index 79b2f4945b32..cab9aa112f3e 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_async_promise_executor.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_async_promise_executor.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ AnyJsCallArgument, AnyJsExpression, AnyJsFunction, JsNewExpression, JsNewExpressionFields, }; use biome_rowan::{AstNode, AstSeparatedList}; +use biome_rule_options::no_async_promise_executor::NoAsyncPromiseExecutorOptions; declare_lint_rule! { /// Disallows using an async function as a Promise executor. @@ -53,7 +54,7 @@ impl Rule for NoAsyncPromiseExecutor { type Query = Ast; type State = AnyJsFunction; type Signals = Option; - type Options = (); + type Options = NoAsyncPromiseExecutorOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_catch_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_catch_assign.rs index 87f9fdeedb76..0fefd3add93c 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_catch_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_catch_assign.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_semantic::ReferencesExtensions; use biome_js_syntax::JsCatchClause; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_catch_assign::NoCatchAssignOptions; declare_lint_rule! { /// Disallow reassigning exceptions in catch clauses. @@ -55,7 +56,7 @@ impl Rule for NoCatchAssign { // the second element of `State` is the declaration of catch clause. type State = (TextRange, TextRange); type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoCatchAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let catch_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_class_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_class_assign.rs index b02a36d2620e..ece5278dc4b7 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_class_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_class_assign.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_semantic::{Reference, ReferencesExtensions}; use biome_js_syntax::AnyJsClass; +use biome_rule_options::no_class_assign::NoClassAssignOptions; use crate::services::semantic::Semantic; @@ -80,7 +81,7 @@ impl Rule for NoClassAssign { type Query = Semantic; type State = Reference; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoClassAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_comment_text.rs b/crates/biome_js_analyze/src/lint/suspicious/no_comment_text.rs index 4dae6c6c9a1d..fd6354f5a27d 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_comment_text.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_comment_text.rs @@ -7,6 +7,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsxChild, JsSyntaxKind, JsSyntaxToken, JsxText}; use biome_rowan::{BatchMutationExt, TextRange, TextSize}; +use biome_rule_options::no_comment_text::NoCommentTextOptions; use std::ops::Range; declare_lint_rule! { @@ -83,7 +84,7 @@ impl Rule for NoCommentText { type Query = Ast; type State = Range; type Signals = Option; - type Options = (); + type Options = NoCommentTextOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_compare_neg_zero.rs b/crates/biome_js_analyze/src/lint/suspicious/no_compare_neg_zero.rs index c2eab859e5a8..4a4114ab68bf 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_compare_neg_zero.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_compare_neg_zero.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsExpression, AnyJsLiteralExpression, JsBinaryExpression, JsSyntaxKind, JsUnaryOperator, }; use biome_rowan::{AstNode, BatchMutationExt, SyntaxToken}; +use biome_rule_options::no_compare_neg_zero::NoCompareNegZeroOptions; use crate::JsRuleAction; @@ -48,7 +49,7 @@ impl Rule for NoCompareNegZero { type Query = Ast; type State = NoCompareNegZeroState; type Signals = Option; - type Options = (); + type Options = NoCompareNegZeroOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_confusing_labels.rs b/crates/biome_js_analyze/src/lint/suspicious/no_confusing_labels.rs index 5576e6b39ef5..59370c429451 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_confusing_labels.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_confusing_labels.rs @@ -1,10 +1,9 @@ use biome_analyze::context::RuleContext; use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsStatement, JsFileSource, JsLabeledStatement}; -use serde::{Deserialize, Serialize}; +use biome_rule_options::no_confusing_labels::NoConfusingLabelsOptions; declare_lint_rule! { /// Disallow labeled statements that are not loops. @@ -88,21 +87,11 @@ declare_lint_rule! { } } -/// Options for the rule `noConfusingLabels` -#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct NoConfusingLabelsOptions { - /// A list of (non-confusing) labels that should be allowed - #[serde(skip_serializing_if = "<[_]>::is_empty")] - pub allowed_labels: Box<[Box]>, -} - impl Rule for NoConfusingLabels { type Query = Ast; type State = (); type Signals = Option; - type Options = Box; + type Options = NoConfusingLabelsOptions; fn run(ctx: &RuleContext) -> Option { let labeled_stmt = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_confusing_void_type.rs b/crates/biome_js_analyze/src/lint/suspicious/no_confusing_void_type.rs index 775fcba32fcd..d9d726f6a38a 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_confusing_void_type.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_confusing_void_type.rs @@ -7,6 +7,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyTsType, JsSyntaxKind, JsSyntaxNode, T, TsConditionalType, TsVoidType}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_confusing_void_type::NoConfusingVoidTypeOptions; use crate::JsRuleAction; @@ -79,7 +80,7 @@ impl Rule for NoConfusingVoidType { type Query = Ast; type State = VoidTypeContext; type Signals = Option; - type Options = (); + type Options = NoConfusingVoidTypeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_console.rs b/crates/biome_js_analyze/src/lint/suspicious/no_console.rs index 275575e7f685..f8c5bd70a65b 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_console.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_console.rs @@ -3,7 +3,6 @@ use biome_analyze::{ FixKind, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, }; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make::{js_directive_list, js_function_body, js_statement_list, token}; use biome_js_syntax::{ @@ -11,6 +10,7 @@ use biome_js_syntax::{ global_identifier, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_console::NoConsoleOptions; declare_lint_rule! { /// Disallow the use of `console`. @@ -61,7 +61,7 @@ impl Rule for NoConsole { type Query = Semantic; type State = (); type Signals = Option; - type Options = Box; + type Options = NoConsoleOptions; fn run(ctx: &RuleContext) -> Self::Signals { let member_expression = ctx.query(); @@ -129,13 +129,3 @@ impl Rule for NoConsole { )) } } - -#[derive( - Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(deny_unknown_fields)] -pub struct NoConsoleOptions { - /// Allowed calls on the console object. - pub allow: Box<[Box]>, -} diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_const_enum.rs b/crates/biome_js_analyze/src/lint/suspicious/no_const_enum.rs index 34581052a179..6844b18dea81 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_const_enum.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_const_enum.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::TsEnumDeclaration; use biome_rowan::{AstNode, BatchMutationExt, chain_trivia_pieces, trim_leading_trivia_pieces}; +use biome_rule_options::no_const_enum::NoConstEnumOptions; use crate::JsRuleAction; @@ -49,7 +50,7 @@ impl Rule for NoConstEnum { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoConstEnumOptions; fn run(ctx: &RuleContext) -> Self::Signals { let enum_decl = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_control_characters_in_regex.rs b/crates/biome_js_analyze/src/lint/suspicious/no_control_characters_in_regex.rs index ae8e161b0d01..baed322edb2a 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_control_characters_in_regex.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_control_characters_in_regex.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsRegexLiteralExpression; use biome_rowan::{AstNode, TextRange, TextSize}; +use biome_rule_options::no_control_characters_in_regex::NoControlCharactersInRegexOptions; use core::str; declare_lint_rule! { @@ -154,7 +155,7 @@ impl Rule for NoControlCharactersInRegex { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoControlCharactersInRegexOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_debugger.rs b/crates/biome_js_analyze/src/lint/suspicious/no_debugger.rs index b7a8e40866ed..03405d66be29 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_debugger.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_debugger.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsDebuggerStatement; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_debugger::NoDebuggerOptions; use crate::{JsRuleAction, utils::batch::JsBatchMutation}; @@ -40,7 +41,7 @@ impl Rule for NoDebugger { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoDebuggerOptions; fn run(_: &RuleContext) -> Option { Some(()) diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_document_cookie.rs b/crates/biome_js_analyze/src/lint/suspicious/no_document_cookie.rs index 42e5e5b8e8a4..213809e5c3f3 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_document_cookie.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_document_cookie.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ binding_ext::AnyJsBindingDeclaration, global_identifier, static_value::StaticValue, }; use biome_rowan::AstNode; +use biome_rule_options::no_document_cookie::NoDocumentCookieOptions; use crate::services::semantic::Semantic; @@ -129,7 +130,7 @@ impl Rule for NoDocumentCookie { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoDocumentCookieOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_document_import_in_page.rs b/crates/biome_js_analyze/src/lint/suspicious/no_document_import_in_page.rs index 6216d0605e91..cc9491a02b33 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_document_import_in_page.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_document_import_in_page.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsFileSource, JsImport}; use biome_rowan::AstNode; +use biome_rule_options::no_document_import_in_page::NoDocumentImportInPageOptions; declare_lint_rule! { /// Prevents importing `next/document` outside of `pages/_document.jsx` in Next.js projects. @@ -45,7 +46,7 @@ impl Rule for NoDocumentImportInPage { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoDocumentImportInPageOptions; fn run(ctx: &RuleContext) -> Self::Signals { if !ctx.source_type::().is_jsx() { diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_double_equals.rs b/crates/biome_js_analyze/src/lint/suspicious/no_double_equals.rs index 9933980b83b1..ee699fba1bb5 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_double_equals.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_double_equals.rs @@ -1,16 +1,13 @@ +use crate::JsRuleAction; use biome_analyze::RuleSource; use biome_analyze::{Ast, FixKind, Rule, RuleDiagnostic, context::RuleContext, declare_lint_rule}; use biome_console::markup; -use biome_deserialize_macros::Deserializable; use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, AnyJsLiteralExpression, JsBinaryExpression, T}; use biome_js_syntax::{JsSyntaxKind::*, JsSyntaxToken}; use biome_rowan::{BatchMutationExt, SyntaxResult}; -#[cfg(feature = "schema")] -use schemars::JsonSchema; - -use crate::JsRuleAction; +use biome_rule_options::no_double_equals::NoDoubleEqualsOptions; declare_lint_rule! { /// Require the use of `===` and `!==`. @@ -146,38 +143,6 @@ impl Rule for NoDoubleEquals { } } -/// Rule's options -#[derive(Clone, Debug, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct NoDoubleEqualsOptions { - /// If `true`, an exception is made when comparing with `null`, as it's often relied on to check - /// both for `null` or `undefined`. - /// - /// If `false`, no such exception will be made. - #[serde( - default = "ignore_null_default", - skip_serializing_if = "is_ignore_null_default" - )] - pub ignore_null: bool, -} - -impl Default for NoDoubleEqualsOptions { - fn default() -> Self { - Self { - ignore_null: ignore_null_default(), - } - } -} - -fn ignore_null_default() -> bool { - true -} - -fn is_ignore_null_default(value: &bool) -> bool { - value == &ignore_null_default() -} - fn is_null_literal(res: &SyntaxResult) -> bool { matches!( res, diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_case.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_case.rs index 85537c86348a..b72ca4acb2cf 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_case.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_case.rs @@ -4,6 +4,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, AnyJsSwitchClause, JsSwitchStatement}; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_duplicate_case::NoDuplicateCaseOptions; declare_lint_rule! { /// Disallow duplicate case labels. @@ -95,7 +96,7 @@ impl Rule for NoDuplicateCase { type Query = Ast; type State = (TextRange, TextRange); type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDuplicateCaseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_class_members.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_class_members.rs index 2a4fd8d3fb42..9f7c6ee7673d 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_class_members.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_class_members.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ }; use biome_rowan::{AstNode, declare_node_union}; use biome_rowan::{AstNodeList, TokenText}; +use biome_rule_options::no_duplicate_class_members::NoDuplicateClassMembersOptions; use rustc_hash::{FxHashMap, FxHashSet}; declare_lint_rule! { @@ -174,7 +175,7 @@ impl Rule for NoDuplicateClassMembers { type Query = Ast; type State = AnyClassMemberDefinition; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDuplicateClassMembersOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut defined_members: FxHashMap> = diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_else_if.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_else_if.rs index edf2b10bed6e..2ba506a383d4 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_else_if.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_else_if.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsIfStatement, JsLogicalOperator}; use biome_rowan::{AstNode, SyntaxNodeCast, TextRange}; +use biome_rule_options::no_duplicate_else_if::NoDuplicateElseIfOptions; use crate::utils::is_node_equal; @@ -61,7 +62,7 @@ impl Rule for NoDuplicateElseIf { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoDuplicateElseIfOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_jsx_props.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_jsx_props.rs index 6cd95e6ec0b0..6f3310a7aef9 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_jsx_props.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_jsx_props.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_js_syntax::{AnyJsxAttribute, JsxAttribute}; use biome_rowan::AstNode; +use biome_rule_options::no_duplicate_jsx_props::NoDuplicateJsxPropsOptions; use rustc_hash::FxHashMap; declare_lint_rule! { @@ -45,7 +46,7 @@ impl Rule for NoDuplicateJsxProps { type Query = Ast; type State = (Box, Vec); type Signals = FxHashMap, Vec>; - type Options = (); + type Options = NoDuplicateJsxPropsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_object_keys.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_object_keys.rs index 90a035be25ac..4e38ad802fa4 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_object_keys.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_object_keys.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsObjectMember, JsObjectExpression, JsSyntaxKind}; use biome_rowan::{AstNode, BatchMutationExt, NodeOrToken, TokenText}; +use biome_rule_options::no_duplicate_object_keys::NoDuplicateObjectKeysOptions; use rustc_hash::FxHashMap; use std::collections::hash_map; use std::fmt::Display; @@ -64,7 +65,7 @@ impl Rule for NoDuplicateObjectKeys { type Query = Ast; type State = PropertyConflict; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDuplicateObjectKeysOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_parameters.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_parameters.rs index 4bfc329ab80c..58526ab2e534 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_parameters.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_parameters.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyJsObjectBindingPatternMember, JsIdentifierBinding, }; use biome_rowan::AstNode; +use biome_rule_options::no_duplicate_parameters::NoDuplicateParametersOptions; use rustc_hash::FxHashSet; declare_lint_rule! { @@ -52,7 +53,7 @@ impl Rule for NoDuplicateParameters { type Query = Ast; type State = JsIdentifierBinding; type Signals = Option; - type Options = (); + type Options = NoDuplicateParametersOptions; fn run(ctx: &RuleContext) -> Option { let parameters = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_test_hooks.rs b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_test_hooks.rs index 012bc0d82852..b75ce404e9da 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_test_hooks.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_duplicate_test_hooks.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsCallExpression, JsLanguage, TextRange}; use biome_rowan::{AstNode, Language, SyntaxNode, WalkEvent}; +use biome_rule_options::no_duplicate_test_hooks::NoDuplicateTestHooksOptions; declare_lint_rule! { /// A `describe` block should not contain duplicate hooks. @@ -216,7 +217,7 @@ impl Rule for NoDuplicateTestHooks { type Query = DuplicateHooks; type State = (); type Signals = Option; - type Options = (); + type Options = NoDuplicateTestHooksOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_empty_block_statements.rs b/crates/biome_js_analyze/src/lint/suspicious/no_empty_block_statements.rs index d86f377f8b8a..0683a158d08c 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_empty_block_statements.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_empty_block_statements.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ JsStaticInitializationBlockClassMember, JsSwitchStatement, }; use biome_rowan::{AstNode, AstNodeList, SyntaxNodeCast, declare_node_union}; +use biome_rule_options::no_empty_block_statements::NoEmptyBlockStatementsOptions; declare_lint_rule! { /// Disallow empty block statements and static blocks. @@ -78,7 +79,7 @@ impl Rule for NoEmptyBlockStatements { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoEmptyBlockStatementsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_empty_interface.rs b/crates/biome_js_analyze/src/lint/suspicious/no_empty_interface.rs index 81e949a70d58..9cd2ac938a41 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_empty_interface.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_empty_interface.rs @@ -12,6 +12,7 @@ use biome_js_syntax::{ TsTypeAliasDeclaration, }; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, SyntaxResult}; +use biome_rule_options::no_empty_interface::NoEmptyInterfaceOptions; declare_lint_rule! { /// Disallow the declaration of empty interfaces. @@ -59,7 +60,7 @@ impl Rule for NoEmptyInterface { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoEmptyInterfaceOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_evolving_types.rs b/crates/biome_js_analyze/src/lint/suspicious/no_evolving_types.rs index c1790eb8591b..6fba3e879220 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_evolving_types.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_evolving_types.rs @@ -2,6 +2,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, context::RuleContext, declare_lin use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsFileSource, JsVariableDeclaration, JsVariableDeclarator}; +use biome_rule_options::no_evolving_types::NoEvolvingTypesOptions; declare_lint_rule! { /// Disallow variables from evolving into `any` type through reassignments. @@ -60,7 +61,7 @@ impl Rule for NoEvolvingTypes { type Query = Ast; type State = JsVariableDeclarator; type Signals = Option; - type Options = (); + type Options = NoEvolvingTypesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::().language(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_explicit_any.rs b/crates/biome_js_analyze/src/lint/suspicious/no_explicit_any.rs index a794d299208a..a7603ed38c74 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_explicit_any.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_explicit_any.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{TsAnyType, TsTypeConstraintClause}; use biome_rowan::AstNode; +use biome_rule_options::no_explicit_any::NoExplicitAnyOptions; declare_lint_rule! { /// Disallow the `any` type usage. @@ -66,7 +67,7 @@ impl Rule for NoExplicitAny { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoExplicitAnyOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_exports_in_test.rs b/crates/biome_js_analyze/src/lint/suspicious/no_exports_in_test.rs index 2aab7edf4b39..b7e2d66d19dc 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_exports_in_test.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_exports_in_test.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ assign_ext::AnyJsMemberAssignment, }; use biome_rowan::{AstNode, Language, TextRange, WalkEvent, declare_node_union}; +use biome_rule_options::no_exports_in_test::NoExportsInTestOptions; declare_lint_rule! { /// Disallow using `export` or `module.exports` in files containing tests @@ -188,7 +189,7 @@ impl Rule for NoExportsInTest { type Query = AnyExportInTest; type State = (); type Signals = Option; - type Options = (); + type Options = NoExportsInTestOptions; fn run(_: &RuleContext) -> Self::Signals { Some(()) diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_extra_non_null_assertion.rs b/crates/biome_js_analyze/src/lint/suspicious/no_extra_non_null_assertion.rs index e377b2ae2062..4868233e965e 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_extra_non_null_assertion.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_extra_non_null_assertion.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ TsNonNullAssertionExpression, }; use biome_rowan::{AstNode, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_extra_non_null_assertion::NoExtraNonNullAssertionOptions; use crate::JsRuleAction; @@ -65,7 +66,7 @@ impl Rule for NoExtraNonNullAssertion { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoExtraNonNullAssertionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs b/crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs index c5523388e6da..568c2dacff67 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs @@ -9,6 +9,7 @@ use biome_control_flow::{ use biome_diagnostics::Severity; use biome_js_syntax::{JsDefaultClause, JsLanguage, JsSwitchStatement, JsSyntaxNode}; use biome_rowan::{AstNode, AstNodeList, TextRange, WalkEvent}; +use biome_rule_options::no_fallthrough_switch_clause::NoFallthroughSwitchClauseOptions; use roaring::RoaringBitmap; use rustc_hash::FxHashMap; @@ -69,7 +70,7 @@ impl Rule for NoFallthroughSwitchClause { type Query = ControlFlowGraph; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoFallthroughSwitchClauseOptions; fn run(ctx: &RuleContext) -> Self::Signals { let cfg = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_focused_tests.rs b/crates/biome_js_analyze/src/lint/suspicious/no_focused_tests.rs index 2e3ad291bf58..0775485bb44f 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_focused_tests.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_focused_tests.rs @@ -8,6 +8,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, JsCallExpression, JsLanguage, TextRange}; use biome_rowan::{AstNode, BatchMutation, BatchMutationExt, NodeOrToken, TokenText}; +use biome_rule_options::no_focused_tests::NoFocusedTestsOptions; declare_lint_rule! { /// Disallow focused tests. @@ -67,7 +68,7 @@ impl Rule for NoFocusedTests { type Query = Ast; type State = FunctionNameAndRange; type Signals = Option; - type Options = (); + type Options = NoFocusedTestsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_function_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_function_assign.rs index 97d03b83025e..05cf9ccf6af3 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_function_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_function_assign.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_semantic::{Reference, ReferencesExtensions}; use biome_js_syntax::{JsFunctionDeclaration, JsIdentifierBinding}; use biome_rowan::AstNode; +use biome_rule_options::no_function_assign::NoFunctionAssignOptions; declare_lint_rule! { /// Disallow reassigning function declarations. @@ -113,7 +114,7 @@ impl Rule for NoFunctionAssign { type Query = Semantic; type State = State; type Signals = Option; - type Options = (); + type Options = NoFunctionAssignOptions; fn run(ctx: &RuleContext) -> Option { let declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_global_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_global_assign.rs index 2d69078a43f2..d21fc0b7dabf 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_global_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_global_assign.rs @@ -6,6 +6,7 @@ use biome_analyze::{Rule, RuleDiagnostic, context::RuleContext, declare_lint_rul use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsSyntaxKind, TextRange}; +use biome_rule_options::no_global_assign::NoGlobalAssignOptions; declare_lint_rule! { /// Disallow assignments to native objects and read-only global variables. @@ -53,7 +54,7 @@ impl Rule for NoGlobalAssign { type Query = SemanticServices; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoGlobalAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let global_refs = ctx.query().all_unresolved_references(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_global_is_finite.rs b/crates/biome_js_analyze/src/lint/suspicious/no_global_is_finite.rs index 247801b8a08c..29a54d700419 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_global_is_finite.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_global_is_finite.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, T, global_identifier}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_global_is_finite::NoGlobalIsFiniteOptions; declare_lint_rule! { /// Use `Number.isFinite` instead of global `isFinite`. @@ -41,7 +42,7 @@ impl Rule for NoGlobalIsFinite { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoGlobalIsFiniteOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_global_is_nan.rs b/crates/biome_js_analyze/src/lint/suspicious/no_global_is_nan.rs index 3d2efce9e8c0..82f535c653ad 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_global_is_nan.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_global_is_nan.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, T, global_identifier}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_global_is_nan::NoGlobalIsNanOptions; declare_lint_rule! { /// Use `Number.isNaN` instead of global `isNaN`. @@ -42,7 +43,7 @@ impl Rule for NoGlobalIsNan { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoGlobalIsNanOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_head_import_in_document.rs b/crates/biome_js_analyze/src/lint/suspicious/no_head_import_in_document.rs index ce12303dd291..189db6f4f102 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_head_import_in_document.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_head_import_in_document.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsFileSource, JsImport}; use biome_rowan::AstNode; +use biome_rule_options::no_head_import_in_document::NoHeadImportInDocumentOptions; use std::path::MAIN_SEPARATOR; declare_lint_rule! { @@ -58,7 +59,7 @@ impl Rule for NoHeadImportInDocument { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoHeadImportInDocumentOptions; fn run(ctx: &RuleContext) -> Self::Signals { if !ctx.source_type::().is_jsx() { diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_implicit_any_let.rs b/crates/biome_js_analyze/src/lint/suspicious/no_implicit_any_let.rs index a3d21f35929e..ebe827e59c94 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_implicit_any_let.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_implicit_any_let.rs @@ -2,6 +2,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, context::RuleContext, declare_lin use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsFileSource, JsVariableDeclaration, JsVariableDeclarator}; +use biome_rule_options::no_implicit_any_let::NoImplicitAnyLetOptions; declare_lint_rule! { /// Disallow use of implicit `any` type on variable declarations. @@ -47,7 +48,7 @@ impl Rule for NoImplicitAnyLet { type Query = Ast; type State = JsVariableDeclarator; type Signals = Option; - type Options = (); + type Options = NoImplicitAnyLetOptions; fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::().language(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_import_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_import_assign.rs index 0b85038356e8..287b733fe8f7 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_import_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_import_assign.rs @@ -6,6 +6,7 @@ use biome_js_semantic::ReferencesExtensions; use biome_js_syntax::{AnyJsImportSpecifier, JsIdentifierAssignment, JsIdentifierBinding}; use biome_rowan::AstNode; +use biome_rule_options::no_import_assign::NoImportAssignOptions; declare_lint_rule! { /// Disallow assigning to imported bindings @@ -62,7 +63,7 @@ impl Rule for NoImportAssign { /// The first element of the tuple is the invalid `JsIdentifierAssignment`, the second element of the tuple is the imported `JsIdentifierBinding`. type State = (JsIdentifierAssignment, JsIdentifierBinding); type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoImportAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let label_statement = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_irregular_whitespace.rs b/crates/biome_js_analyze/src/lint/suspicious/no_irregular_whitespace.rs index 0d57efa75cab..493f4d09ae95 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_irregular_whitespace.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_irregular_whitespace.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsRoot, JsLanguage, JsSyntaxNode}; use biome_rowan::{AstNode, Direction, SyntaxTriviaPiece, TextRange}; +use biome_rule_options::no_irregular_whitespace::NoIrregularWhitespaceOptions; const IRREGULAR_WHITESPACES: &[char; 22] = &[ '\u{c}', '\u{b}', '\u{85}', '\u{feff}', '\u{a0}', '\u{1680}', '\u{180e}', '\u{2000}', @@ -52,7 +53,7 @@ impl Rule for NoIrregularWhitespace { type Query = Ast; type State = TextRange; type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoIrregularWhitespaceOptions; fn run(ctx: &RuleContext) -> Self::Signals { get_irregular_whitespace(ctx.query().syntax()).into_boxed_slice() diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_label_var.rs b/crates/biome_js_analyze/src/lint/suspicious/no_label_var.rs index 97b08decf863..83ed1d49d7c2 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_label_var.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_label_var.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsLabeledStatement, JsSyntaxNode, JsSyntaxToken}; use biome_rowan::AstNode; +use biome_rule_options::no_label_var::NoLabelVarOptions; declare_lint_rule! { /// Disallow labels that share a name with a variable @@ -38,7 +39,7 @@ impl Rule for NoLabelVar { /// The first element of the tuple is the name of the binding, the second element of the tuple is the label name type State = (JsSyntaxNode, JsSyntaxToken); type Signals = Option; - type Options = (); + type Options = NoLabelVarOptions; fn run(ctx: &RuleContext) -> Option { let label_statement = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_misleading_character_class.rs b/crates/biome_js_analyze/src/lint/suspicious/no_misleading_character_class.rs index 9be9d30bca61..0a6868e8e9f8 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_misleading_character_class.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_misleading_character_class.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsRegexLiteralExpression, JsSyntaxKind, JsSyntaxToken}; use biome_rowan::{AstNode, BatchMutationExt, TextRange}; +use biome_rule_options::no_misleading_character_class::NoMisleadingCharacterClassOptions; declare_lint_rule! { /// Disallow characters made with multiple code points in character class syntax. @@ -119,7 +120,7 @@ impl Rule for NoMisleadingCharacterClass { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoMisleadingCharacterClassOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_misleading_instantiator.rs b/crates/biome_js_analyze/src/lint/suspicious/no_misleading_instantiator.rs index 471f8d96acc8..d93f38ade5ca 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_misleading_instantiator.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_misleading_instantiator.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ TsTypeAliasDeclaration, }; use biome_rowan::{AstNode, TextRange, declare_node_union}; +use biome_rule_options::no_misleading_instantiator::NoMisleadingInstantiatorOptions; declare_lint_rule! { /// Enforce proper usage of `new` and `constructor`. @@ -127,7 +128,7 @@ impl Rule for NoMisleadingInstantiator { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoMisleadingInstantiatorOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_misplaced_assertion.rs b/crates/biome_js_analyze/src/lint/suspicious/no_misplaced_assertion.rs index c5b70fc0d306..871bccd49ddf 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_misplaced_assertion.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_misplaced_assertion.rs @@ -5,6 +5,7 @@ use biome_deserialize::TextRange; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsCallExpression, JsIdentifierBinding, JsImport}; use biome_rowan::AstNode; +use biome_rule_options::no_misplaced_assertion::NoMisplacedAssertionOptions; declare_lint_rule! { /// Checks that the assertion function, for example `expect`, is placed inside an `it()` function call. @@ -140,7 +141,7 @@ impl Rule for NoMisplacedAssertion { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoMisplacedAssertionOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_misrefactored_shorthand_assign.rs b/crates/biome_js_analyze/src/lint/suspicious/no_misrefactored_shorthand_assign.rs index 357722cb6ab5..39dab49b2ea0 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_misrefactored_shorthand_assign.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_misrefactored_shorthand_assign.rs @@ -7,6 +7,7 @@ use biome_js_syntax::{ AnyJsExpression, JsAssignmentExpression, JsAssignmentOperator, JsBinaryExpression, }; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::no_misrefactored_shorthand_assign::NoMisrefactoredShorthandAssignOptions; use crate::{ JsRuleAction, @@ -63,7 +64,7 @@ impl Rule for NoMisrefactoredShorthandAssign { type Query = Ast; type State = AnyJsExpression; type Signals = Option; - type Options = (); + type Options = NoMisrefactoredShorthandAssignOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_octal_escape.rs b/crates/biome_js_analyze/src/lint/suspicious/no_octal_escape.rs index 4cbbe60487e7..0b33cb1a783b 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_octal_escape.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_octal_escape.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsSyntaxToken; use biome_rowan::{BatchMutationExt, TextRange}; +use biome_rule_options::no_octal_escape::NoOctalEscapeOptions; use crate::{JsRuleAction, lint::correctness::no_nonoctal_decimal_escape::AnyJsStringLiteral}; @@ -44,7 +45,7 @@ impl Rule for NoOctalEscape { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoOctalEscapeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let token = ctx.query().string_literal_token()?; diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_prototype_builtins.rs b/crates/biome_js_analyze/src/lint/suspicious/no_prototype_builtins.rs index 1c8f8ab011a9..d035911b5354 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_prototype_builtins.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_prototype_builtins.rs @@ -11,6 +11,7 @@ use biome_js_syntax::{ TextRange, }; use biome_rowan::{AstNode, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::no_prototype_builtins::NoPrototypeBuiltinsOptions; declare_lint_rule! { /// Disallow direct use of `Object.prototype` builtins. @@ -76,7 +77,7 @@ impl Rule for NoPrototypeBuiltins { type Query = Semantic; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoPrototypeBuiltinsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let call_expr = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_react_specific_props.rs b/crates/biome_js_analyze/src/lint/suspicious/no_react_specific_props.rs index f5ce7c472e68..195f90781a84 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_react_specific_props.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_react_specific_props.rs @@ -8,6 +8,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make::{jsx_ident, jsx_name}; use biome_js_syntax::{AnyJsxAttributeName, JsxAttribute}; use biome_rowan::{AstNode, BatchMutationExt, TextRange}; +use biome_rule_options::no_react_specific_props::NoReactSpecificPropsOptions; declare_lint_rule! { /// Prevents React-specific JSX properties from being used. @@ -54,7 +55,7 @@ impl Rule for NoReactSpecificProps { type Query = Ast; type State = (TextRange, &'static str); type Signals = Option; - type Options = (); + type Options = NoReactSpecificPropsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let attribute = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_redeclare.rs b/crates/biome_js_analyze/src/lint/suspicious/no_redeclare.rs index 773ed57942e8..7f875a26f566 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_redeclare.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_redeclare.rs @@ -7,6 +7,7 @@ use biome_js_semantic::Scope; use biome_js_syntax::binding_ext::AnyJsBindingDeclaration; use biome_js_syntax::{JsSyntaxKind, TextRange}; use biome_rowan::AstNode; +use biome_rule_options::no_redeclare::NoRedeclareOptions; use rustc_hash::FxHashMap; declare_lint_rule! { @@ -83,7 +84,7 @@ impl Rule for NoRedeclare { type Query = SemanticServices; type State = Redeclaration; type Signals = Box<[Redeclaration]>; - type Options = (); + type Options = NoRedeclareOptions; fn run(ctx: &RuleContext) -> Self::Signals { let mut redeclarations = Vec::default(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_redundant_use_strict.rs b/crates/biome_js_analyze/src/lint/suspicious/no_redundant_use_strict.rs index d4b9514d3b7e..4050a95c8f26 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_redundant_use_strict.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_redundant_use_strict.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::{ AnyJsClass, JsDirective, JsDirectiveList, JsFileSource, JsFunctionBody, JsModule, JsScript, }; +use biome_rule_options::no_redundant_use_strict::NoRedundantUseStrictOptions; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, declare_node_union}; @@ -109,7 +110,7 @@ impl Rule for NoRedundantUseStrict { type Query = Ast; type State = AnyJsStrictModeNode; type Signals = Option; - type Options = (); + type Options = NoRedundantUseStrictOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_self_compare.rs b/crates/biome_js_analyze/src/lint/suspicious/no_self_compare.rs index d9a58182d720..75a5fadc4bcd 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_self_compare.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_self_compare.rs @@ -4,6 +4,7 @@ use biome_analyze::{Ast, Rule, RuleDiagnostic, RuleSource, declare_lint_rule}; use biome_diagnostics::Severity; use biome_js_syntax::JsBinaryExpression; use biome_rowan::AstNode; +use biome_rule_options::no_self_compare::NoSelfCompareOptions; declare_lint_rule! { /// Disallow comparisons where both sides are exactly the same. @@ -42,7 +43,7 @@ impl Rule for NoSelfCompare { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoSelfCompareOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_shadow_restricted_names.rs b/crates/biome_js_analyze/src/lint/suspicious/no_shadow_restricted_names.rs index cc18a8f80636..114834fb2482 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_shadow_restricted_names.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_shadow_restricted_names.rs @@ -6,6 +6,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsIdentifierBinding; use biome_rowan::AstNode; +use biome_rule_options::no_shadow_restricted_names::NoShadowRestrictedNamesOptions; declare_lint_rule! { /// Disallow identifiers from shadowing restricted names. @@ -53,7 +54,7 @@ impl Rule for NoShadowRestrictedNames { type Query = Ast; type State = State; type Signals = Option; - type Options = (); + type Options = NoShadowRestrictedNamesOptions; fn run(ctx: &RuleContext) -> Option { let binding = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_skipped_tests.rs b/crates/biome_js_analyze/src/lint/suspicious/no_skipped_tests.rs index 246aec699583..b09c086004ae 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_skipped_tests.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_skipped_tests.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::JsCallExpression; use biome_rowan::{BatchMutationExt, TextRange}; +use biome_rule_options::no_skipped_tests::NoSkippedTestsOptions; use crate::JsRuleAction; @@ -53,7 +54,7 @@ impl Rule for NoSkippedTests { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoSkippedTestsOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_sparse_array.rs b/crates/biome_js_analyze/src/lint/suspicious/no_sparse_array.rs index 10d22e04b76a..7edaae485a91 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_sparse_array.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_sparse_array.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsArrayElement, AnyJsExpression, JsArrayExpression, TriviaPieceKind}; use biome_rowan::{AstNode, AstNodeExt, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::no_sparse_array::NoSparseArrayOptions; use crate::JsRuleAction; @@ -15,7 +16,7 @@ declare_lint_rule! { /// Sparse arrays may contain empty slots due to the use of multiple commas between two items, like the following: /// /// ```js,ignore - /// const items = [a,,,b]; + /// const items = [a,,b]; /// ``` /// Arrays with holes might yield incorrect information. For example, the previous snippet, `items` has a length of `4`, but did the user /// really intended to have an array with four items? Or was it a typo. @@ -50,7 +51,7 @@ impl Rule for NoSparseArray { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoSparseArrayOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_suspicious_semicolon_in_jsx.rs b/crates/biome_js_analyze/src/lint/suspicious/no_suspicious_semicolon_in_jsx.rs index 6494f2a33cb9..1f610d230917 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_suspicious_semicolon_in_jsx.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_suspicious_semicolon_in_jsx.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsxTag, JsxChildList}; use biome_rowan::{AstNodeList, TextRange}; +use biome_rule_options::no_suspicious_semicolon_in_jsx::NoSuspiciousSemicolonInJsxOptions; declare_lint_rule! { /// It detects possible "wrong" semicolons inside JSX elements. @@ -56,7 +57,7 @@ impl Rule for NoSuspiciousSemicolonInJsx { type Query = Ast; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoSuspiciousSemicolonInJsxOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_template_curly_in_string.rs b/crates/biome_js_analyze/src/lint/suspicious/no_template_curly_in_string.rs index e6a1d6baedea..cc97affa2915 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_template_curly_in_string.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_template_curly_in_string.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::JsStringLiteralExpression; use biome_rowan::{TextRange, TextSize}; +use biome_rule_options::no_template_curly_in_string::NoTemplateCurlyInStringOptions; declare_lint_rule! { /// Disallow template literal placeholder syntax in regular strings. @@ -53,7 +54,7 @@ impl Rule for NoTemplateCurlyInString { type Query = Ast; type State = (u32, u32); type Signals = Option; - type Options = (); + type Options = NoTemplateCurlyInStringOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_then_property.rs b/crates/biome_js_analyze/src/lint/suspicious/no_then_property.rs index 807390bd0fa0..f40f7a8215a6 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_then_property.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_then_property.rs @@ -12,6 +12,7 @@ use biome_js_syntax::{ JsComputedMemberName, JsExport, }; use biome_rowan::{AstNode, AstSeparatedList, TextRange, declare_node_union}; +use biome_rule_options::no_then_property::NoThenPropertyOptions; declare_lint_rule! { /// Disallow `then` property. @@ -133,7 +134,7 @@ impl Rule for NoThenProperty { type Query = Ast; type State = RuleState; type Signals = Option; - type Options = (); + type Options = NoThenPropertyOptions; fn run(ctx: &RuleContext) -> Self::Signals { let binding = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_declaration_merging.rs b/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_declaration_merging.rs index 0ede86b9a6ea..87590802b952 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_declaration_merging.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_declaration_merging.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{TsInterfaceDeclaration, binding_ext::AnyJsBindingDeclaration}; use biome_rowan::{AstNode, TextRange}; +use biome_rule_options::no_unsafe_declaration_merging::NoUnsafeDeclarationMergingOptions; declare_lint_rule! { /// Disallow unsafe declaration merging between interfaces and classes. @@ -55,7 +56,7 @@ impl Rule for NoUnsafeDeclarationMerging { type Query = Semantic; type State = TextRange; type Signals = Option; - type Options = (); + type Options = NoUnsafeDeclarationMergingOptions; fn run(ctx: &RuleContext) -> Self::Signals { let ts_interface = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_negation.rs b/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_negation.rs index dedec80e4216..e1ac4217b613 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_negation.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_unsafe_negation.rs @@ -7,6 +7,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{AnyJsExpression, JsInExpression, JsInstanceofExpression, is_negation}; use biome_rowan::{AstNode, AstNodeExt, BatchMutationExt, declare_node_union}; +use biome_rule_options::no_unsafe_negation::NoUnsafeNegationOptions; declare_lint_rule! { /// Disallow using unsafe negation. @@ -47,7 +48,7 @@ impl Rule for NoUnsafeNegation { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoUnsafeNegationOptions; fn run(ctx: &RuleContext) -> Option { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_var.rs b/crates/biome_js_analyze/src/lint/suspicious/no_var.rs index f40715a3cc00..e18517c06c65 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_var.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_var.rs @@ -10,6 +10,7 @@ use biome_js_factory::make; use biome_js_syntax::{ AnyJsVariableDeclaration, JsModule, JsScript, JsSyntaxKind, TsGlobalDeclaration, }; +use biome_rule_options::no_var::NoVarOptions; use crate::lint::style::use_const::ConstBindings; use biome_rowan::{AstNode, BatchMutationExt}; @@ -50,7 +51,7 @@ impl Rule for NoVar { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = NoVarOptions; fn run(ctx: &RuleContext) -> Self::Signals { let declaration = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/no_with.rs b/crates/biome_js_analyze/src/lint/suspicious/no_with.rs index 6fb8cc51a18c..be1090859fd8 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/no_with.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/no_with.rs @@ -5,6 +5,7 @@ use biome_diagnostics::Severity; use biome_js_syntax::JsWithStatement; use biome_rowan::AstNode; +use biome_rule_options::no_with::NoWithOptions; declare_lint_rule! { /// Disallow `with` statements in non-strict contexts. @@ -37,7 +38,7 @@ impl Rule for NoWith { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = NoWithOptions; fn run(_ctx: &RuleContext) -> Option { Some(()) diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_adjacent_overload_signatures.rs b/crates/biome_js_analyze/src/lint/suspicious/use_adjacent_overload_signatures.rs index 74f8d64a5ed6..5a4ba4a0c536 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_adjacent_overload_signatures.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_adjacent_overload_signatures.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ TsTypeMemberList, }; use biome_rowan::{AstNode, TextRange, TokenText, declare_node_union}; +use biome_rule_options::use_adjacent_overload_signatures::UseAdjacentOverloadSignaturesOptions; use rustc_hash::FxHashSet; declare_lint_rule! { @@ -104,7 +105,7 @@ impl Rule for UseAdjacentOverloadSignatures { type Query = Ast; type State = Box<[(TokenText, TextRange)]>; type Signals = Option; - type Options = (); + type Options = UseAdjacentOverloadSignaturesOptions; fn run(ctx: &RuleContext) -> Self::Signals { let methods = match ctx.query() { diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_await.rs b/crates/biome_js_analyze/src/lint/suspicious/use_await.rs index 98828273b55c..a2e29e8d989a 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_await.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_await.rs @@ -8,6 +8,7 @@ use biome_js_syntax::{ AnyFunctionLike, JsAwaitExpression, JsForOfStatement, JsLanguage, TextRange, WalkEvent, }; use biome_rowan::{AstNode, AstNodeList, Language, SyntaxNode, TextSize}; +use biome_rule_options::use_await::UseAwaitOptions; declare_lint_rule! { /// Ensure `async` functions utilize `await`. @@ -135,7 +136,7 @@ impl Rule for UseAwait { type Query = MissingAwait; type State = (); type Signals = Option; - type Options = (); + type Options = UseAwaitOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_default_switch_clause_last.rs b/crates/biome_js_analyze/src/lint/suspicious/use_default_switch_clause_last.rs index a532d4e984db..0f8dfa1ca2ac 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_default_switch_clause_last.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_default_switch_clause_last.rs @@ -4,6 +4,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{JsCaseClause, JsDefaultClause}; use biome_rowan::{AstNode, Direction}; +use biome_rule_options::use_default_switch_clause_last::UseDefaultSwitchClauseLastOptions; declare_lint_rule! { /// Enforce default clauses in switch statements to be last @@ -84,7 +85,7 @@ impl Rule for UseDefaultSwitchClauseLast { type Query = Ast; type State = JsCaseClause; type Signals = Option; - type Options = (); + type Options = UseDefaultSwitchClauseLastOptions; fn run(ctx: &RuleContext) -> Self::Signals { let default_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_error_message.rs b/crates/biome_js_analyze/src/lint/suspicious/use_error_message.rs index e18a546c8983..2777401fbe2f 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_error_message.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_error_message.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsExpression, JsNewOrCallExpression, global_identifier}; use biome_rowan::AstNode; +use biome_rule_options::use_error_message::UseErrorMessageOptions; use crate::services::semantic::Semantic; @@ -54,7 +55,7 @@ impl Rule for UseErrorMessage { type Query = Semantic; type State = UseErrorMessageRule; type Signals = Option; - type Options = (); + type Options = UseErrorMessageOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_getter_return.rs b/crates/biome_js_analyze/src/lint/suspicious/use_getter_return.rs index 4defa664a30e..0d90605c7356 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_getter_return.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_getter_return.rs @@ -5,6 +5,7 @@ use biome_control_flow::{ExceptionHandlerKind, InstructionKind, builder::ROOT_BL use biome_diagnostics::Severity; use biome_js_syntax::{JsGetterClassMember, JsGetterObjectMember, JsReturnStatement}; use biome_rowan::{AstNode, NodeOrToken, TextRange}; +use biome_rule_options::use_getter_return::UseGetterReturnOptions; use roaring::RoaringBitmap; declare_lint_rule! { @@ -72,7 +73,7 @@ impl Rule for UseGetterReturn { type Query = ControlFlowGraph; type State = InvalidGetterReturn; type Signals = Box<[Self::State]>; - type Options = (); + type Options = UseGetterReturnOptions; fn run(ctx: &RuleContext) -> Self::Signals { let cfg = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_google_font_display.rs b/crates/biome_js_analyze/src/lint/suspicious/use_google_font_display.rs index 0af26cea7c23..21a57825bade 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_google_font_display.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_google_font_display.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::jsx_ext::AnyJsxElement; use biome_rowan::TextRange; +use biome_rule_options::use_google_font_display::UseGoogleFontDisplayOptions; declare_lint_rule! { /// Enforces the use of a recommended `display` strategy with Google Fonts. @@ -70,7 +71,7 @@ impl Rule for UseGoogleFontDisplay { type Query = Ast; type State = (FontDisplayIssue, TextRange); type Signals = Option; - type Options = (); + type Options = UseGoogleFontDisplayOptions; fn run(ctx: &RuleContext) -> Self::Signals { let element = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_guard_for_in.rs b/crates/biome_js_analyze/src/lint/suspicious/use_guard_for_in.rs index 9f3e717609dc..ffe45130df5e 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_guard_for_in.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_guard_for_in.rs @@ -5,6 +5,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_js_syntax::{AnyJsStatement, JsForInStatement}; use biome_rowan::{AstNode, AstNodeList}; +use biome_rule_options::use_guard_for_in::UseGuardForInOptions; declare_lint_rule! { /// Require `for-in` loops to include an `if` statement. @@ -66,7 +67,7 @@ impl Rule for UseGuardForIn { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseGuardForInOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_is_array.rs b/crates/biome_js_analyze/src/lint/suspicious/use_is_array.rs index c21881bc2c66..e8dee8a0fdf4 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_is_array.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_is_array.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ AnyJsCallArgument, AnyJsExpression, JsInstanceofExpression, T, global_identifier, }; use biome_rowan::{AstNode, BatchMutationExt, trim_leading_trivia_pieces}; +use biome_rule_options::use_is_array::UseIsArrayOptions; declare_lint_rule! { /// Use `Array.isArray()` instead of `instanceof Array`. @@ -51,7 +52,7 @@ impl Rule for UseIsArray { type Query = Semantic; type State = (); type Signals = Option; - type Options = (); + type Options = UseIsArrayOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_namespace_keyword.rs b/crates/biome_js_analyze/src/lint/suspicious/use_namespace_keyword.rs index 12503737896e..d23045a4576a 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_namespace_keyword.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_namespace_keyword.rs @@ -6,6 +6,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make; use biome_js_syntax::{JsSyntaxToken, T, TsModuleDeclaration}; use biome_rowan::BatchMutationExt; +use biome_rule_options::use_namespace_keyword::UseNamespaceKeywordOptions; use crate::JsRuleAction; @@ -55,7 +56,7 @@ impl Rule for UseNamespaceKeyword { type Query = Ast; type State = JsSyntaxToken; type Signals = Option; - type Options = (); + type Options = UseNamespaceKeywordOptions; fn run(ctx: &RuleContext) -> Self::Signals { let ts_module = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_number_to_fixed_digits_argument.rs b/crates/biome_js_analyze/src/lint/suspicious/use_number_to_fixed_digits_argument.rs index 572d7eb2382c..72fe57b1eeaa 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_number_to_fixed_digits_argument.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_number_to_fixed_digits_argument.rs @@ -9,6 +9,7 @@ use biome_js_syntax::{ JsCallExpression, JsSyntaxKind, }; use biome_rowan::{AstNode, AstSeparatedList, BatchMutationExt}; +use biome_rule_options::use_number_to_fixed_digits_argument::UseNumberToFixedDigitsArgumentOptions; use crate::JsRuleAction; @@ -55,7 +56,7 @@ impl Rule for UseNumberToFixedDigitsArgument { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseNumberToFixedDigitsArgumentOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/suspicious/use_strict_mode.rs b/crates/biome_js_analyze/src/lint/suspicious/use_strict_mode.rs index 59fc9f7d1926..20a7a267ddeb 100644 --- a/crates/biome_js_analyze/src/lint/suspicious/use_strict_mode.rs +++ b/crates/biome_js_analyze/src/lint/suspicious/use_strict_mode.rs @@ -8,6 +8,7 @@ use biome_diagnostics::Severity; use biome_js_factory::make::{js_directive, js_directive_list, token}; use biome_js_syntax::{JsScript, JsSyntaxKind, JsSyntaxToken, T}; use biome_rowan::{AstNode, AstNodeList, BatchMutationExt, TriviaPieceKind}; +use biome_rule_options::use_strict_mode::UseStrictModeOptions; declare_lint_rule! { /// Enforce the use of the directive `"use strict"` in script files. @@ -49,7 +50,7 @@ impl Rule for UseStrictMode { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseStrictModeOptions; fn run(ctx: &RuleContext) -> Self::Signals { let node = ctx.query(); diff --git a/crates/biome_js_analyze/src/options.rs b/crates/biome_js_analyze/src/options.rs deleted file mode 100644 index 3881dfefc69c..000000000000 --- a/crates/biome_js_analyze/src/options.rs +++ /dev/null @@ -1,481 +0,0 @@ -//! Generated file, do not edit by hand, see `xtask/codegen` - -//! Generated file, do not edit by hand, see `xtask/codegen` - -use crate::assist; -use crate::lint; -pub type NoAccessKey = ::Options; -pub type NoAccumulatingSpread = < lint :: performance :: no_accumulating_spread :: NoAccumulatingSpread as biome_analyze :: Rule > :: Options ; -pub type NoAdjacentSpacesInRegex = < lint :: complexity :: no_adjacent_spaces_in_regex :: NoAdjacentSpacesInRegex as biome_analyze :: Rule > :: Options ; -pub type NoAlert = ::Options; -pub type NoApproximativeNumericConstant = < lint :: suspicious :: no_approximative_numeric_constant :: NoApproximativeNumericConstant as biome_analyze :: Rule > :: Options ; -pub type NoArguments = - ::Options; -pub type NoAriaHiddenOnFocusable = < lint :: a11y :: no_aria_hidden_on_focusable :: NoAriaHiddenOnFocusable as biome_analyze :: Rule > :: Options ; -pub type NoAriaUnsupportedElements = < lint :: a11y :: no_aria_unsupported_elements :: NoAriaUnsupportedElements as biome_analyze :: Rule > :: Options ; -pub type NoArrayIndexKey = - ::Options; -pub type NoAssignInExpressions = < lint :: suspicious :: no_assign_in_expressions :: NoAssignInExpressions as biome_analyze :: Rule > :: Options ; -pub type NoAsyncPromiseExecutor = < lint :: suspicious :: no_async_promise_executor :: NoAsyncPromiseExecutor as biome_analyze :: Rule > :: Options ; -pub type NoAutofocus = ::Options; -pub type NoAwaitInLoop = - ::Options; -pub type NoBannedTypes = - ::Options; -pub type NoBarrelFile = - ::Options; -pub type NoBitwiseOperators = - ::Options; -pub type NoBlankTarget = - ::Options; -pub type NoCatchAssign = - ::Options; -pub type NoChildrenProp = - ::Options; -pub type NoClassAssign = - ::Options; -pub type NoCommaOperator = - ::Options; -pub type NoCommentText = - ::Options; -pub type NoCommonJs = ::Options; -pub type NoCompareNegZero = - ::Options; -pub type NoConfusingLabels = - ::Options; -pub type NoConfusingVoidType = - ::Options; -pub type NoConsole = ::Options; -pub type NoConstAssign = - ::Options; -pub type NoConstEnum = - ::Options; -pub type NoConstantBinaryExpression = < lint :: nursery :: no_constant_binary_expression :: NoConstantBinaryExpression as biome_analyze :: Rule > :: Options ; -pub type NoConstantCondition = - ::Options; -pub type NoConstantMathMinMaxClamp = < lint :: correctness :: no_constant_math_min_max_clamp :: NoConstantMathMinMaxClamp as biome_analyze :: Rule > :: Options ; -pub type NoConstructorReturn = - ::Options; -pub type NoControlCharactersInRegex = < lint :: suspicious :: no_control_characters_in_regex :: NoControlCharactersInRegex as biome_analyze :: Rule > :: Options ; -pub type NoDangerouslySetInnerHtml = < lint :: security :: no_dangerously_set_inner_html :: NoDangerouslySetInnerHtml as biome_analyze :: Rule > :: Options ; -pub type NoDangerouslySetInnerHtmlWithChildren = < lint :: 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 NoDestructuredProps = - ::Options; -pub type NoDistractingElements = - ::Options; -pub type NoDocumentCookie = - ::Options; -pub type NoDocumentImportInPage = < lint :: suspicious :: no_document_import_in_page :: NoDocumentImportInPage as biome_analyze :: Rule > :: Options ; -pub type NoDoneCallback = - ::Options; -pub type NoDoubleEquals = - ::Options; -pub type NoDuplicateCase = - ::Options; -pub type NoDuplicateClassMembers = < lint :: suspicious :: no_duplicate_class_members :: NoDuplicateClassMembers as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateElseIf = - ::Options; -pub type NoDuplicateJsxProps = - ::Options; -pub type NoDuplicateObjectKeys = < lint :: suspicious :: no_duplicate_object_keys :: NoDuplicateObjectKeys as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateParameters = < lint :: suspicious :: no_duplicate_parameters :: NoDuplicateParameters as biome_analyze :: Rule > :: Options ; -pub type NoDuplicateTestHooks = < lint :: suspicious :: no_duplicate_test_hooks :: NoDuplicateTestHooks as biome_analyze :: Rule > :: Options ; -pub type NoDynamicNamespaceImportAccess = < lint :: performance :: no_dynamic_namespace_import_access :: NoDynamicNamespaceImportAccess as biome_analyze :: Rule > :: Options ; -pub type NoEmptyBlockStatements = < lint :: suspicious :: no_empty_block_statements :: NoEmptyBlockStatements as biome_analyze :: Rule > :: Options ; -pub type NoEmptyCharacterClassInRegex = < lint :: correctness :: no_empty_character_class_in_regex :: NoEmptyCharacterClassInRegex as biome_analyze :: Rule > :: Options ; -pub type NoEmptyInterface = - ::Options; -pub type NoEmptyPattern = - ::Options; -pub type NoEmptyTypeParameters = < lint :: complexity :: no_empty_type_parameters :: NoEmptyTypeParameters as biome_analyze :: Rule > :: Options ; -pub type NoEnum = ::Options; -pub type NoEvolvingTypes = - ::Options; -pub type NoExcessiveCognitiveComplexity = < lint :: complexity :: no_excessive_cognitive_complexity :: NoExcessiveCognitiveComplexity as biome_analyze :: Rule > :: Options ; -pub type NoExcessiveLinesPerFunction = < lint :: nursery :: no_excessive_lines_per_function :: NoExcessiveLinesPerFunction as biome_analyze :: Rule > :: Options ; -pub type NoExcessiveNestedTestSuites = < lint :: complexity :: no_excessive_nested_test_suites :: NoExcessiveNestedTestSuites as biome_analyze :: Rule > :: Options ; -pub type NoExplicitAny = - ::Options; -pub type NoExportedImports = - ::Options; -pub type NoExportsInTest = - ::Options; -pub type NoExtraBooleanCast = - ::Options; -pub type NoExtraNonNullAssertion = < lint :: suspicious :: no_extra_non_null_assertion :: NoExtraNonNullAssertion as biome_analyze :: Rule > :: Options ; -pub type NoFallthroughSwitchClause = < lint :: suspicious :: no_fallthrough_switch_clause :: NoFallthroughSwitchClause as biome_analyze :: Rule > :: Options ; -pub type NoFlatMapIdentity = - ::Options; -pub type NoFloatingPromises = - ::Options; -pub type NoFocusedTests = - ::Options; -pub type NoForEach = ::Options; -pub type NoFunctionAssign = - ::Options; -pub type NoGlobalAssign = - ::Options; -pub type NoGlobalDirnameFilename = < lint :: nursery :: no_global_dirname_filename :: NoGlobalDirnameFilename as biome_analyze :: Rule > :: Options ; -pub type NoGlobalEval = - ::Options; -pub type NoGlobalIsFinite = - ::Options; -pub type NoGlobalIsNan = - ::Options; -pub type NoGlobalObjectCalls = < lint :: correctness :: no_global_object_calls :: NoGlobalObjectCalls as biome_analyze :: Rule > :: Options ; -pub type NoHeadElement = - ::Options; -pub type NoHeadImportInDocument = < lint :: suspicious :: no_head_import_in_document :: NoHeadImportInDocument as biome_analyze :: Rule > :: Options ; -pub type NoHeaderScope = - ::Options; -pub type NoImgElement = - ::Options; -pub type NoImplicitAnyLet = - ::Options; -pub type NoImplicitBoolean = - ::Options; -pub type NoImplicitCoercion = - ::Options; -pub type NoImportAssign = - ::Options; -pub type NoImportCycles = - ::Options; -pub type NoInferrableTypes = - ::Options; -pub type NoInnerDeclarations = - ::Options; -pub type NoInteractiveElementToNoninteractiveRole = < lint :: a11y :: no_interactive_element_to_noninteractive_role :: NoInteractiveElementToNoninteractiveRole as biome_analyze :: Rule > :: Options ; -pub type NoInvalidBuiltinInstantiation = < lint :: correctness :: no_invalid_builtin_instantiation :: NoInvalidBuiltinInstantiation as biome_analyze :: Rule > :: Options ; -pub type NoInvalidConstructorSuper = < lint :: correctness :: no_invalid_constructor_super :: NoInvalidConstructorSuper as biome_analyze :: Rule > :: Options ; -pub type NoInvalidUseBeforeDeclaration = < lint :: correctness :: no_invalid_use_before_declaration :: NoInvalidUseBeforeDeclaration as biome_analyze :: Rule > :: Options ; -pub type NoIrregularWhitespace = < lint :: suspicious :: no_irregular_whitespace :: NoIrregularWhitespace as biome_analyze :: Rule > :: Options ; -pub type NoLabelVar = ::Options; -pub type NoLabelWithoutControl = - ::Options; -pub type NoMagicNumbers = - ::Options; -pub type NoMisleadingCharacterClass = < lint :: suspicious :: no_misleading_character_class :: NoMisleadingCharacterClass as biome_analyze :: Rule > :: Options ; -pub type NoMisleadingInstantiator = < lint :: suspicious :: no_misleading_instantiator :: NoMisleadingInstantiator as biome_analyze :: Rule > :: Options ; -pub type NoMisplacedAssertion = < lint :: suspicious :: no_misplaced_assertion :: NoMisplacedAssertion as biome_analyze :: Rule > :: Options ; -pub type NoMisrefactoredShorthandAssign = < lint :: suspicious :: no_misrefactored_shorthand_assign :: NoMisrefactoredShorthandAssign as biome_analyze :: Rule > :: Options ; -pub type NoNamespace = ::Options; -pub type NoNamespaceImport = - ::Options; -pub type NoNegationElse = - ::Options; -pub type NoNestedComponentDefinitions = < lint :: nursery :: no_nested_component_definitions :: NoNestedComponentDefinitions as biome_analyze :: Rule > :: Options ; -pub type NoNestedTernary = - ::Options; -pub type NoNodejsModules = - ::Options; -pub type NoNonNullAssertion = - ::Options; -pub type NoNoninteractiveElementInteractions = < lint :: nursery :: no_noninteractive_element_interactions :: NoNoninteractiveElementInteractions as biome_analyze :: Rule > :: Options ; -pub type NoNoninteractiveElementToInteractiveRole = < lint :: a11y :: no_noninteractive_element_to_interactive_role :: NoNoninteractiveElementToInteractiveRole as biome_analyze :: Rule > :: Options ; -pub type NoNoninteractiveTabindex = < lint :: a11y :: no_noninteractive_tabindex :: NoNoninteractiveTabindex as biome_analyze :: Rule > :: Options ; -pub type NoNonoctalDecimalEscape = < lint :: correctness :: no_nonoctal_decimal_escape :: NoNonoctalDecimalEscape as biome_analyze :: Rule > :: Options ; -pub type NoOctalEscape = - ::Options; -pub type NoParameterAssign = - ::Options; -pub type NoParameterProperties = - ::Options; -pub type NoPositiveTabindex = - ::Options; -pub type NoPrecisionLoss = - ::Options; -pub type NoPrivateImports = - ::Options; -pub type NoProcessEnv = ::Options; -pub type NoProcessGlobal = - ::Options; -pub type NoPrototypeBuiltins = - ::Options; -pub type NoReExportAll = - ::Options; -pub type NoReactPropAssign = - ::Options; -pub type NoReactSpecificProps = < lint :: suspicious :: no_react_specific_props :: NoReactSpecificProps as biome_analyze :: Rule > :: Options ; -pub type NoRedeclare = - ::Options; -pub type NoRedundantAlt = - ::Options; -pub type NoRedundantRoles = - ::Options; -pub type NoRedundantUseStrict = < lint :: suspicious :: no_redundant_use_strict :: NoRedundantUseStrict as biome_analyze :: Rule > :: Options ; -pub type NoRenderReturnValue = < lint :: correctness :: no_render_return_value :: NoRenderReturnValue as biome_analyze :: Rule > :: Options ; -pub type NoRestrictedElements = - ::Options; -pub type NoRestrictedGlobals = - ::Options; -pub type NoRestrictedImports = - ::Options; -pub type NoRestrictedTypes = - ::Options; -pub type NoSecrets = ::Options; -pub type NoSelfAssign = - ::Options; -pub type NoSelfCompare = - ::Options; -pub type NoSetterReturn = - ::Options; -pub type NoShadow = ::Options; -pub type NoShadowRestrictedNames = < lint :: suspicious :: no_shadow_restricted_names :: NoShadowRestrictedNames as biome_analyze :: Rule > :: Options ; -pub type NoShoutyConstants = - ::Options; -pub type NoSkippedTests = - ::Options; -pub type NoSparseArray = - ::Options; -pub type NoStaticElementInteractions = < lint :: a11y :: no_static_element_interactions :: NoStaticElementInteractions as biome_analyze :: Rule > :: Options ; -pub type NoStaticOnlyClass = - ::Options; -pub type NoStringCaseMismatch = < lint :: correctness :: no_string_case_mismatch :: NoStringCaseMismatch as biome_analyze :: Rule > :: Options ; -pub type NoSubstr = ::Options; -pub type NoSuspiciousSemicolonInJsx = < lint :: suspicious :: no_suspicious_semicolon_in_jsx :: NoSuspiciousSemicolonInJsx as biome_analyze :: Rule > :: Options ; -pub type NoSvgWithoutTitle = - ::Options; -pub type NoSwitchDeclarations = < lint :: correctness :: no_switch_declarations :: NoSwitchDeclarations as biome_analyze :: Rule > :: Options ; -pub type NoTemplateCurlyInString = < lint :: suspicious :: no_template_curly_in_string :: NoTemplateCurlyInString as biome_analyze :: Rule > :: Options ; -pub type NoThenProperty = - ::Options; -pub type NoThisInStatic = - ::Options; -pub type NoTsIgnore = ::Options; -pub type NoUnassignedVariables = - ::Options; -pub type NoUndeclaredDependencies = < lint :: correctness :: no_undeclared_dependencies :: NoUndeclaredDependencies as biome_analyze :: Rule > :: Options ; -pub type NoUndeclaredVariables = < lint :: correctness :: no_undeclared_variables :: NoUndeclaredVariables as biome_analyze :: Rule > :: Options ; -pub type NoUnreachable = - ::Options; -pub type NoUnreachableSuper = - ::Options; -pub type NoUnresolvedImports = - ::Options; -pub type NoUnsafeDeclarationMerging = < lint :: suspicious :: no_unsafe_declaration_merging :: NoUnsafeDeclarationMerging as biome_analyze :: Rule > :: Options ; -pub type NoUnsafeFinally = - ::Options; -pub type NoUnsafeNegation = - ::Options; -pub type NoUnsafeOptionalChaining = < lint :: correctness :: no_unsafe_optional_chaining :: NoUnsafeOptionalChaining as biome_analyze :: Rule > :: Options ; -pub type NoUnusedFunctionParameters = < lint :: correctness :: no_unused_function_parameters :: NoUnusedFunctionParameters as biome_analyze :: Rule > :: Options ; -pub type NoUnusedImports = - ::Options; -pub type NoUnusedLabels = - ::Options; -pub type NoUnusedPrivateClassMembers = < lint :: correctness :: no_unused_private_class_members :: NoUnusedPrivateClassMembers as biome_analyze :: Rule > :: Options ; -pub type NoUnusedTemplateLiteral = < lint :: style :: no_unused_template_literal :: NoUnusedTemplateLiteral as biome_analyze :: Rule > :: Options ; -pub type NoUnusedVariables = - ::Options; -pub type NoUnwantedPolyfillio = - ::Options; -pub type NoUselessBackrefInRegex = < lint :: nursery :: no_useless_backref_in_regex :: NoUselessBackrefInRegex as biome_analyze :: Rule > :: Options ; -pub type NoUselessCatch = - ::Options; -pub type NoUselessConstructor = < lint :: complexity :: no_useless_constructor :: NoUselessConstructor as biome_analyze :: Rule > :: Options ; -pub type NoUselessContinue = - ::Options; -pub type NoUselessElse = - ::Options; -pub type NoUselessEmptyExport = < lint :: complexity :: no_useless_empty_export :: NoUselessEmptyExport as biome_analyze :: Rule > :: Options ; -pub type NoUselessEscapeInRegex = < lint :: complexity :: no_useless_escape_in_regex :: NoUselessEscapeInRegex as biome_analyze :: Rule > :: Options ; -pub type NoUselessEscapeInString = < lint :: nursery :: no_useless_escape_in_string :: NoUselessEscapeInString as biome_analyze :: Rule > :: Options ; -pub type NoUselessFragments = - ::Options; -pub type NoUselessLabel = - ::Options; -pub type NoUselessLoneBlockStatements = < lint :: complexity :: no_useless_lone_block_statements :: NoUselessLoneBlockStatements as biome_analyze :: Rule > :: Options ; -pub type NoUselessRename = - ::Options; -pub type NoUselessStringConcat = < lint :: complexity :: no_useless_string_concat :: NoUselessStringConcat as biome_analyze :: Rule > :: Options ; -pub type NoUselessStringRaw = - ::Options; -pub type NoUselessSwitchCase = - ::Options; -pub type NoUselessTernary = - ::Options; -pub type NoUselessThisAlias = - ::Options; -pub type NoUselessTypeConstraint = < lint :: complexity :: no_useless_type_constraint :: NoUselessTypeConstraint as biome_analyze :: Rule > :: Options ; -pub type NoUselessUndefined = - ::Options; -pub type NoUselessUndefinedInitialization = < lint :: complexity :: no_useless_undefined_initialization :: NoUselessUndefinedInitialization as biome_analyze :: Rule > :: Options ; -pub type NoVar = ::Options; -pub type NoVoid = ::Options; -pub type NoVoidElementsWithChildren = < lint :: correctness :: no_void_elements_with_children :: NoVoidElementsWithChildren as biome_analyze :: Rule > :: Options ; -pub type NoVoidTypeReturn = - ::Options; -pub type NoWith = ::Options; -pub type NoYodaExpression = - ::Options; -pub type OrganizeImports = - ::Options; -pub type UseAdjacentGetterSetter = < lint :: nursery :: use_adjacent_getter_setter :: UseAdjacentGetterSetter as biome_analyze :: Rule > :: Options ; -pub type UseAdjacentOverloadSignatures = < lint :: suspicious :: use_adjacent_overload_signatures :: UseAdjacentOverloadSignatures as biome_analyze :: Rule > :: Options ; -pub type UseAltText = ::Options; -pub type UseAnchorContent = - ::Options; -pub type UseAriaActivedescendantWithTabindex = < lint :: a11y :: use_aria_activedescendant_with_tabindex :: UseAriaActivedescendantWithTabindex as biome_analyze :: Rule > :: Options ; -pub type UseAriaPropsForRole = - ::Options; -pub type UseAriaPropsSupportedByRole = < lint :: a11y :: use_aria_props_supported_by_role :: UseAriaPropsSupportedByRole as biome_analyze :: Rule > :: Options ; -pub type UseArrayLiterals = - ::Options; -pub type UseArrowFunction = - ::Options; -pub type UseAsConstAssertion = - ::Options; -pub type UseAtIndex = ::Options; -pub type UseAwait = ::Options; -pub type UseBlockStatements = - ::Options; -pub type UseButtonType = - ::Options; -pub type UseCollapsedElseIf = - ::Options; -pub type UseCollapsedIf = - ::Options; -pub type UseComponentExportOnlyModules = < lint :: style :: use_component_export_only_modules :: UseComponentExportOnlyModules as biome_analyze :: Rule > :: Options ; -pub type UseConsistentArrayType = < lint :: style :: use_consistent_array_type :: UseConsistentArrayType as biome_analyze :: Rule > :: Options ; -pub type UseConsistentBuiltinInstantiation = < lint :: style :: use_consistent_builtin_instantiation :: UseConsistentBuiltinInstantiation as biome_analyze :: Rule > :: Options ; -pub type UseConsistentCurlyBraces = < lint :: style :: use_consistent_curly_braces :: UseConsistentCurlyBraces as biome_analyze :: Rule > :: Options ; -pub type UseConsistentMemberAccessibility = < lint :: style :: use_consistent_member_accessibility :: UseConsistentMemberAccessibility as biome_analyze :: Rule > :: Options ; -pub type UseConsistentObjectDefinition = < lint :: nursery :: use_consistent_object_definition :: UseConsistentObjectDefinition as biome_analyze :: Rule > :: Options ; -pub type UseConsistentResponse = - ::Options; -pub type UseConst = ::Options; -pub type UseDateNow = ::Options; -pub type UseDefaultParameterLast = < lint :: style :: use_default_parameter_last :: UseDefaultParameterLast as biome_analyze :: Rule > :: Options ; -pub type UseDefaultSwitchClause = < lint :: style :: use_default_switch_clause :: UseDefaultSwitchClause as biome_analyze :: Rule > :: Options ; -pub type UseDefaultSwitchClauseLast = < lint :: suspicious :: use_default_switch_clause_last :: UseDefaultSwitchClauseLast as biome_analyze :: Rule > :: Options ; -pub type UseEnumInitializers = - ::Options; -pub type UseErrorMessage = - ::Options; -pub type UseExhaustiveDependencies = < lint :: correctness :: use_exhaustive_dependencies :: UseExhaustiveDependencies as biome_analyze :: Rule > :: Options ; -pub type UseExhaustiveSwitchCases = < lint :: nursery :: use_exhaustive_switch_cases :: UseExhaustiveSwitchCases as biome_analyze :: Rule > :: Options ; -pub type UseExplicitLengthCheck = < lint :: style :: use_explicit_length_check :: UseExplicitLengthCheck as biome_analyze :: Rule > :: Options ; -pub type UseExplicitType = - ::Options; -pub type UseExponentiationOperator = < lint :: style :: use_exponentiation_operator :: UseExponentiationOperator as biome_analyze :: Rule > :: Options ; -pub type UseExportType = - ::Options; -pub type UseExportsLast = - ::Options; -pub type UseFilenamingConvention = < lint :: style :: use_filenaming_convention :: UseFilenamingConvention as biome_analyze :: Rule > :: Options ; -pub type UseFlatMap = ::Options; -pub type UseFocusableInteractive = < lint :: a11y :: use_focusable_interactive :: UseFocusableInteractive as biome_analyze :: Rule > :: Options ; -pub type UseForComponent = - ::Options; -pub type UseForOf = ::Options; -pub type UseFragmentSyntax = - ::Options; -pub type UseGetterReturn = - ::Options; -pub type UseGoogleFontDisplay = < lint :: suspicious :: use_google_font_display :: UseGoogleFontDisplay as biome_analyze :: Rule > :: Options ; -pub type UseGoogleFontPreconnect = < lint :: nursery :: use_google_font_preconnect :: UseGoogleFontPreconnect as biome_analyze :: Rule > :: Options ; -pub type UseGuardForIn = - ::Options; -pub type UseHeadingContent = - ::Options; -pub type UseHookAtTopLevel = - ::Options; -pub type UseHtmlLang = ::Options; -pub type UseIframeTitle = - ::Options; -pub type UseImportExtensions = - ::Options; -pub type UseImportType = - ::Options; -pub type UseIndexOf = ::Options; -pub type UseIsArray = ::Options; -pub type UseIsNan = ::Options; -pub type UseIterableCallbackReturn = < lint :: nursery :: use_iterable_callback_return :: UseIterableCallbackReturn as biome_analyze :: Rule > :: Options ; -pub type UseJsonImportAttribute = < lint :: nursery :: use_json_import_attribute :: UseJsonImportAttribute as biome_analyze :: Rule > :: Options ; -pub type UseJsxKeyInIterable = < lint :: correctness :: use_jsx_key_in_iterable :: UseJsxKeyInIterable as biome_analyze :: Rule > :: Options ; -pub type UseKeyWithClickEvents = - ::Options; -pub type UseKeyWithMouseEvents = - ::Options; -pub type UseLiteralEnumMembers = - ::Options; -pub type UseLiteralKeys = - ::Options; -pub type UseMediaCaption = - ::Options; -pub type UseNamespaceKeyword = - ::Options; -pub type UseNamingConvention = - ::Options; -pub type UseNodeAssertStrict = - ::Options; -pub type UseNodejsImportProtocol = < lint :: style :: use_nodejs_import_protocol :: UseNodejsImportProtocol as biome_analyze :: Rule > :: Options ; -pub type UseNumberNamespace = - ::Options; -pub type UseNumberToFixedDigitsArgument = < lint :: suspicious :: use_number_to_fixed_digits_argument :: UseNumberToFixedDigitsArgument as biome_analyze :: Rule > :: Options ; -pub type UseNumericLiterals = - ::Options; -pub type UseNumericSeparators = - ::Options; -pub type UseObjectSpread = - ::Options; -pub type UseOptionalChain = - ::Options; -pub type UseParseIntRadix = - ::Options; -pub type UseReadonlyClassProperties = < lint :: nursery :: use_readonly_class_properties :: UseReadonlyClassProperties as biome_analyze :: Rule > :: Options ; -pub type UseRegexLiterals = - ::Options; -pub type UseSelfClosingElements = < lint :: style :: use_self_closing_elements :: UseSelfClosingElements as biome_analyze :: Rule > :: Options ; -pub type UseSemanticElements = - ::Options; -pub type UseShorthandAssign = - ::Options; -pub type UseShorthandFunctionType = < lint :: style :: use_shorthand_function_type :: UseShorthandFunctionType as biome_analyze :: Rule > :: Options ; -pub type UseSimpleNumberKeys = - ::Options; -pub type UseSimplifiedLogicExpression = < lint :: complexity :: use_simplified_logic_expression :: UseSimplifiedLogicExpression as biome_analyze :: Rule > :: Options ; -pub type UseSingleJsDocAsterisk = < lint :: nursery :: use_single_js_doc_asterisk :: UseSingleJsDocAsterisk as biome_analyze :: Rule > :: Options ; -pub type UseSingleVarDeclarator = < lint :: style :: use_single_var_declarator :: UseSingleVarDeclarator as biome_analyze :: Rule > :: Options ; -pub type UseSortedAttributes = - ::Options; -pub type UseSortedClasses = - ::Options; -pub type UseSortedKeys = - ::Options; -pub type UseStrictMode = - ::Options; -pub type UseSymbolDescription = - ::Options; -pub type UseTemplate = ::Options; -pub type UseThrowNewError = - ::Options; -pub type UseThrowOnlyError = - ::Options; -pub type UseTopLevelRegex = - ::Options; -pub type UseTrimStartEnd = - ::Options; -pub type UseUnifiedTypeSignature = < lint :: nursery :: use_unified_type_signature :: UseUnifiedTypeSignature as biome_analyze :: Rule > :: Options ; -pub type UseUniqueElementIds = - ::Options; -pub type UseValidAnchor = - ::Options; -pub type UseValidAriaProps = - ::Options; -pub type UseValidAriaRole = - ::Options; -pub type UseValidAriaValues = - ::Options; -pub type UseValidAutocomplete = - ::Options; -pub type UseValidForDirection = < lint :: 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/hooks.rs b/crates/biome_js_analyze/src/react/hooks.rs index 3f0d94ed203f..86a5553dd0ab 100644 --- a/crates/biome_js_analyze/src/react/hooks.rs +++ b/crates/biome_js_analyze/src/react/hooks.rs @@ -1,11 +1,4 @@ use crate::react::{ReactLibrary, is_react_call_api}; - -use biome_console::markup; -use biome_deserialize::{ - DeserializableTypes, DeserializableValue, DeserializationContext, DeserializationDiagnostic, - DeserializationVisitor, -}; -use biome_diagnostics::Severity; use biome_js_semantic::{Capture, Closure, ClosureExtensions, SemanticModel}; use biome_js_syntax::binding_ext::AnyJsBindingDeclaration; use biome_js_syntax::{ @@ -19,8 +12,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; use serde::{Deserialize, Serialize}; use biome_analyze::QueryMatch; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rule_options::use_exhaustive_dependencies::StableHookResult; /// Return result of [react_hook_with_dependency]. #[derive(Debug)] @@ -244,173 +236,6 @@ impl StableReactHookConfiguration { } } -#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)] -pub enum StableHookResult { - /// Used to indicate the hook does not have a stable result. - #[default] - None, - - /// Used to indicate the identity of the result value is stable. - /// - /// Note this does not imply internal stability. For instance, the ref - /// objects returned by React's `useRef()` always have a stable identity, - /// but their internal value may be mutable. - Identity, - - /// Used to indicate the hook returns an array and some of its indices have - /// stable identities. - /// - /// For example, React's `useState()` hook returns a stable function at - /// index 1. - Indices(Vec), -} - -#[cfg(feature = "schemars")] -impl JsonSchema for StableHookResult { - fn schema_name() -> String { - "StableHookResult".to_owned() - } - - fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { - use schemars::schema::*; - Schema::Object(SchemaObject { - subschemas: Some(Box::new(SubschemaValidation { - one_of: Some(vec![ - Schema::Object(SchemaObject { - instance_type: Some(InstanceType::Boolean.into()), - metadata: Some(Box::new(Metadata { - description: Some("Whether the hook has a stable result.".to_owned()), - ..Default::default() - })), - ..Default::default() - }), - Schema::Object(SchemaObject { - instance_type: Some(InstanceType::Array.into()), - array: Some(Box::new(ArrayValidation { - items: Some(SingleOrVec::Single(Box::new(Schema::Object(SchemaObject { - instance_type: Some(InstanceType::Integer.into()), - format: Some("uint8".to_owned()), - number: Some(Box::new(NumberValidation { - minimum: Some(0.), - maximum: Some(255.), - ..Default::default() - })), - ..Default::default() - })))), - min_items: Some(1), - ..Default::default() - })), - metadata: Some(Box::new(Metadata { - description: Some("Used to indicate the hook returns an array and some of its indices have stable identities.".to_owned()), - ..Default::default() - })), - ..Default::default() - }) - ]), - ..Default::default() - })), - ..Default::default() - }) - } -} - -impl biome_deserialize::Deserializable for StableHookResult { - fn deserialize( - ctx: &mut impl DeserializationContext, - value: &impl DeserializableValue, - name: &str, - ) -> Option { - value.deserialize(ctx, StableResultVisitor, name) - } -} - -struct StableResultVisitor; -impl DeserializationVisitor for StableResultVisitor { - type Output = StableHookResult; - - const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::ARRAY - .union(DeserializableTypes::BOOL) - .union(DeserializableTypes::NUMBER); - - fn visit_array( - self, - ctx: &mut impl DeserializationContext, - items: impl Iterator>, - _range: TextRange, - _name: &str, - ) -> Option { - let indices: Vec = items - .filter_map(|value| { - DeserializableValue::deserialize(&value?, ctx, StableResultIndexVisitor, "") - }) - .collect(); - - Some(if indices.is_empty() { - StableHookResult::None - } else { - StableHookResult::Indices(indices) - }) - } - - fn visit_bool( - self, - ctx: &mut impl DeserializationContext, - value: bool, - range: TextRange, - _name: &str, - ) -> Option { - match value { - true => Some(StableHookResult::Identity), - false => { - ctx.report( - DeserializationDiagnostic::new( - markup! { "This hook is configured to not have a stable result" }, - ) - .with_custom_severity(Severity::Warning) - .with_range(range), - ); - Some(StableHookResult::None) - } - } - } - - fn visit_number( - self, - ctx: &mut impl DeserializationContext, - value: biome_deserialize::TextNumber, - range: TextRange, - name: &str, - ) -> Option { - StableResultIndexVisitor::visit_number(StableResultIndexVisitor, ctx, value, range, name) - .map(|index| StableHookResult::Indices(vec![index])) - } -} - -struct StableResultIndexVisitor; -impl DeserializationVisitor for StableResultIndexVisitor { - type Output = u8; - - const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::NUMBER; - - fn visit_number( - self, - ctx: &mut impl DeserializationContext, - value: biome_deserialize::TextNumber, - range: TextRange, - _name: &str, - ) -> Option { - match value.parse::() { - Ok(index) => Some(index), - Err(_) => { - ctx.report(DeserializationDiagnostic::new_out_of_bound_integer( - 0, 255, range, - )); - None - } - } - } -} - /// Checks if the binding is bound to a stable React hook /// return value. Stable returns do not need to be specified /// as dependencies. diff --git a/crates/biome_js_analyze/src/utils.rs b/crates/biome_js_analyze/src/utils.rs index 502d0b8663a9..2982f953acf8 100644 --- a/crates/biome_js_analyze/src/utils.rs +++ b/crates/biome_js_analyze/src/utils.rs @@ -4,7 +4,6 @@ use std::iter; pub mod batch; pub mod rename; -pub mod restricted_regex; #[cfg(test)] pub mod tests; diff --git a/crates/biome_json_analyze/Cargo.toml b/crates/biome_json_analyze/Cargo.toml index bd5f700ddbce..81c4f1dedcb3 100644 --- a/crates/biome_json_analyze/Cargo.toml +++ b/crates/biome_json_analyze/Cargo.toml @@ -19,6 +19,7 @@ biome_diagnostics = { workspace = true } biome_json_factory = { workspace = true } biome_json_syntax = { workspace = true } biome_rowan = { workspace = true } +biome_rule_options = { workspace = true } biome_string_case = { workspace = true } biome_suppression = { workspace = true } rustc-hash = { workspace = true } diff --git a/crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs b/crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs index b567042f9053..fa8bc6fa8fe5 100644 --- a/crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs +++ b/crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs @@ -8,6 +8,7 @@ use biome_diagnostics::category; use biome_json_factory::make; use biome_json_syntax::{JsonMemberList, JsonObjectValue, T, TextRange}; use biome_rowan::{AstNode, BatchMutationExt}; +use biome_rule_options::use_sorted_keys::UseSortedKeysOptions; use biome_string_case::comparable_token::ComparableToken; use std::ops::Not; @@ -37,7 +38,7 @@ impl Rule for UseSortedKeys { type Query = Ast; type State = (); type Signals = Option; - type Options = (); + type Options = UseSortedKeysOptions; fn run(ctx: &RuleContext) -> Option { is_separated_list_sorted_by(ctx.query(), |node| { diff --git a/crates/biome_json_analyze/src/lib.rs b/crates/biome_json_analyze/src/lib.rs index 2e8cda4f86b9..542e2a4fdc3d 100644 --- a/crates/biome_json_analyze/src/lib.rs +++ b/crates/biome_json_analyze/src/lib.rs @@ -3,7 +3,6 @@ mod assist; mod lint; -pub mod options; mod registry; mod suppression_action; pub mod utils; diff --git a/crates/biome_json_analyze/src/lint/suspicious/no_duplicate_object_keys.rs b/crates/biome_json_analyze/src/lint/suspicious/no_duplicate_object_keys.rs index 802b825c64ad..0fa14074d901 100644 --- a/crates/biome_json_analyze/src/lint/suspicious/no_duplicate_object_keys.rs +++ b/crates/biome_json_analyze/src/lint/suspicious/no_duplicate_object_keys.rs @@ -3,6 +3,7 @@ use biome_console::markup; use biome_diagnostics::Severity; use biome_json_syntax::{JsonMemberName, JsonObjectValue, TextRange}; use biome_rowan::{AstNode, AstSeparatedList}; +use biome_rule_options::no_duplicate_object_keys::NoDuplicateObjectKeysOptions; use rustc_hash::FxHashMap; declare_lint_rule! { @@ -40,7 +41,7 @@ impl Rule for NoDuplicateObjectKeys { type Query = Ast; type State = (JsonMemberName, Vec); type Signals = Box<[Self::State]>; - type Options = (); + type Options = NoDuplicateObjectKeysOptions; fn run(ctx: &RuleContext) -> Self::Signals { let query = ctx.query(); diff --git a/crates/biome_json_analyze/src/options.rs b/crates/biome_json_analyze/src/options.rs deleted file mode 100644 index 570172881198..000000000000 --- a/crates/biome_json_analyze/src/options.rs +++ /dev/null @@ -1,9 +0,0 @@ -//! Generated file, do not edit by hand, see `xtask/codegen` - -//! Generated file, do not edit by hand, see `xtask/codegen` - -use crate::assist; -use crate::lint; -pub type NoDuplicateObjectKeys = < lint :: suspicious :: no_duplicate_object_keys :: NoDuplicateObjectKeys as biome_analyze :: Rule > :: Options ; -pub type UseSortedKeys = - ::Options; diff --git a/crates/biome_rule_options/Cargo.toml b/crates/biome_rule_options/Cargo.toml new file mode 100644 index 000000000000..3cd40bd10582 --- /dev/null +++ b/crates/biome_rule_options/Cargo.toml @@ -0,0 +1,35 @@ +[package] +authors.workspace = true +categories.workspace = true +description = "This crate is internally used to share lint rule options across analyzers" +edition.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +name = "biome_rule_options" +repository.workspace = true +version = "0.0.1" + +[dependencies] +biome_console = { workspace = true } +biome_deserialize = { workspace = true, features = ["smallvec"] } +biome_deserialize_macros = { workspace = true } +biome_diagnostics = { workspace = true } +biome_glob = { workspace = true, features = ["biome_deserialize"] } +biome_resolver = { workspace = true } +biome_rowan = { workspace = true } +biome_string_case = { workspace = true, features = ["biome_rowan"] } +camino = { workspace = true } +enumflags2 = { workspace = true } +regex = { workspace = true } +rustc-hash = { workspace = true } +schemars = { workspace = true, optional = true } +serde = { workspace = true } +smallvec = { workspace = true } + +[lints] +workspace = true + + +[features] +schema = ["dep:schemars"] diff --git a/crates/biome_rule_options/src/lib.rs b/crates/biome_rule_options/src/lib.rs new file mode 100644 index 000000000000..a7f8246214b5 --- /dev/null +++ b/crates/biome_rule_options/src/lib.rs @@ -0,0 +1,339 @@ +//! Generated file, do not edit by hand, see `xtask/codegen` + +mod shared; +pub use shared::*; +pub mod no_access_key; +pub mod no_accumulating_spread; +pub mod no_adjacent_spaces_in_regex; +pub mod no_alert; +pub mod no_approximative_numeric_constant; +pub mod no_arguments; +pub mod no_aria_hidden_on_focusable; +pub mod no_aria_unsupported_elements; +pub mod no_array_index_key; +pub mod no_assign_in_expressions; +pub mod no_async_promise_executor; +pub mod no_autofocus; +pub mod no_await_in_loop; +pub mod no_banned_types; +pub mod no_barrel_file; +pub mod no_bitwise_operators; +pub mod no_blank_target; +pub mod no_catch_assign; +pub mod no_children_prop; +pub mod no_class_assign; +pub mod no_comma_operator; +pub mod no_comment_text; +pub mod no_common_js; +pub mod no_compare_neg_zero; +pub mod no_confusing_labels; +pub mod no_confusing_void_type; +pub mod no_console; +pub mod no_const_assign; +pub mod no_const_enum; +pub mod no_constant_binary_expression; +pub mod no_constant_condition; +pub mod no_constant_math_min_max_clamp; +pub mod no_constructor_return; +pub mod no_control_characters_in_regex; +pub mod no_dangerously_set_inner_html; +pub mod no_dangerously_set_inner_html_with_children; +pub mod no_debugger; +pub mod no_default_export; +pub mod no_delete; +pub mod no_descending_specificity; +pub mod no_destructured_props; +pub mod no_distracting_elements; +pub mod no_document_cookie; +pub mod no_document_import_in_page; +pub mod no_done_callback; +pub mod no_double_equals; +pub mod no_duplicate_at_import_rules; +pub mod no_duplicate_case; +pub mod no_duplicate_class_members; +pub mod no_duplicate_custom_properties; +pub mod no_duplicate_else_if; +pub mod no_duplicate_fields; +pub mod no_duplicate_font_names; +pub mod no_duplicate_jsx_props; +pub mod no_duplicate_object_keys; +pub mod no_duplicate_parameters; +pub mod no_duplicate_properties; +pub mod no_duplicate_selectors_keyframe_block; +pub mod no_duplicate_test_hooks; +pub mod no_dynamic_namespace_import_access; +pub mod no_empty_block; +pub mod no_empty_block_statements; +pub mod no_empty_character_class_in_regex; +pub mod no_empty_interface; +pub mod no_empty_pattern; +pub mod no_empty_type_parameters; +pub mod no_enum; +pub mod no_evolving_types; +pub mod no_excessive_cognitive_complexity; +pub mod no_excessive_lines_per_function; +pub mod no_excessive_nested_test_suites; +pub mod no_explicit_any; +pub mod no_exported_imports; +pub mod no_exports_in_test; +pub mod no_extra_boolean_cast; +pub mod no_extra_non_null_assertion; +pub mod no_fallthrough_switch_clause; +pub mod no_flat_map_identity; +pub mod no_floating_promises; +pub mod no_focused_tests; +pub mod no_for_each; +pub mod no_function_assign; +pub mod no_global_assign; +pub mod no_global_dirname_filename; +pub mod no_global_eval; +pub mod no_global_is_finite; +pub mod no_global_is_nan; +pub mod no_global_object_calls; +pub mod no_head_element; +pub mod no_head_import_in_document; +pub mod no_header_scope; +pub mod no_img_element; +pub mod no_implicit_any_let; +pub mod no_implicit_boolean; +pub mod no_implicit_coercion; +pub mod no_import_assign; +pub mod no_import_cycles; +pub mod no_important_in_keyframe; +pub mod no_important_styles; +pub mod no_inferrable_types; +pub mod no_inner_declarations; +pub mod no_interactive_element_to_noninteractive_role; +pub mod no_invalid_builtin_instantiation; +pub mod no_invalid_constructor_super; +pub mod no_invalid_direction_in_linear_gradient; +pub mod no_invalid_grid_areas; +pub mod no_invalid_position_at_import_rule; +pub mod no_invalid_use_before_declaration; +pub mod no_irregular_whitespace; +pub mod no_label_var; +pub mod no_label_without_control; +pub mod no_magic_numbers; +pub mod no_misleading_character_class; +pub mod no_misleading_instantiator; +pub mod no_misplaced_assertion; +pub mod no_misrefactored_shorthand_assign; +pub mod no_missing_var_function; +pub mod no_namespace; +pub mod no_namespace_import; +pub mod no_negation_else; +pub mod no_nested_component_definitions; +pub mod no_nested_ternary; +pub mod no_nodejs_modules; +pub mod no_non_null_assertion; +pub mod no_noninteractive_element_interactions; +pub mod no_noninteractive_element_to_interactive_role; +pub mod no_noninteractive_tabindex; +pub mod no_nonoctal_decimal_escape; +pub mod no_octal_escape; +pub mod no_parameter_assign; +pub mod no_parameter_properties; +pub mod no_positive_tabindex; +pub mod no_precision_loss; +pub mod no_private_imports; +pub mod no_process_env; +pub mod no_process_global; +pub mod no_prototype_builtins; +pub mod no_re_export_all; +pub mod no_react_prop_assign; +pub mod no_react_specific_props; +pub mod no_redeclare; +pub mod no_redundant_alt; +pub mod no_redundant_roles; +pub mod no_redundant_use_strict; +pub mod no_render_return_value; +pub mod no_restricted_elements; +pub mod no_restricted_globals; +pub mod no_restricted_imports; +pub mod no_restricted_types; +pub mod no_secrets; +pub mod no_self_assign; +pub mod no_self_compare; +pub mod no_setter_return; +pub mod no_shadow; +pub mod no_shadow_restricted_names; +pub mod no_shorthand_property_overrides; +pub mod no_shouty_constants; +pub mod no_skipped_tests; +pub mod no_sparse_array; +pub mod no_static_element_interactions; +pub mod no_static_only_class; +pub mod no_string_case_mismatch; +pub mod no_substr; +pub mod no_suspicious_semicolon_in_jsx; +pub mod no_svg_without_title; +pub mod no_switch_declarations; +pub mod no_template_curly_in_string; +pub mod no_then_property; +pub mod no_this_in_static; +pub mod no_ts_ignore; +pub mod no_unassigned_variables; +pub mod no_undeclared_dependencies; +pub mod no_undeclared_variables; +pub mod no_unknown_at_rule; +pub mod no_unknown_function; +pub mod no_unknown_media_feature_name; +pub mod no_unknown_property; +pub mod no_unknown_pseudo_class; +pub mod no_unknown_pseudo_element; +pub mod no_unknown_type_selector; +pub mod no_unknown_unit; +pub mod no_unmatchable_anb_selector; +pub mod no_unreachable; +pub mod no_unreachable_super; +pub mod no_unresolved_imports; +pub mod no_unsafe_declaration_merging; +pub mod no_unsafe_finally; +pub mod no_unsafe_negation; +pub mod no_unsafe_optional_chaining; +pub mod no_unused_function_parameters; +pub mod no_unused_imports; +pub mod no_unused_labels; +pub mod no_unused_private_class_members; +pub mod no_unused_template_literal; +pub mod no_unused_variables; +pub mod no_unwanted_polyfillio; +pub mod no_useless_backref_in_regex; +pub mod no_useless_catch; +pub mod no_useless_constructor; +pub mod no_useless_continue; +pub mod no_useless_else; +pub mod no_useless_empty_export; +pub mod no_useless_escape_in_regex; +pub mod no_useless_escape_in_string; +pub mod no_useless_fragments; +pub mod no_useless_label; +pub mod no_useless_lone_block_statements; +pub mod no_useless_rename; +pub mod no_useless_string_concat; +pub mod no_useless_string_raw; +pub mod no_useless_switch_case; +pub mod no_useless_ternary; +pub mod no_useless_this_alias; +pub mod no_useless_type_constraint; +pub mod no_useless_undefined; +pub mod no_useless_undefined_initialization; +pub mod no_value_at_rule; +pub mod no_var; +pub mod no_void; +pub mod no_void_elements_with_children; +pub mod no_void_type_return; +pub mod no_with; +pub mod no_yoda_expression; +pub mod organize_imports; +pub mod use_adjacent_getter_setter; +pub mod use_adjacent_overload_signatures; +pub mod use_alt_text; +pub mod use_anchor_content; +pub mod use_aria_activedescendant_with_tabindex; +pub mod use_aria_props_for_role; +pub mod use_aria_props_supported_by_role; +pub mod use_array_literals; +pub mod use_arrow_function; +pub mod use_as_const_assertion; +pub mod use_at_index; +pub mod use_await; +pub mod use_block_statements; +pub mod use_button_type; +pub mod use_collapsed_else_if; +pub mod use_collapsed_if; +pub mod use_component_export_only_modules; +pub mod use_consistent_array_type; +pub mod use_consistent_builtin_instantiation; +pub mod use_consistent_curly_braces; +pub mod use_consistent_member_accessibility; +pub mod use_consistent_object_definition; +pub mod use_consistent_response; +pub mod use_const; +pub mod use_date_now; +pub mod use_default_parameter_last; +pub mod use_default_switch_clause; +pub mod use_default_switch_clause_last; +pub mod use_deprecated_reason; +pub mod use_enum_initializers; +pub mod use_error_message; +pub mod use_exhaustive_dependencies; +pub mod use_exhaustive_switch_cases; +pub mod use_explicit_length_check; +pub mod use_explicit_type; +pub mod use_exponentiation_operator; +pub mod use_export_type; +pub mod use_exports_last; +pub mod use_filenaming_convention; +pub mod use_flat_map; +pub mod use_focusable_interactive; +pub mod use_for_component; +pub mod use_for_of; +pub mod use_fragment_syntax; +pub mod use_generic_font_names; +pub mod use_getter_return; +pub mod use_google_font_display; +pub mod use_google_font_preconnect; +pub mod use_guard_for_in; +pub mod use_heading_content; +pub mod use_hook_at_top_level; +pub mod use_html_lang; +pub mod use_iframe_title; +pub mod use_import_extensions; +pub mod use_import_type; +pub mod use_index_of; +pub mod use_is_array; +pub mod use_is_nan; +pub mod use_iterable_callback_return; +pub mod use_json_import_attribute; +pub mod use_jsx_key_in_iterable; +pub mod use_key_with_click_events; +pub mod use_key_with_mouse_events; +pub mod use_literal_enum_members; +pub mod use_literal_keys; +pub mod use_media_caption; +pub mod use_named_operation; +pub mod use_namespace_keyword; +pub mod use_naming_convention; +pub mod use_node_assert_strict; +pub mod use_nodejs_import_protocol; +pub mod use_number_namespace; +pub mod use_number_to_fixed_digits_argument; +pub mod use_numeric_literals; +pub mod use_numeric_separators; +pub mod use_object_spread; +pub mod use_optional_chain; +pub mod use_parse_int_radix; +pub mod use_readonly_class_properties; +pub mod use_regex_literals; +pub mod use_self_closing_elements; +pub mod use_semantic_elements; +pub mod use_shorthand_assign; +pub mod use_shorthand_function_type; +pub mod use_simple_number_keys; +pub mod use_simplified_logic_expression; +pub mod use_single_js_doc_asterisk; +pub mod use_single_var_declarator; +pub mod use_sorted_attributes; +pub mod use_sorted_classes; +pub mod use_sorted_keys; +pub mod use_sorted_properties; +pub mod use_strict_mode; +pub mod use_symbol_description; +pub mod use_template; +pub mod use_throw_new_error; +pub mod use_throw_only_error; +pub mod use_top_level_regex; +pub mod use_trim_start_end; +pub mod use_unified_type_signature; +pub mod use_unique_element_ids; +pub mod use_valid_anchor; +pub mod use_valid_aria_props; +pub mod use_valid_aria_role; +pub mod use_valid_aria_values; +pub mod use_valid_autocomplete; +pub mod use_valid_for_direction; +pub mod use_valid_lang; +pub mod use_valid_typeof; +pub mod use_while; +pub mod use_yield; diff --git a/crates/biome_rule_options/src/no_access_key.rs b/crates/biome_rule_options/src/no_access_key.rs new file mode 100644 index 000000000000..2eadf9376a83 --- /dev/null +++ b/crates/biome_rule_options/src/no_access_key.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAccessKeyOptions {} diff --git a/crates/biome_rule_options/src/no_accumulating_spread.rs b/crates/biome_rule_options/src/no_accumulating_spread.rs new file mode 100644 index 000000000000..aa91505c5a0a --- /dev/null +++ b/crates/biome_rule_options/src/no_accumulating_spread.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAccumulatingSpreadOptions {} diff --git a/crates/biome_rule_options/src/no_adjacent_spaces_in_regex.rs b/crates/biome_rule_options/src/no_adjacent_spaces_in_regex.rs new file mode 100644 index 000000000000..9de2e7049c92 --- /dev/null +++ b/crates/biome_rule_options/src/no_adjacent_spaces_in_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAdjacentSpacesInRegexOptions {} diff --git a/crates/biome_rule_options/src/no_alert.rs b/crates/biome_rule_options/src/no_alert.rs new file mode 100644 index 000000000000..2ade462cab01 --- /dev/null +++ b/crates/biome_rule_options/src/no_alert.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAlertOptions {} diff --git a/crates/biome_rule_options/src/no_approximative_numeric_constant.rs b/crates/biome_rule_options/src/no_approximative_numeric_constant.rs new file mode 100644 index 000000000000..d570257e5b81 --- /dev/null +++ b/crates/biome_rule_options/src/no_approximative_numeric_constant.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoApproximativeNumericConstantOptions {} diff --git a/crates/biome_rule_options/src/no_arguments.rs b/crates/biome_rule_options/src/no_arguments.rs new file mode 100644 index 000000000000..163829551916 --- /dev/null +++ b/crates/biome_rule_options/src/no_arguments.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoArgumentsOptions {} diff --git a/crates/biome_rule_options/src/no_aria_hidden_on_focusable.rs b/crates/biome_rule_options/src/no_aria_hidden_on_focusable.rs new file mode 100644 index 000000000000..b2869075cb9a --- /dev/null +++ b/crates/biome_rule_options/src/no_aria_hidden_on_focusable.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAriaHiddenOnFocusableOptions {} diff --git a/crates/biome_rule_options/src/no_aria_unsupported_elements.rs b/crates/biome_rule_options/src/no_aria_unsupported_elements.rs new file mode 100644 index 000000000000..a5683b136b8d --- /dev/null +++ b/crates/biome_rule_options/src/no_aria_unsupported_elements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAriaUnsupportedElementsOptions {} diff --git a/crates/biome_rule_options/src/no_array_index_key.rs b/crates/biome_rule_options/src/no_array_index_key.rs new file mode 100644 index 000000000000..73568e61fd1e --- /dev/null +++ b/crates/biome_rule_options/src/no_array_index_key.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoArrayIndexKeyOptions {} diff --git a/crates/biome_rule_options/src/no_assign_in_expressions.rs b/crates/biome_rule_options/src/no_assign_in_expressions.rs new file mode 100644 index 000000000000..08af6fb61270 --- /dev/null +++ b/crates/biome_rule_options/src/no_assign_in_expressions.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAssignInExpressionsOptions {} diff --git a/crates/biome_rule_options/src/no_async_promise_executor.rs b/crates/biome_rule_options/src/no_async_promise_executor.rs new file mode 100644 index 000000000000..8cf82955031b --- /dev/null +++ b/crates/biome_rule_options/src/no_async_promise_executor.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAsyncPromiseExecutorOptions {} diff --git a/crates/biome_rule_options/src/no_autofocus.rs b/crates/biome_rule_options/src/no_autofocus.rs new file mode 100644 index 000000000000..560ae233bf80 --- /dev/null +++ b/crates/biome_rule_options/src/no_autofocus.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAutofocusOptions {} diff --git a/crates/biome_rule_options/src/no_await_in_loop.rs b/crates/biome_rule_options/src/no_await_in_loop.rs new file mode 100644 index 000000000000..318668997f14 --- /dev/null +++ b/crates/biome_rule_options/src/no_await_in_loop.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoAwaitInLoopOptions {} diff --git a/crates/biome_rule_options/src/no_banned_types.rs b/crates/biome_rule_options/src/no_banned_types.rs new file mode 100644 index 000000000000..d882b4da7c42 --- /dev/null +++ b/crates/biome_rule_options/src/no_banned_types.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoBannedTypesOptions {} diff --git a/crates/biome_rule_options/src/no_barrel_file.rs b/crates/biome_rule_options/src/no_barrel_file.rs new file mode 100644 index 000000000000..ff697b188ac1 --- /dev/null +++ b/crates/biome_rule_options/src/no_barrel_file.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoBarrelFileOptions {} diff --git a/crates/biome_rule_options/src/no_bitwise_operators.rs b/crates/biome_rule_options/src/no_bitwise_operators.rs new file mode 100644 index 000000000000..30e8a131b597 --- /dev/null +++ b/crates/biome_rule_options/src/no_bitwise_operators.rs @@ -0,0 +1,10 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoBitwiseOperatorsOptions { + /// Allows a list of bitwise operators to be used as exceptions. + #[serde(default, skip_serializing_if = "<[_]>::is_empty")] + pub allow: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/no_blank_target.rs b/crates/biome_rule_options/src/no_blank_target.rs new file mode 100644 index 000000000000..c7df3ba42095 --- /dev/null +++ b/crates/biome_rule_options/src/no_blank_target.rs @@ -0,0 +1,29 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoBlankTargetOptions { + /// List of domains where `target="_blank"` is allowed without + /// `rel="noopener"`. + #[serde(skip_serializing_if = "Vec::is_empty")] + pub allow_domains: Vec, + + /// Whether `noreferrer` is allowed in addition to `noopener`. + #[serde(default = "default_allow_no_referrer")] + pub allow_no_referrer: bool, +} + +impl Default for NoBlankTargetOptions { + fn default() -> Self { + Self { + allow_domains: Default::default(), + allow_no_referrer: default_allow_no_referrer(), + } + } +} + +fn default_allow_no_referrer() -> bool { + true +} diff --git a/crates/biome_rule_options/src/no_catch_assign.rs b/crates/biome_rule_options/src/no_catch_assign.rs new file mode 100644 index 000000000000..c6d3e55cd8c2 --- /dev/null +++ b/crates/biome_rule_options/src/no_catch_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoCatchAssignOptions {} diff --git a/crates/biome_rule_options/src/no_children_prop.rs b/crates/biome_rule_options/src/no_children_prop.rs new file mode 100644 index 000000000000..c170e68eb69c --- /dev/null +++ b/crates/biome_rule_options/src/no_children_prop.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoChildrenPropOptions {} diff --git a/crates/biome_rule_options/src/no_class_assign.rs b/crates/biome_rule_options/src/no_class_assign.rs new file mode 100644 index 000000000000..536725ad505e --- /dev/null +++ b/crates/biome_rule_options/src/no_class_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoClassAssignOptions {} diff --git a/crates/biome_rule_options/src/no_comma_operator.rs b/crates/biome_rule_options/src/no_comma_operator.rs new file mode 100644 index 000000000000..b9a9ff706e5e --- /dev/null +++ b/crates/biome_rule_options/src/no_comma_operator.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoCommaOperatorOptions {} diff --git a/crates/biome_rule_options/src/no_comment_text.rs b/crates/biome_rule_options/src/no_comment_text.rs new file mode 100644 index 000000000000..e94e9a245b7d --- /dev/null +++ b/crates/biome_rule_options/src/no_comment_text.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoCommentTextOptions {} diff --git a/crates/biome_rule_options/src/no_common_js.rs b/crates/biome_rule_options/src/no_common_js.rs new file mode 100644 index 000000000000..20ecf916c706 --- /dev/null +++ b/crates/biome_rule_options/src/no_common_js.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoCommonJsOptions {} diff --git a/crates/biome_rule_options/src/no_compare_neg_zero.rs b/crates/biome_rule_options/src/no_compare_neg_zero.rs new file mode 100644 index 000000000000..372a7902e142 --- /dev/null +++ b/crates/biome_rule_options/src/no_compare_neg_zero.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoCompareNegZeroOptions {} diff --git a/crates/biome_rule_options/src/no_confusing_labels.rs b/crates/biome_rule_options/src/no_confusing_labels.rs new file mode 100644 index 000000000000..5ab59499ce22 --- /dev/null +++ b/crates/biome_rule_options/src/no_confusing_labels.rs @@ -0,0 +1,10 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConfusingLabelsOptions { + /// A list of (non-confusing) labels that should be allowed + #[serde(skip_serializing_if = "<[_]>::is_empty")] + pub allowed_labels: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/no_confusing_void_type.rs b/crates/biome_rule_options/src/no_confusing_void_type.rs new file mode 100644 index 000000000000..46573533d6d7 --- /dev/null +++ b/crates/biome_rule_options/src/no_confusing_void_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConfusingVoidTypeOptions {} diff --git a/crates/biome_rule_options/src/no_console.rs b/crates/biome_rule_options/src/no_console.rs new file mode 100644 index 000000000000..0c0614b4d781 --- /dev/null +++ b/crates/biome_rule_options/src/no_console.rs @@ -0,0 +1,10 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConsoleOptions { + /// Allowed calls on the console object. + #[serde(skip_serializing_if = "<[_]>::is_empty")] + pub allow: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/no_const_assign.rs b/crates/biome_rule_options/src/no_const_assign.rs new file mode 100644 index 000000000000..192bd1a6a062 --- /dev/null +++ b/crates/biome_rule_options/src/no_const_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstAssignOptions {} diff --git a/crates/biome_rule_options/src/no_const_enum.rs b/crates/biome_rule_options/src/no_const_enum.rs new file mode 100644 index 000000000000..946facb49956 --- /dev/null +++ b/crates/biome_rule_options/src/no_const_enum.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstEnumOptions {} diff --git a/crates/biome_rule_options/src/no_constant_binary_expression.rs b/crates/biome_rule_options/src/no_constant_binary_expression.rs new file mode 100644 index 000000000000..5025548c0a9a --- /dev/null +++ b/crates/biome_rule_options/src/no_constant_binary_expression.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstantBinaryExpressionOptions {} diff --git a/crates/biome_rule_options/src/no_constant_condition.rs b/crates/biome_rule_options/src/no_constant_condition.rs new file mode 100644 index 000000000000..5e69d4741d7d --- /dev/null +++ b/crates/biome_rule_options/src/no_constant_condition.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstantConditionOptions {} diff --git a/crates/biome_rule_options/src/no_constant_math_min_max_clamp.rs b/crates/biome_rule_options/src/no_constant_math_min_max_clamp.rs new file mode 100644 index 000000000000..27ced01cca24 --- /dev/null +++ b/crates/biome_rule_options/src/no_constant_math_min_max_clamp.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstantMathMinMaxClampOptions {} diff --git a/crates/biome_rule_options/src/no_constructor_return.rs b/crates/biome_rule_options/src/no_constructor_return.rs new file mode 100644 index 000000000000..127b0f0efbd6 --- /dev/null +++ b/crates/biome_rule_options/src/no_constructor_return.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoConstructorReturnOptions {} diff --git a/crates/biome_rule_options/src/no_control_characters_in_regex.rs b/crates/biome_rule_options/src/no_control_characters_in_regex.rs new file mode 100644 index 000000000000..3735c9982044 --- /dev/null +++ b/crates/biome_rule_options/src/no_control_characters_in_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoControlCharactersInRegexOptions {} diff --git a/crates/biome_rule_options/src/no_dangerously_set_inner_html.rs b/crates/biome_rule_options/src/no_dangerously_set_inner_html.rs new file mode 100644 index 000000000000..b1e955c2f62a --- /dev/null +++ b/crates/biome_rule_options/src/no_dangerously_set_inner_html.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDangerouslySetInnerHtmlOptions {} diff --git a/crates/biome_rule_options/src/no_dangerously_set_inner_html_with_children.rs b/crates/biome_rule_options/src/no_dangerously_set_inner_html_with_children.rs new file mode 100644 index 000000000000..84b64be8f2ab --- /dev/null +++ b/crates/biome_rule_options/src/no_dangerously_set_inner_html_with_children.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDangerouslySetInnerHtmlWithChildrenOptions {} diff --git a/crates/biome_rule_options/src/no_debugger.rs b/crates/biome_rule_options/src/no_debugger.rs new file mode 100644 index 000000000000..9306ef12820f --- /dev/null +++ b/crates/biome_rule_options/src/no_debugger.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDebuggerOptions {} diff --git a/crates/biome_rule_options/src/no_default_export.rs b/crates/biome_rule_options/src/no_default_export.rs new file mode 100644 index 000000000000..d52e2bb2ac7b --- /dev/null +++ b/crates/biome_rule_options/src/no_default_export.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDefaultExportOptions {} diff --git a/crates/biome_rule_options/src/no_delete.rs b/crates/biome_rule_options/src/no_delete.rs new file mode 100644 index 000000000000..0094c79b4399 --- /dev/null +++ b/crates/biome_rule_options/src/no_delete.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDeleteOptions {} diff --git a/crates/biome_rule_options/src/no_descending_specificity.rs b/crates/biome_rule_options/src/no_descending_specificity.rs new file mode 100644 index 000000000000..7fa3716b31fa --- /dev/null +++ b/crates/biome_rule_options/src/no_descending_specificity.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDescendingSpecificityOptions {} diff --git a/crates/biome_rule_options/src/no_destructured_props.rs b/crates/biome_rule_options/src/no_destructured_props.rs new file mode 100644 index 000000000000..2ff225962d4f --- /dev/null +++ b/crates/biome_rule_options/src/no_destructured_props.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDestructuredPropsOptions {} diff --git a/crates/biome_rule_options/src/no_distracting_elements.rs b/crates/biome_rule_options/src/no_distracting_elements.rs new file mode 100644 index 000000000000..1ae95576bdb5 --- /dev/null +++ b/crates/biome_rule_options/src/no_distracting_elements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDistractingElementsOptions {} diff --git a/crates/biome_rule_options/src/no_document_cookie.rs b/crates/biome_rule_options/src/no_document_cookie.rs new file mode 100644 index 000000000000..760b30c5b3d0 --- /dev/null +++ b/crates/biome_rule_options/src/no_document_cookie.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDocumentCookieOptions {} diff --git a/crates/biome_rule_options/src/no_document_import_in_page.rs b/crates/biome_rule_options/src/no_document_import_in_page.rs new file mode 100644 index 000000000000..22963954f564 --- /dev/null +++ b/crates/biome_rule_options/src/no_document_import_in_page.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDocumentImportInPageOptions {} diff --git a/crates/biome_rule_options/src/no_done_callback.rs b/crates/biome_rule_options/src/no_done_callback.rs new file mode 100644 index 000000000000..346c5dfa9461 --- /dev/null +++ b/crates/biome_rule_options/src/no_done_callback.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDoneCallbackOptions {} diff --git a/crates/biome_rule_options/src/no_double_equals.rs b/crates/biome_rule_options/src/no_double_equals.rs new file mode 100644 index 000000000000..f51d58ea8122 --- /dev/null +++ b/crates/biome_rule_options/src/no_double_equals.rs @@ -0,0 +1,32 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDoubleEqualsOptions { + /// If `true`, an exception is made when comparing with `null`, as it's often relied on to check + /// both for `null` or `undefined`. + /// + /// If `false`, no such exception will be made. + #[serde( + default = "ignore_null_default", + skip_serializing_if = "is_ignore_null_default" + )] + pub ignore_null: bool, +} + +impl Default for NoDoubleEqualsOptions { + fn default() -> Self { + Self { + ignore_null: ignore_null_default(), + } + } +} + +fn ignore_null_default() -> bool { + true +} + +fn is_ignore_null_default(value: &bool) -> bool { + value == &ignore_null_default() +} diff --git a/crates/biome_rule_options/src/no_duplicate_at_import_rules.rs b/crates/biome_rule_options/src/no_duplicate_at_import_rules.rs new file mode 100644 index 000000000000..e244edd0c800 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_at_import_rules.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateAtImportRulesOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_case.rs b/crates/biome_rule_options/src/no_duplicate_case.rs new file mode 100644 index 000000000000..5fc44c56ff8e --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_case.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateCaseOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_class_members.rs b/crates/biome_rule_options/src/no_duplicate_class_members.rs new file mode 100644 index 000000000000..d775403e1b15 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_class_members.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateClassMembersOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_custom_properties.rs b/crates/biome_rule_options/src/no_duplicate_custom_properties.rs new file mode 100644 index 000000000000..ba0fa3caae4e --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_custom_properties.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateCustomPropertiesOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_else_if.rs b/crates/biome_rule_options/src/no_duplicate_else_if.rs new file mode 100644 index 000000000000..bcad006611ba --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_else_if.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateElseIfOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_fields.rs b/crates/biome_rule_options/src/no_duplicate_fields.rs new file mode 100644 index 000000000000..dcfcac26ed7b --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_fields.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateFieldsOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_font_names.rs b/crates/biome_rule_options/src/no_duplicate_font_names.rs new file mode 100644 index 000000000000..3b70a5802448 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_font_names.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateFontNamesOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_jsx_props.rs b/crates/biome_rule_options/src/no_duplicate_jsx_props.rs new file mode 100644 index 000000000000..2af898e13179 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_jsx_props.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateJsxPropsOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_object_keys.rs b/crates/biome_rule_options/src/no_duplicate_object_keys.rs new file mode 100644 index 000000000000..56746bbb760f --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_object_keys.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateObjectKeysOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_parameters.rs b/crates/biome_rule_options/src/no_duplicate_parameters.rs new file mode 100644 index 000000000000..36ba1200b037 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_parameters.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateParametersOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_properties.rs b/crates/biome_rule_options/src/no_duplicate_properties.rs new file mode 100644 index 000000000000..d81027504bfd --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_properties.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicatePropertiesOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_selectors_keyframe_block.rs b/crates/biome_rule_options/src/no_duplicate_selectors_keyframe_block.rs new file mode 100644 index 000000000000..6f43d3139dc0 --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_selectors_keyframe_block.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateSelectorsKeyframeBlockOptions {} diff --git a/crates/biome_rule_options/src/no_duplicate_test_hooks.rs b/crates/biome_rule_options/src/no_duplicate_test_hooks.rs new file mode 100644 index 000000000000..3fb25cbc47df --- /dev/null +++ b/crates/biome_rule_options/src/no_duplicate_test_hooks.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDuplicateTestHooksOptions {} diff --git a/crates/biome_rule_options/src/no_dynamic_namespace_import_access.rs b/crates/biome_rule_options/src/no_dynamic_namespace_import_access.rs new file mode 100644 index 000000000000..2903af99e232 --- /dev/null +++ b/crates/biome_rule_options/src/no_dynamic_namespace_import_access.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoDynamicNamespaceImportAccessOptions {} diff --git a/crates/biome_rule_options/src/no_empty_block.rs b/crates/biome_rule_options/src/no_empty_block.rs new file mode 100644 index 000000000000..b11db624bd3d --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_block.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyBlockOptions {} diff --git a/crates/biome_rule_options/src/no_empty_block_statements.rs b/crates/biome_rule_options/src/no_empty_block_statements.rs new file mode 100644 index 000000000000..298718fd0e65 --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_block_statements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyBlockStatementsOptions {} diff --git a/crates/biome_rule_options/src/no_empty_character_class_in_regex.rs b/crates/biome_rule_options/src/no_empty_character_class_in_regex.rs new file mode 100644 index 000000000000..0a14283cb434 --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_character_class_in_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyCharacterClassInRegexOptions {} diff --git a/crates/biome_rule_options/src/no_empty_interface.rs b/crates/biome_rule_options/src/no_empty_interface.rs new file mode 100644 index 000000000000..8c8f625aae4f --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_interface.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyInterfaceOptions {} diff --git a/crates/biome_rule_options/src/no_empty_pattern.rs b/crates/biome_rule_options/src/no_empty_pattern.rs new file mode 100644 index 000000000000..896000836f1f --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_pattern.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyPatternOptions {} diff --git a/crates/biome_rule_options/src/no_empty_type_parameters.rs b/crates/biome_rule_options/src/no_empty_type_parameters.rs new file mode 100644 index 000000000000..2867843e0a5e --- /dev/null +++ b/crates/biome_rule_options/src/no_empty_type_parameters.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEmptyTypeParametersOptions {} diff --git a/crates/biome_rule_options/src/no_enum.rs b/crates/biome_rule_options/src/no_enum.rs new file mode 100644 index 000000000000..e4428878a583 --- /dev/null +++ b/crates/biome_rule_options/src/no_enum.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEnumOptions {} diff --git a/crates/biome_rule_options/src/no_evolving_types.rs b/crates/biome_rule_options/src/no_evolving_types.rs new file mode 100644 index 000000000000..ea895a71b114 --- /dev/null +++ b/crates/biome_rule_options/src/no_evolving_types.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoEvolvingTypesOptions {} diff --git a/crates/biome_rule_options/src/no_excessive_cognitive_complexity.rs b/crates/biome_rule_options/src/no_excessive_cognitive_complexity.rs new file mode 100644 index 000000000000..283559bbf1f9 --- /dev/null +++ b/crates/biome_rule_options/src/no_excessive_cognitive_complexity.rs @@ -0,0 +1,18 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +use std::num::NonZeroU8; +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExcessiveCognitiveComplexityOptions { + /// The maximum complexity score that we allow. Anything higher is considered excessive. + pub max_allowed_complexity: NonZeroU8, +} + +impl Default for NoExcessiveCognitiveComplexityOptions { + fn default() -> Self { + Self { + max_allowed_complexity: NonZeroU8::new(15).unwrap(), + } + } +} diff --git a/crates/biome_rule_options/src/no_excessive_lines_per_function.rs b/crates/biome_rule_options/src/no_excessive_lines_per_function.rs new file mode 100644 index 000000000000..50a6aba3bdac --- /dev/null +++ b/crates/biome_rule_options/src/no_excessive_lines_per_function.rs @@ -0,0 +1,24 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +use std::num::NonZeroU8; +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExcessiveLinesPerFunctionOptions { + /// The maximum number of lines allowed in a function body. + pub max_lines: NonZeroU8, + /// When this options is set to `true`, blank lines in the function body are not counted towards the maximum line limit. + pub skip_blank_lines: bool, + /// When this option is set to `true`, Immediately Invoked Function Expressions (IIFEs) are not checked for the maximum line limit. + pub skip_iifes: bool, +} + +impl Default for NoExcessiveLinesPerFunctionOptions { + fn default() -> Self { + Self { + max_lines: NonZeroU8::new(50).unwrap(), + skip_blank_lines: false, + skip_iifes: false, + } + } +} diff --git a/crates/biome_rule_options/src/no_excessive_nested_test_suites.rs b/crates/biome_rule_options/src/no_excessive_nested_test_suites.rs new file mode 100644 index 000000000000..33e8cc9b5c1c --- /dev/null +++ b/crates/biome_rule_options/src/no_excessive_nested_test_suites.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExcessiveNestedTestSuitesOptions {} diff --git a/crates/biome_rule_options/src/no_explicit_any.rs b/crates/biome_rule_options/src/no_explicit_any.rs new file mode 100644 index 000000000000..84e50ef391f8 --- /dev/null +++ b/crates/biome_rule_options/src/no_explicit_any.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExplicitAnyOptions {} diff --git a/crates/biome_rule_options/src/no_exported_imports.rs b/crates/biome_rule_options/src/no_exported_imports.rs new file mode 100644 index 000000000000..972c7337284c --- /dev/null +++ b/crates/biome_rule_options/src/no_exported_imports.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExportedImportsOptions {} diff --git a/crates/biome_rule_options/src/no_exports_in_test.rs b/crates/biome_rule_options/src/no_exports_in_test.rs new file mode 100644 index 000000000000..fa07b50d332e --- /dev/null +++ b/crates/biome_rule_options/src/no_exports_in_test.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExportsInTestOptions {} diff --git a/crates/biome_rule_options/src/no_extra_boolean_cast.rs b/crates/biome_rule_options/src/no_extra_boolean_cast.rs new file mode 100644 index 000000000000..d9ebdb95fc0e --- /dev/null +++ b/crates/biome_rule_options/src/no_extra_boolean_cast.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExtraBooleanCastOptions {} diff --git a/crates/biome_rule_options/src/no_extra_non_null_assertion.rs b/crates/biome_rule_options/src/no_extra_non_null_assertion.rs new file mode 100644 index 000000000000..30e7401cc6e5 --- /dev/null +++ b/crates/biome_rule_options/src/no_extra_non_null_assertion.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoExtraNonNullAssertionOptions {} diff --git a/crates/biome_rule_options/src/no_fallthrough_switch_clause.rs b/crates/biome_rule_options/src/no_fallthrough_switch_clause.rs new file mode 100644 index 000000000000..1b011015cbd9 --- /dev/null +++ b/crates/biome_rule_options/src/no_fallthrough_switch_clause.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoFallthroughSwitchClauseOptions {} diff --git a/crates/biome_rule_options/src/no_flat_map_identity.rs b/crates/biome_rule_options/src/no_flat_map_identity.rs new file mode 100644 index 000000000000..9360508e44d2 --- /dev/null +++ b/crates/biome_rule_options/src/no_flat_map_identity.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoFlatMapIdentityOptions {} diff --git a/crates/biome_rule_options/src/no_floating_promises.rs b/crates/biome_rule_options/src/no_floating_promises.rs new file mode 100644 index 000000000000..1373c4b8be35 --- /dev/null +++ b/crates/biome_rule_options/src/no_floating_promises.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoFloatingPromisesOptions {} diff --git a/crates/biome_rule_options/src/no_focused_tests.rs b/crates/biome_rule_options/src/no_focused_tests.rs new file mode 100644 index 000000000000..1d5e4c2aeedf --- /dev/null +++ b/crates/biome_rule_options/src/no_focused_tests.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoFocusedTestsOptions {} diff --git a/crates/biome_rule_options/src/no_for_each.rs b/crates/biome_rule_options/src/no_for_each.rs new file mode 100644 index 000000000000..80ff31088443 --- /dev/null +++ b/crates/biome_rule_options/src/no_for_each.rs @@ -0,0 +1,41 @@ +use biome_console::markup; +use biome_deserialize::{ + DeserializableValidator, DeserializationContext, DeserializationDiagnostic, TextRange, +}; +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +#[deserializable(with_validator)] +pub struct NoForEachOptions { + /// A list of variable names allowed for `forEach` calls. + pub allowed_identifiers: Box<[Box]>, +} + +impl DeserializableValidator for NoForEachOptions { + fn validate( + &mut self, + ctx: &mut impl DeserializationContext, + _name: &str, + range: TextRange, + ) -> bool { + if self + .allowed_identifiers + .iter() + .any(|identifier| identifier.is_empty() || identifier.contains('.')) + { + ctx + .report( + DeserializationDiagnostic::new(markup!( + "'allowedIdentifiers'"" does not accept empty values or values with dots." + )) + .with_range(range) + ); + return false; + } + + true + } +} diff --git a/crates/biome_rule_options/src/no_function_assign.rs b/crates/biome_rule_options/src/no_function_assign.rs new file mode 100644 index 000000000000..113e18e5467b --- /dev/null +++ b/crates/biome_rule_options/src/no_function_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoFunctionAssignOptions {} diff --git a/crates/biome_rule_options/src/no_global_assign.rs b/crates/biome_rule_options/src/no_global_assign.rs new file mode 100644 index 000000000000..211b4b5d76e3 --- /dev/null +++ b/crates/biome_rule_options/src/no_global_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalAssignOptions {} diff --git a/crates/biome_rule_options/src/no_global_dirname_filename.rs b/crates/biome_rule_options/src/no_global_dirname_filename.rs new file mode 100644 index 000000000000..07b1fd37478c --- /dev/null +++ b/crates/biome_rule_options/src/no_global_dirname_filename.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalDirnameFilenameOptions {} diff --git a/crates/biome_rule_options/src/no_global_eval.rs b/crates/biome_rule_options/src/no_global_eval.rs new file mode 100644 index 000000000000..df89a47e56e9 --- /dev/null +++ b/crates/biome_rule_options/src/no_global_eval.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalEvalOptions {} diff --git a/crates/biome_rule_options/src/no_global_is_finite.rs b/crates/biome_rule_options/src/no_global_is_finite.rs new file mode 100644 index 000000000000..486ec6dc2add --- /dev/null +++ b/crates/biome_rule_options/src/no_global_is_finite.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalIsFiniteOptions {} diff --git a/crates/biome_rule_options/src/no_global_is_nan.rs b/crates/biome_rule_options/src/no_global_is_nan.rs new file mode 100644 index 000000000000..8e714450bf7b --- /dev/null +++ b/crates/biome_rule_options/src/no_global_is_nan.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalIsNanOptions {} diff --git a/crates/biome_rule_options/src/no_global_object_calls.rs b/crates/biome_rule_options/src/no_global_object_calls.rs new file mode 100644 index 000000000000..eba1359316d3 --- /dev/null +++ b/crates/biome_rule_options/src/no_global_object_calls.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoGlobalObjectCallsOptions {} diff --git a/crates/biome_rule_options/src/no_head_element.rs b/crates/biome_rule_options/src/no_head_element.rs new file mode 100644 index 000000000000..06330ea9b788 --- /dev/null +++ b/crates/biome_rule_options/src/no_head_element.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoHeadElementOptions {} diff --git a/crates/biome_rule_options/src/no_head_import_in_document.rs b/crates/biome_rule_options/src/no_head_import_in_document.rs new file mode 100644 index 000000000000..ce74b1c62473 --- /dev/null +++ b/crates/biome_rule_options/src/no_head_import_in_document.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoHeadImportInDocumentOptions {} diff --git a/crates/biome_rule_options/src/no_header_scope.rs b/crates/biome_rule_options/src/no_header_scope.rs new file mode 100644 index 000000000000..03f6c7afcbe3 --- /dev/null +++ b/crates/biome_rule_options/src/no_header_scope.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoHeaderScopeOptions {} diff --git a/crates/biome_rule_options/src/no_img_element.rs b/crates/biome_rule_options/src/no_img_element.rs new file mode 100644 index 000000000000..9531d1351c78 --- /dev/null +++ b/crates/biome_rule_options/src/no_img_element.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImgElementOptions {} diff --git a/crates/biome_rule_options/src/no_implicit_any_let.rs b/crates/biome_rule_options/src/no_implicit_any_let.rs new file mode 100644 index 000000000000..64ea5d6ce533 --- /dev/null +++ b/crates/biome_rule_options/src/no_implicit_any_let.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImplicitAnyLetOptions {} diff --git a/crates/biome_rule_options/src/no_implicit_boolean.rs b/crates/biome_rule_options/src/no_implicit_boolean.rs new file mode 100644 index 000000000000..154f5e63ce7c --- /dev/null +++ b/crates/biome_rule_options/src/no_implicit_boolean.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImplicitBooleanOptions {} diff --git a/crates/biome_rule_options/src/no_implicit_coercion.rs b/crates/biome_rule_options/src/no_implicit_coercion.rs new file mode 100644 index 000000000000..d5989b515152 --- /dev/null +++ b/crates/biome_rule_options/src/no_implicit_coercion.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImplicitCoercionOptions {} diff --git a/crates/biome_rule_options/src/no_import_assign.rs b/crates/biome_rule_options/src/no_import_assign.rs new file mode 100644 index 000000000000..d5bc758b76a9 --- /dev/null +++ b/crates/biome_rule_options/src/no_import_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImportAssignOptions {} diff --git a/crates/biome_rule_options/src/no_import_cycles.rs b/crates/biome_rule_options/src/no_import_cycles.rs new file mode 100644 index 000000000000..63b5bee94b1d --- /dev/null +++ b/crates/biome_rule_options/src/no_import_cycles.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImportCyclesOptions {} diff --git a/crates/biome_rule_options/src/no_important_in_keyframe.rs b/crates/biome_rule_options/src/no_important_in_keyframe.rs new file mode 100644 index 000000000000..763aaa3e03ee --- /dev/null +++ b/crates/biome_rule_options/src/no_important_in_keyframe.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImportantInKeyframeOptions {} diff --git a/crates/biome_rule_options/src/no_important_styles.rs b/crates/biome_rule_options/src/no_important_styles.rs new file mode 100644 index 000000000000..224b308c9d34 --- /dev/null +++ b/crates/biome_rule_options/src/no_important_styles.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoImportantStylesOptions {} diff --git a/crates/biome_rule_options/src/no_inferrable_types.rs b/crates/biome_rule_options/src/no_inferrable_types.rs new file mode 100644 index 000000000000..e178a7c0ea34 --- /dev/null +++ b/crates/biome_rule_options/src/no_inferrable_types.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInferrableTypesOptions {} diff --git a/crates/biome_rule_options/src/no_inner_declarations.rs b/crates/biome_rule_options/src/no_inner_declarations.rs new file mode 100644 index 000000000000..c59d3884b1e4 --- /dev/null +++ b/crates/biome_rule_options/src/no_inner_declarations.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInnerDeclarationsOptions {} diff --git a/crates/biome_rule_options/src/no_interactive_element_to_noninteractive_role.rs b/crates/biome_rule_options/src/no_interactive_element_to_noninteractive_role.rs new file mode 100644 index 000000000000..6a6541f6255a --- /dev/null +++ b/crates/biome_rule_options/src/no_interactive_element_to_noninteractive_role.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInteractiveElementToNoninteractiveRoleOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_builtin_instantiation.rs b/crates/biome_rule_options/src/no_invalid_builtin_instantiation.rs new file mode 100644 index 000000000000..95462784fd0f --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_builtin_instantiation.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidBuiltinInstantiationOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_constructor_super.rs b/crates/biome_rule_options/src/no_invalid_constructor_super.rs new file mode 100644 index 000000000000..433267272d7a --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_constructor_super.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidConstructorSuperOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_direction_in_linear_gradient.rs b/crates/biome_rule_options/src/no_invalid_direction_in_linear_gradient.rs new file mode 100644 index 000000000000..940dc2642b2f --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_direction_in_linear_gradient.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidDirectionInLinearGradientOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_grid_areas.rs b/crates/biome_rule_options/src/no_invalid_grid_areas.rs new file mode 100644 index 000000000000..0aea394268e8 --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_grid_areas.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidGridAreasOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_new_builtin.rs b/crates/biome_rule_options/src/no_invalid_new_builtin.rs new file mode 100644 index 000000000000..7062ee474f02 --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_new_builtin.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidNewBuiltinOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_position_at_import_rule.rs b/crates/biome_rule_options/src/no_invalid_position_at_import_rule.rs new file mode 100644 index 000000000000..b6cf0a3de8ef --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_position_at_import_rule.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidPositionAtImportRuleOptions {} diff --git a/crates/biome_rule_options/src/no_invalid_use_before_declaration.rs b/crates/biome_rule_options/src/no_invalid_use_before_declaration.rs new file mode 100644 index 000000000000..f3dc5930cf4e --- /dev/null +++ b/crates/biome_rule_options/src/no_invalid_use_before_declaration.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoInvalidUseBeforeDeclarationOptions {} diff --git a/crates/biome_rule_options/src/no_irregular_whitespace.rs b/crates/biome_rule_options/src/no_irregular_whitespace.rs new file mode 100644 index 000000000000..53f74acb80c6 --- /dev/null +++ b/crates/biome_rule_options/src/no_irregular_whitespace.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoIrregularWhitespaceOptions {} diff --git a/crates/biome_rule_options/src/no_label_var.rs b/crates/biome_rule_options/src/no_label_var.rs new file mode 100644 index 000000000000..5663783f0483 --- /dev/null +++ b/crates/biome_rule_options/src/no_label_var.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoLabelVarOptions {} diff --git a/crates/biome_rule_options/src/no_label_without_control.rs b/crates/biome_rule_options/src/no_label_without_control.rs new file mode 100644 index 000000000000..a168ee64da8e --- /dev/null +++ b/crates/biome_rule_options/src/no_label_without_control.rs @@ -0,0 +1,13 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoLabelWithoutControlOptions { + /// Array of component names that should be considered the same as an `input` element. + pub input_components: Box<[Box]>, + /// Array of attributes that should be treated as the `label` accessible text content. + pub label_attributes: Box<[Box]>, + /// Array of component names that should be considered the same as a `label` element. + pub label_components: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/no_magic_numbers.rs b/crates/biome_rule_options/src/no_magic_numbers.rs new file mode 100644 index 000000000000..4d644c91dae7 --- /dev/null +++ b/crates/biome_rule_options/src/no_magic_numbers.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMagicNumbersOptions {} diff --git a/crates/biome_rule_options/src/no_misleading_character_class.rs b/crates/biome_rule_options/src/no_misleading_character_class.rs new file mode 100644 index 000000000000..ee19bf605f0f --- /dev/null +++ b/crates/biome_rule_options/src/no_misleading_character_class.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMisleadingCharacterClassOptions {} diff --git a/crates/biome_rule_options/src/no_misleading_instantiator.rs b/crates/biome_rule_options/src/no_misleading_instantiator.rs new file mode 100644 index 000000000000..adc7a2ebeccf --- /dev/null +++ b/crates/biome_rule_options/src/no_misleading_instantiator.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMisleadingInstantiatorOptions {} diff --git a/crates/biome_rule_options/src/no_misplaced_assertion.rs b/crates/biome_rule_options/src/no_misplaced_assertion.rs new file mode 100644 index 000000000000..85ada175b141 --- /dev/null +++ b/crates/biome_rule_options/src/no_misplaced_assertion.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMisplacedAssertionOptions {} diff --git a/crates/biome_rule_options/src/no_misrefactored_shorthand_assign.rs b/crates/biome_rule_options/src/no_misrefactored_shorthand_assign.rs new file mode 100644 index 000000000000..90ee2ea40813 --- /dev/null +++ b/crates/biome_rule_options/src/no_misrefactored_shorthand_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMisrefactoredShorthandAssignOptions {} diff --git a/crates/biome_rule_options/src/no_missing_var_function.rs b/crates/biome_rule_options/src/no_missing_var_function.rs new file mode 100644 index 000000000000..8ae26539bbf8 --- /dev/null +++ b/crates/biome_rule_options/src/no_missing_var_function.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoMissingVarFunctionOptions {} diff --git a/crates/biome_rule_options/src/no_namespace.rs b/crates/biome_rule_options/src/no_namespace.rs new file mode 100644 index 000000000000..aec9153c9dd4 --- /dev/null +++ b/crates/biome_rule_options/src/no_namespace.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNamespaceOptions {} diff --git a/crates/biome_rule_options/src/no_namespace_import.rs b/crates/biome_rule_options/src/no_namespace_import.rs new file mode 100644 index 000000000000..d595c8b73a29 --- /dev/null +++ b/crates/biome_rule_options/src/no_namespace_import.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNamespaceImportOptions {} diff --git a/crates/biome_rule_options/src/no_negation_else.rs b/crates/biome_rule_options/src/no_negation_else.rs new file mode 100644 index 000000000000..0b35ef838f5b --- /dev/null +++ b/crates/biome_rule_options/src/no_negation_else.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNegationElseOptions {} diff --git a/crates/biome_rule_options/src/no_nested_component_definitions.rs b/crates/biome_rule_options/src/no_nested_component_definitions.rs new file mode 100644 index 000000000000..110635f152fa --- /dev/null +++ b/crates/biome_rule_options/src/no_nested_component_definitions.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNestedComponentDefinitionsOptions {} diff --git a/crates/biome_rule_options/src/no_nested_ternary.rs b/crates/biome_rule_options/src/no_nested_ternary.rs new file mode 100644 index 000000000000..ca4200659648 --- /dev/null +++ b/crates/biome_rule_options/src/no_nested_ternary.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNestedTernaryOptions {} diff --git a/crates/biome_rule_options/src/no_new_symbol.rs b/crates/biome_rule_options/src/no_new_symbol.rs new file mode 100644 index 000000000000..3555ee355077 --- /dev/null +++ b/crates/biome_rule_options/src/no_new_symbol.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNewSymbolOptions {} diff --git a/crates/biome_rule_options/src/no_nodejs_modules.rs b/crates/biome_rule_options/src/no_nodejs_modules.rs new file mode 100644 index 000000000000..43d44031390f --- /dev/null +++ b/crates/biome_rule_options/src/no_nodejs_modules.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNodejsModulesOptions {} diff --git a/crates/biome_rule_options/src/no_non_null_assertion.rs b/crates/biome_rule_options/src/no_non_null_assertion.rs new file mode 100644 index 000000000000..6582a2ccdde0 --- /dev/null +++ b/crates/biome_rule_options/src/no_non_null_assertion.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNonNullAssertionOptions {} diff --git a/crates/biome_rule_options/src/no_noninteractive_element_interactions.rs b/crates/biome_rule_options/src/no_noninteractive_element_interactions.rs new file mode 100644 index 000000000000..f5938af5b120 --- /dev/null +++ b/crates/biome_rule_options/src/no_noninteractive_element_interactions.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNoninteractiveElementInteractionsOptions {} diff --git a/crates/biome_rule_options/src/no_noninteractive_element_to_interactive_role.rs b/crates/biome_rule_options/src/no_noninteractive_element_to_interactive_role.rs new file mode 100644 index 000000000000..f63e68ddcdab --- /dev/null +++ b/crates/biome_rule_options/src/no_noninteractive_element_to_interactive_role.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNoninteractiveElementToInteractiveRoleOptions {} diff --git a/crates/biome_rule_options/src/no_noninteractive_tabindex.rs b/crates/biome_rule_options/src/no_noninteractive_tabindex.rs new file mode 100644 index 000000000000..ab07686cb1a0 --- /dev/null +++ b/crates/biome_rule_options/src/no_noninteractive_tabindex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNoninteractiveTabindexOptions {} diff --git a/crates/biome_rule_options/src/no_nonoctal_decimal_escape.rs b/crates/biome_rule_options/src/no_nonoctal_decimal_escape.rs new file mode 100644 index 000000000000..9e1ed5ddf515 --- /dev/null +++ b/crates/biome_rule_options/src/no_nonoctal_decimal_escape.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoNonoctalDecimalEscapeOptions {} diff --git a/crates/biome_rule_options/src/no_octal_escape.rs b/crates/biome_rule_options/src/no_octal_escape.rs new file mode 100644 index 000000000000..16d1201495d2 --- /dev/null +++ b/crates/biome_rule_options/src/no_octal_escape.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoOctalEscapeOptions {} diff --git a/crates/biome_rule_options/src/no_parameter_assign.rs b/crates/biome_rule_options/src/no_parameter_assign.rs new file mode 100644 index 000000000000..33c81a4e8f98 --- /dev/null +++ b/crates/biome_rule_options/src/no_parameter_assign.rs @@ -0,0 +1,25 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoParameterAssignOptions { + /// Whether to report an error when a dependency is listed in the dependencies array but isn't used. Defaults to `allow`. + #[serde(default)] + pub property_assignment: PropertyAssignmentMode, +} + +#[derive(Copy, Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +/// Specifies whether property assignments on function parameters are allowed or denied. +pub enum PropertyAssignmentMode { + /// Allows property assignments on function parameters. + /// This is the default behavior, enabling flexibility in parameter usage. + #[default] + Allow, + + /// Disallows property assignments on function parameters. + /// Enforces stricter immutability to prevent unintended side effects. + Deny, +} diff --git a/crates/biome_rule_options/src/no_parameter_properties.rs b/crates/biome_rule_options/src/no_parameter_properties.rs new file mode 100644 index 000000000000..e7e8d57c2b98 --- /dev/null +++ b/crates/biome_rule_options/src/no_parameter_properties.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoParameterPropertiesOptions {} diff --git a/crates/biome_rule_options/src/no_positive_tabindex.rs b/crates/biome_rule_options/src/no_positive_tabindex.rs new file mode 100644 index 000000000000..07d2f36a6974 --- /dev/null +++ b/crates/biome_rule_options/src/no_positive_tabindex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoPositiveTabindexOptions {} diff --git a/crates/biome_rule_options/src/no_precision_loss.rs b/crates/biome_rule_options/src/no_precision_loss.rs new file mode 100644 index 000000000000..4a41c1e480b9 --- /dev/null +++ b/crates/biome_rule_options/src/no_precision_loss.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoPrecisionLossOptions {} diff --git a/crates/biome_rule_options/src/no_private_imports.rs b/crates/biome_rule_options/src/no_private_imports.rs new file mode 100644 index 000000000000..064e571ad34b --- /dev/null +++ b/crates/biome_rule_options/src/no_private_imports.rs @@ -0,0 +1,47 @@ +use biome_console::fmt::Display; +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +use std::str::FromStr; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoPrivateImportsOptions { + /// The default visibility to assume for symbols without visibility tag. + /// + /// Default: **public**. + pub default_visibility: Visibility, +} + +#[derive(Clone, Copy, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase")] +pub enum Visibility { + #[default] + Public, + Package, + Private, +} + +impl Display for Visibility { + fn fmt(&self, fmt: &mut biome_console::fmt::Formatter) -> std::io::Result<()> { + match self { + Self::Public => fmt.write_str("public"), + Self::Package => fmt.write_str("package"), + Self::Private => fmt.write_str("private"), + } + } +} + +impl FromStr for Visibility { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + "public" => Ok(Self::Public), + "package" => Ok(Self::Package), + "private" => Ok(Self::Private), + _ => Err(()), + } + } +} diff --git a/crates/biome_rule_options/src/no_process_env.rs b/crates/biome_rule_options/src/no_process_env.rs new file mode 100644 index 000000000000..5fc57d748049 --- /dev/null +++ b/crates/biome_rule_options/src/no_process_env.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoProcessEnvOptions {} diff --git a/crates/biome_rule_options/src/no_process_global.rs b/crates/biome_rule_options/src/no_process_global.rs new file mode 100644 index 000000000000..4ba213e5a58d --- /dev/null +++ b/crates/biome_rule_options/src/no_process_global.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoProcessGlobalOptions {} diff --git a/crates/biome_rule_options/src/no_prototype_builtins.rs b/crates/biome_rule_options/src/no_prototype_builtins.rs new file mode 100644 index 000000000000..0c32b728e9b8 --- /dev/null +++ b/crates/biome_rule_options/src/no_prototype_builtins.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoPrototypeBuiltinsOptions {} diff --git a/crates/biome_rule_options/src/no_re_export_all.rs b/crates/biome_rule_options/src/no_re_export_all.rs new file mode 100644 index 000000000000..006dbe79c051 --- /dev/null +++ b/crates/biome_rule_options/src/no_re_export_all.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoReExportAllOptions {} diff --git a/crates/biome_rule_options/src/no_react_prop_assign.rs b/crates/biome_rule_options/src/no_react_prop_assign.rs new file mode 100644 index 000000000000..c27b56ed4415 --- /dev/null +++ b/crates/biome_rule_options/src/no_react_prop_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoReactPropAssignOptions {} diff --git a/crates/biome_rule_options/src/no_react_specific_props.rs b/crates/biome_rule_options/src/no_react_specific_props.rs new file mode 100644 index 000000000000..63aa193961bb --- /dev/null +++ b/crates/biome_rule_options/src/no_react_specific_props.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoReactSpecificPropsOptions {} diff --git a/crates/biome_rule_options/src/no_redeclare.rs b/crates/biome_rule_options/src/no_redeclare.rs new file mode 100644 index 000000000000..0434f1112b07 --- /dev/null +++ b/crates/biome_rule_options/src/no_redeclare.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRedeclareOptions {} diff --git a/crates/biome_rule_options/src/no_redundant_alt.rs b/crates/biome_rule_options/src/no_redundant_alt.rs new file mode 100644 index 000000000000..280726627382 --- /dev/null +++ b/crates/biome_rule_options/src/no_redundant_alt.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRedundantAltOptions {} diff --git a/crates/biome_rule_options/src/no_redundant_roles.rs b/crates/biome_rule_options/src/no_redundant_roles.rs new file mode 100644 index 000000000000..881d1602e54d --- /dev/null +++ b/crates/biome_rule_options/src/no_redundant_roles.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRedundantRolesOptions {} diff --git a/crates/biome_rule_options/src/no_redundant_use_strict.rs b/crates/biome_rule_options/src/no_redundant_use_strict.rs new file mode 100644 index 000000000000..595e9711dddc --- /dev/null +++ b/crates/biome_rule_options/src/no_redundant_use_strict.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRedundantUseStrictOptions {} diff --git a/crates/biome_rule_options/src/no_render_return_value.rs b/crates/biome_rule_options/src/no_render_return_value.rs new file mode 100644 index 000000000000..499284a59b54 --- /dev/null +++ b/crates/biome_rule_options/src/no_render_return_value.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRenderReturnValueOptions {} diff --git a/crates/biome_rule_options/src/no_restricted_elements.rs b/crates/biome_rule_options/src/no_restricted_elements.rs new file mode 100644 index 000000000000..4cac6fc2af32 --- /dev/null +++ b/crates/biome_rule_options/src/no_restricted_elements.rs @@ -0,0 +1,51 @@ +use biome_deserialize_macros::Deserializable; +use rustc_hash::FxHashMap; +use serde::{Deserialize, Serialize}; +use std::ops::Deref; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRestrictedElementsOptions { + /// Elements to restrict. + /// Each key is the element name, and the value is the message to show when the element is used. + #[serde(skip_serializing_if = "FxHashMap::is_empty")] + pub elements: CustomRestrictedElements, +} + +#[derive( + Clone, + Debug, + Default, + biome_deserialize_macros::Deserializable, + Eq, + PartialEq, + Deserialize, + Serialize, +)] +pub struct CustomRestrictedElements(CustomRestrictedElementsBaseType); + +impl Deref for CustomRestrictedElements { + type Target = CustomRestrictedElementsBaseType; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +#[cfg(feature = "schema")] +impl schemars::JsonSchema for CustomRestrictedElements { + fn schema_name() -> String { + "CustomRestrictedElements".to_owned() + } + + fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { + let mut schema = generator + .subschema_for::() + .into_object(); + schema.object().min_properties = Some(1); + schemars::schema::Schema::Object(schema) + } +} + +type CustomRestrictedElementsBaseType = FxHashMap, Box>; diff --git a/crates/biome_rule_options/src/no_restricted_globals.rs b/crates/biome_rule_options/src/no_restricted_globals.rs new file mode 100644 index 000000000000..24f84a7b73ce --- /dev/null +++ b/crates/biome_rule_options/src/no_restricted_globals.rs @@ -0,0 +1,11 @@ +use biome_deserialize_macros::Deserializable; +use rustc_hash::FxHashMap; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRestrictedGlobalsOptions { + /// A list of names that should trigger the rule + #[serde(skip_serializing_if = "FxHashMap::is_empty")] + pub denied_globals: FxHashMap, Box>, +} diff --git a/crates/biome_rule_options/src/no_restricted_imports.rs b/crates/biome_rule_options/src/no_restricted_imports.rs new file mode 100644 index 000000000000..d51cce4cc88b --- /dev/null +++ b/crates/biome_rule_options/src/no_restricted_imports.rs @@ -0,0 +1,179 @@ +use biome_deserialize::{ + Deserializable, DeserializableType, DeserializableValue, DeserializationContext, TextRange, +}; +use biome_deserialize_macros::Deserializable; +use rustc_hash::FxHashMap; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRestrictedImportsOptions { + /// A list of import paths that should trigger the rule. + #[serde(skip_serializing_if = "FxHashMap::is_empty")] + pub paths: FxHashMap, CustomRestrictedImport>, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(untagged)] +pub enum CustomRestrictedImport { + /// The message to display when this module is imported. + Plain(Box), + /// Additional options to configure the message and allowed/disallowed import names. + WithOptions(CustomRestrictedImportOptions), +} + +impl From for CustomRestrictedImportOptions { + fn from(options: CustomRestrictedImport) -> Self { + match options { + CustomRestrictedImport::Plain(message) => Self { + message, + import_names: [].into(), + allow_import_names: [].into(), + }, + CustomRestrictedImport::WithOptions(options) => options, + } + } +} + +impl Deserializable for CustomRestrictedImport { + fn deserialize( + ctx: &mut impl DeserializationContext, + value: &impl DeserializableValue, + name: &str, + ) -> Option { + if value.visitable_type()? == DeserializableType::Str { + biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::Plain) + } else { + biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::WithOptions) + } + } +} + +#[derive( + Clone, + Debug, + Default, + Deserialize, + biome_deserialize_macros::Deserializable, + Eq, + PartialEq, + Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct CustomRestrictedImportOptions { + /// The message to display when this module is imported. + #[serde(skip_serializing_if = "str::is_empty")] + pub message: Box, + + /// Names of the exported members that should not be used. + #[serde(skip_serializing_if = "<[_]>::is_empty")] + pub import_names: Box<[Box]>, + + /// Names of the exported members that allowed to be not be used. + #[serde(skip_serializing_if = "<[_]>::is_empty")] + pub allow_import_names: Box<[Box]>, +} + +/// Specifies why a specific import is allowed or disallowed. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum ImportRestrictionCause { + /// Reason: The import source is forbidden or allowed. + ImportSource, + /// Reason: A set of forbidden import names has been defined via `importNames`. + ImportNames, + /// Reason: A set of allowed import names has been defined via `allowImportNames`. + AllowImportNames, +} + +/// Specifies whether a specific import is (dis)allowed, and why it is allowed/disallowed. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct ImportRestrictionStatus(bool, ImportRestrictionCause); + +impl ImportRestrictionStatus { + pub fn is_allowed(&self) -> bool { + self.0 + } + + pub fn is_forbidden(&self) -> bool { + !self.0 + } + + pub fn reason(&self) -> ImportRestrictionCause { + self.1 + } +} + +impl CustomRestrictedImportOptions { + pub fn has_import_name_patterns(&self) -> bool { + !self.import_names.is_empty() || !self.allow_import_names.is_empty() + } + + pub fn is_import_allowed(&self, imported_name: &str) -> ImportRestrictionStatus { + if !self.allow_import_names.is_empty() { + // Deny all imports except for the names specified in allow_import_names + let is_allowed = self + .allow_import_names + .iter() + .any(|name| &**name == imported_name); + + ImportRestrictionStatus(is_allowed, ImportRestrictionCause::AllowImportNames) + } else if !self.import_names.is_empty() { + // Allow all imports except for the names specified in import_names + let is_forbidden = self + .import_names + .iter() + .any(|name| &**name == imported_name); + + ImportRestrictionStatus(!is_forbidden, ImportRestrictionCause::ImportNames) + } else { + // Deny all imports from this module + ImportRestrictionStatus(false, ImportRestrictionCause::ImportSource) + } + } + + pub fn get_message_for_restriction( + &self, + import_source: &str, + imported_name: &str, + reason: ImportRestrictionCause, + ) -> String { + if !self.message.is_empty() { + self.message.to_string() + } else { + match reason { + ImportRestrictionCause::ImportSource => { + format!("Do not import '{import_source}'.") + } + ImportRestrictionCause::ImportNames | ImportRestrictionCause::AllowImportNames => { + if imported_name == RestrictedImportVisitor::BARE_IMPORT_ALIAS { + format!("Do not import '{import_source}' through a side-effect import.") + } else { + format!("Do not import '{imported_name}' from '{import_source}'.") + } + } + } + } + } +} + +pub struct RestrictedImportVisitor<'a> { + pub import_source: &'a str, + pub restricted_import: CustomRestrictedImportOptions, + pub results: Vec, +} + +pub struct RestrictedImportMessage { + pub location: TextRange, + pub message: String, + pub import_source: String, + pub allowed_import_names: Box<[Box]>, +} + +impl RestrictedImportVisitor<'_> { + pub const BARE_IMPORT_ALIAS: &'static str = ""; + pub const NAMESPACE_IMPORT_ALIAS: &'static str = "*"; + pub const DEFAULT_IMPORT_ALIAS: &'static str = "default"; +} diff --git a/crates/biome_rule_options/src/no_restricted_types.rs b/crates/biome_rule_options/src/no_restricted_types.rs new file mode 100644 index 000000000000..9f6087bab449 --- /dev/null +++ b/crates/biome_rule_options/src/no_restricted_types.rs @@ -0,0 +1,65 @@ +use biome_deserialize::{ + Deserializable, DeserializableType, DeserializableValue, DeserializationContext, +}; +use biome_deserialize_macros::Deserializable; +use rustc_hash::FxHashMap; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoRestrictedTypesOptions { + pub types: FxHashMap, CustomRestrictedType>, +} + +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(untagged)] +pub enum CustomRestrictedType { + Plain(Box), + WithOptions(CustomRestrictedTypeOptions), +} + +impl From for CustomRestrictedTypeOptions { + fn from(options: CustomRestrictedType) -> Self { + match options { + CustomRestrictedType::Plain(message) => Self { + message, + use_instead: None, + }, + CustomRestrictedType::WithOptions(options) => options, + } + } +} + +impl Deserializable for CustomRestrictedType { + fn deserialize( + ctx: &mut impl DeserializationContext, + value: &impl DeserializableValue, + name: &str, + ) -> Option { + if value.visitable_type()? == DeserializableType::Str { + biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::Plain) + } else { + biome_deserialize::Deserializable::deserialize(ctx, value, name).map(Self::WithOptions) + } + } +} + +#[derive( + Debug, + Clone, + Default, + biome_deserialize_macros::Deserializable, + Deserialize, + Serialize, + Eq, + PartialEq, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct CustomRestrictedTypeOptions { + pub message: Box, + #[serde(rename = "use")] + pub use_instead: Option, +} diff --git a/crates/biome_rule_options/src/no_secrets.rs b/crates/biome_rule_options/src/no_secrets.rs new file mode 100644 index 000000000000..f54185fe7bb9 --- /dev/null +++ b/crates/biome_rule_options/src/no_secrets.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSecretsOptions {} diff --git a/crates/biome_rule_options/src/no_self_assign.rs b/crates/biome_rule_options/src/no_self_assign.rs new file mode 100644 index 000000000000..fb4c54e08724 --- /dev/null +++ b/crates/biome_rule_options/src/no_self_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSelfAssignOptions {} diff --git a/crates/biome_rule_options/src/no_self_compare.rs b/crates/biome_rule_options/src/no_self_compare.rs new file mode 100644 index 000000000000..1d64d659d6d9 --- /dev/null +++ b/crates/biome_rule_options/src/no_self_compare.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSelfCompareOptions {} diff --git a/crates/biome_rule_options/src/no_setter_return.rs b/crates/biome_rule_options/src/no_setter_return.rs new file mode 100644 index 000000000000..997132a677d4 --- /dev/null +++ b/crates/biome_rule_options/src/no_setter_return.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSetterReturnOptions {} diff --git a/crates/biome_rule_options/src/no_shadow.rs b/crates/biome_rule_options/src/no_shadow.rs new file mode 100644 index 000000000000..8053a04211e4 --- /dev/null +++ b/crates/biome_rule_options/src/no_shadow.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoShadowOptions {} diff --git a/crates/biome_rule_options/src/no_shadow_restricted_names.rs b/crates/biome_rule_options/src/no_shadow_restricted_names.rs new file mode 100644 index 000000000000..047640413d26 --- /dev/null +++ b/crates/biome_rule_options/src/no_shadow_restricted_names.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoShadowRestrictedNamesOptions {} diff --git a/crates/biome_rule_options/src/no_shorthand_property_overrides.rs b/crates/biome_rule_options/src/no_shorthand_property_overrides.rs new file mode 100644 index 000000000000..8b4dc575f601 --- /dev/null +++ b/crates/biome_rule_options/src/no_shorthand_property_overrides.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoShorthandPropertyOverridesOptions {} diff --git a/crates/biome_rule_options/src/no_shouty_constants.rs b/crates/biome_rule_options/src/no_shouty_constants.rs new file mode 100644 index 000000000000..e6faf46ec225 --- /dev/null +++ b/crates/biome_rule_options/src/no_shouty_constants.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoShoutyConstantsOptions {} diff --git a/crates/biome_rule_options/src/no_skipped_tests.rs b/crates/biome_rule_options/src/no_skipped_tests.rs new file mode 100644 index 000000000000..2b0095d7867d --- /dev/null +++ b/crates/biome_rule_options/src/no_skipped_tests.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSkippedTestsOptions {} diff --git a/crates/biome_rule_options/src/no_sparse_array.rs b/crates/biome_rule_options/src/no_sparse_array.rs new file mode 100644 index 000000000000..83251ef8d977 --- /dev/null +++ b/crates/biome_rule_options/src/no_sparse_array.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSparseArrayOptions {} diff --git a/crates/biome_rule_options/src/no_static_element_interactions.rs b/crates/biome_rule_options/src/no_static_element_interactions.rs new file mode 100644 index 000000000000..6e3d5ccbf401 --- /dev/null +++ b/crates/biome_rule_options/src/no_static_element_interactions.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoStaticElementInteractionsOptions {} diff --git a/crates/biome_rule_options/src/no_static_only_class.rs b/crates/biome_rule_options/src/no_static_only_class.rs new file mode 100644 index 000000000000..a6cfc3a5b827 --- /dev/null +++ b/crates/biome_rule_options/src/no_static_only_class.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoStaticOnlyClassOptions {} diff --git a/crates/biome_rule_options/src/no_string_case_mismatch.rs b/crates/biome_rule_options/src/no_string_case_mismatch.rs new file mode 100644 index 000000000000..3047227576ee --- /dev/null +++ b/crates/biome_rule_options/src/no_string_case_mismatch.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoStringCaseMismatchOptions {} diff --git a/crates/biome_rule_options/src/no_substr.rs b/crates/biome_rule_options/src/no_substr.rs new file mode 100644 index 000000000000..5916bd5bb5a2 --- /dev/null +++ b/crates/biome_rule_options/src/no_substr.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSubstrOptions {} diff --git a/crates/biome_rule_options/src/no_suspicious_semicolon_in_jsx.rs b/crates/biome_rule_options/src/no_suspicious_semicolon_in_jsx.rs new file mode 100644 index 000000000000..62eab5e84b16 --- /dev/null +++ b/crates/biome_rule_options/src/no_suspicious_semicolon_in_jsx.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSuspiciousSemicolonInJsxOptions {} diff --git a/crates/biome_rule_options/src/no_svg_without_title.rs b/crates/biome_rule_options/src/no_svg_without_title.rs new file mode 100644 index 000000000000..1ef576669ce5 --- /dev/null +++ b/crates/biome_rule_options/src/no_svg_without_title.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSvgWithoutTitleOptions {} diff --git a/crates/biome_rule_options/src/no_switch_declarations.rs b/crates/biome_rule_options/src/no_switch_declarations.rs new file mode 100644 index 000000000000..50a7aa197b3b --- /dev/null +++ b/crates/biome_rule_options/src/no_switch_declarations.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoSwitchDeclarationsOptions {} diff --git a/crates/biome_rule_options/src/no_template_curly_in_string.rs b/crates/biome_rule_options/src/no_template_curly_in_string.rs new file mode 100644 index 000000000000..f435a9857d58 --- /dev/null +++ b/crates/biome_rule_options/src/no_template_curly_in_string.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoTemplateCurlyInStringOptions {} diff --git a/crates/biome_rule_options/src/no_then_property.rs b/crates/biome_rule_options/src/no_then_property.rs new file mode 100644 index 000000000000..f2bc8c37aea7 --- /dev/null +++ b/crates/biome_rule_options/src/no_then_property.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoThenPropertyOptions {} diff --git a/crates/biome_rule_options/src/no_this_in_static.rs b/crates/biome_rule_options/src/no_this_in_static.rs new file mode 100644 index 000000000000..404b078216f2 --- /dev/null +++ b/crates/biome_rule_options/src/no_this_in_static.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoThisInStaticOptions {} diff --git a/crates/biome_rule_options/src/no_ts_ignore.rs b/crates/biome_rule_options/src/no_ts_ignore.rs new file mode 100644 index 000000000000..06b76e8e4e0b --- /dev/null +++ b/crates/biome_rule_options/src/no_ts_ignore.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoTsIgnoreOptions {} diff --git a/crates/biome_rule_options/src/no_unassigned_variables.rs b/crates/biome_rule_options/src/no_unassigned_variables.rs new file mode 100644 index 000000000000..9703cf80b697 --- /dev/null +++ b/crates/biome_rule_options/src/no_unassigned_variables.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnassignedVariablesOptions {} diff --git a/crates/biome_rule_options/src/no_undeclared_dependencies.rs b/crates/biome_rule_options/src/no_undeclared_dependencies.rs new file mode 100644 index 000000000000..31b3dc414fdb --- /dev/null +++ b/crates/biome_rule_options/src/no_undeclared_dependencies.rs @@ -0,0 +1,108 @@ +use biome_deserialize::{ + Deserializable, DeserializableType, DeserializableValue, DeserializationContext, +}; +use biome_deserialize_macros::Deserializable; +use camino::Utf8Path; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUndeclaredDependenciesOptions { + /// If set to `false`, then the rule will show an error when `devDependencies` are imported. Defaults to `true`. + #[serde(default)] + pub dev_dependencies: DependencyAvailability, + + /// If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `true`. + #[serde(default)] + pub peer_dependencies: DependencyAvailability, + + /// If set to `false`, then the rule will show an error when `optionalDependencies` are imported. Defaults to `true`. + #[serde(default)] + pub optional_dependencies: DependencyAvailability, +} + +#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)] +#[serde(untagged)] +pub enum DependencyAvailability { + /// Dependencies are always available or unavailable. + Bool(bool), + + /// Dependencies are available in files that matches any of the globs. + Patterns(Box<[biome_glob::Glob]>), +} + +impl Default for DependencyAvailability { + fn default() -> Self { + Self::Bool(true) + } +} + +impl Deserializable for DependencyAvailability { + fn deserialize( + ctx: &mut impl DeserializationContext, + value: &impl DeserializableValue, + name: &str, + ) -> Option { + Some(if value.visitable_type()? == DeserializableType::Bool { + Self::Bool(::deserialize(ctx, value, name)?) + } else { + Self::Patterns(Deserializable::deserialize(ctx, value, name)?) + }) + } +} + +#[cfg(feature = "schema")] +impl schemars::JsonSchema for DependencyAvailability { + fn schema_name() -> String { + "DependencyAvailability".to_owned() + } + + fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + use schemars::schema::*; + + Schema::Object(SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + one_of: Some(vec![ + Schema::Object(SchemaObject { + instance_type: Some(InstanceType::Boolean.into()), + metadata: Some(Box::new(Metadata { + description: Some("This type of dependency will be always available or unavailable.".to_owned()), + ..Default::default() + })), + ..Default::default() + }), + Schema::Object(SchemaObject { + instance_type: Some(InstanceType::Array.into()), + array: Some(Box::new(ArrayValidation { + items: Some(SingleOrVec::Single(Box::new(Schema::Object(SchemaObject { + instance_type: Some(InstanceType::String.into()), + ..Default::default() + })))), + min_items: Some(1), + ..Default::default() + })), + metadata: Some(Box::new(Metadata { + description: Some("This type of dependency will be available only if the linted file matches any of the globs.".to_owned()), + ..Default::default() + })), + ..Default::default() + }) + ]), + ..Default::default() + })), + ..Default::default() + }) + } +} + +impl DependencyAvailability { + pub fn is_available(&self, path: &Utf8Path) -> bool { + match self { + Self::Bool(b) => *b, + Self::Patterns(globs) => { + biome_glob::CandidatePath::new(&path).matches_with_exceptions(globs) + } + } + } +} diff --git a/crates/biome_rule_options/src/no_undeclared_variables.rs b/crates/biome_rule_options/src/no_undeclared_variables.rs new file mode 100644 index 000000000000..e52d41a66a12 --- /dev/null +++ b/crates/biome_rule_options/src/no_undeclared_variables.rs @@ -0,0 +1,9 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUndeclaredVariablesOptions { + /// Check undeclared types. + pub check_types: bool, +} diff --git a/crates/biome_rule_options/src/no_unknown_at_rule.rs b/crates/biome_rule_options/src/no_unknown_at_rule.rs new file mode 100644 index 000000000000..723aa1957543 --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_at_rule.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownAtRuleOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_function.rs b/crates/biome_rule_options/src/no_unknown_function.rs new file mode 100644 index 000000000000..d05dfa4cd14e --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_function.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownFunctionOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_media_feature_name.rs b/crates/biome_rule_options/src/no_unknown_media_feature_name.rs new file mode 100644 index 000000000000..2e47c96f9283 --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_media_feature_name.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownMediaFeatureNameOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_property.rs b/crates/biome_rule_options/src/no_unknown_property.rs new file mode 100644 index 000000000000..3070a38b5511 --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_property.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownPropertyOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_pseudo_class.rs b/crates/biome_rule_options/src/no_unknown_pseudo_class.rs new file mode 100644 index 000000000000..7e6aa11d965b --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_pseudo_class.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownPseudoClassOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_pseudo_element.rs b/crates/biome_rule_options/src/no_unknown_pseudo_element.rs new file mode 100644 index 000000000000..fe5f15738b36 --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_pseudo_element.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownPseudoElementOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_type_selector.rs b/crates/biome_rule_options/src/no_unknown_type_selector.rs new file mode 100644 index 000000000000..9afd7340b84c --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_type_selector.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownTypeSelectorOptions {} diff --git a/crates/biome_rule_options/src/no_unknown_unit.rs b/crates/biome_rule_options/src/no_unknown_unit.rs new file mode 100644 index 000000000000..959ecdecf613 --- /dev/null +++ b/crates/biome_rule_options/src/no_unknown_unit.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnknownUnitOptions {} diff --git a/crates/biome_rule_options/src/no_unmatchable_anb_selector.rs b/crates/biome_rule_options/src/no_unmatchable_anb_selector.rs new file mode 100644 index 000000000000..a2d875eca097 --- /dev/null +++ b/crates/biome_rule_options/src/no_unmatchable_anb_selector.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnmatchableAnbSelectorOptions {} diff --git a/crates/biome_rule_options/src/no_unreachable.rs b/crates/biome_rule_options/src/no_unreachable.rs new file mode 100644 index 000000000000..86b231cef494 --- /dev/null +++ b/crates/biome_rule_options/src/no_unreachable.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnreachableOptions {} diff --git a/crates/biome_rule_options/src/no_unreachable_super.rs b/crates/biome_rule_options/src/no_unreachable_super.rs new file mode 100644 index 000000000000..33f6e03c7c53 --- /dev/null +++ b/crates/biome_rule_options/src/no_unreachable_super.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnreachableSuperOptions {} diff --git a/crates/biome_rule_options/src/no_unresolved_imports.rs b/crates/biome_rule_options/src/no_unresolved_imports.rs new file mode 100644 index 000000000000..235689bede71 --- /dev/null +++ b/crates/biome_rule_options/src/no_unresolved_imports.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnresolvedImportsOptions {} diff --git a/crates/biome_rule_options/src/no_unsafe_declaration_merging.rs b/crates/biome_rule_options/src/no_unsafe_declaration_merging.rs new file mode 100644 index 000000000000..c3a574f444f8 --- /dev/null +++ b/crates/biome_rule_options/src/no_unsafe_declaration_merging.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnsafeDeclarationMergingOptions {} diff --git a/crates/biome_rule_options/src/no_unsafe_finally.rs b/crates/biome_rule_options/src/no_unsafe_finally.rs new file mode 100644 index 000000000000..d47fea296fcc --- /dev/null +++ b/crates/biome_rule_options/src/no_unsafe_finally.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnsafeFinallyOptions {} diff --git a/crates/biome_rule_options/src/no_unsafe_negation.rs b/crates/biome_rule_options/src/no_unsafe_negation.rs new file mode 100644 index 000000000000..c7fbee9114a6 --- /dev/null +++ b/crates/biome_rule_options/src/no_unsafe_negation.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnsafeNegationOptions {} diff --git a/crates/biome_rule_options/src/no_unsafe_optional_chaining.rs b/crates/biome_rule_options/src/no_unsafe_optional_chaining.rs new file mode 100644 index 000000000000..798a393ae94c --- /dev/null +++ b/crates/biome_rule_options/src/no_unsafe_optional_chaining.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnsafeOptionalChainingOptions {} diff --git a/crates/biome_rule_options/src/no_unused_function_parameters.rs b/crates/biome_rule_options/src/no_unused_function_parameters.rs new file mode 100644 index 000000000000..0872ee9da4eb --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_function_parameters.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedFunctionParametersOptions {} diff --git a/crates/biome_rule_options/src/no_unused_imports.rs b/crates/biome_rule_options/src/no_unused_imports.rs new file mode 100644 index 000000000000..f9131954d703 --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_imports.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedImportsOptions {} diff --git a/crates/biome_rule_options/src/no_unused_labels.rs b/crates/biome_rule_options/src/no_unused_labels.rs new file mode 100644 index 000000000000..7aed29adece4 --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_labels.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedLabelsOptions {} diff --git a/crates/biome_rule_options/src/no_unused_private_class_members.rs b/crates/biome_rule_options/src/no_unused_private_class_members.rs new file mode 100644 index 000000000000..97ad3db6392c --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_private_class_members.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedPrivateClassMembersOptions {} diff --git a/crates/biome_rule_options/src/no_unused_template_literal.rs b/crates/biome_rule_options/src/no_unused_template_literal.rs new file mode 100644 index 000000000000..2e7061c85eb5 --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_template_literal.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedTemplateLiteralOptions {} diff --git a/crates/biome_rule_options/src/no_unused_variables.rs b/crates/biome_rule_options/src/no_unused_variables.rs new file mode 100644 index 000000000000..f9353265d76b --- /dev/null +++ b/crates/biome_rule_options/src/no_unused_variables.rs @@ -0,0 +1,14 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnusedVariablesOptions { + /// Whether to ignore unused variables from an object destructuring with a spread. + #[serde(default = "ignore_rest_siblings")] + pub ignore_rest_siblings: bool, +} + +const fn ignore_rest_siblings() -> bool { + true +} diff --git a/crates/biome_rule_options/src/no_unwanted_polyfillio.rs b/crates/biome_rule_options/src/no_unwanted_polyfillio.rs new file mode 100644 index 000000000000..d89c0619c4e1 --- /dev/null +++ b/crates/biome_rule_options/src/no_unwanted_polyfillio.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUnwantedPolyfillioOptions {} diff --git a/crates/biome_rule_options/src/no_useless_backref_in_regex.rs b/crates/biome_rule_options/src/no_useless_backref_in_regex.rs new file mode 100644 index 000000000000..0b57e430bf22 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_backref_in_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessBackrefInRegexOptions {} diff --git a/crates/biome_rule_options/src/no_useless_catch.rs b/crates/biome_rule_options/src/no_useless_catch.rs new file mode 100644 index 000000000000..19a0a707ab4f --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_catch.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessCatchOptions {} diff --git a/crates/biome_rule_options/src/no_useless_constructor.rs b/crates/biome_rule_options/src/no_useless_constructor.rs new file mode 100644 index 000000000000..544c43ebba49 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_constructor.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessConstructorOptions {} diff --git a/crates/biome_rule_options/src/no_useless_continue.rs b/crates/biome_rule_options/src/no_useless_continue.rs new file mode 100644 index 000000000000..8c557ad84a08 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_continue.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessContinueOptions {} diff --git a/crates/biome_rule_options/src/no_useless_else.rs b/crates/biome_rule_options/src/no_useless_else.rs new file mode 100644 index 000000000000..8fdf329e9edc --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_else.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessElseOptions {} diff --git a/crates/biome_rule_options/src/no_useless_empty_export.rs b/crates/biome_rule_options/src/no_useless_empty_export.rs new file mode 100644 index 000000000000..79b537658862 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_empty_export.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessEmptyExportOptions {} diff --git a/crates/biome_rule_options/src/no_useless_escape_in_regex.rs b/crates/biome_rule_options/src/no_useless_escape_in_regex.rs new file mode 100644 index 000000000000..9e744864b03c --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_escape_in_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessEscapeInRegexOptions {} diff --git a/crates/biome_rule_options/src/no_useless_escape_in_string.rs b/crates/biome_rule_options/src/no_useless_escape_in_string.rs new file mode 100644 index 000000000000..72bd2793b110 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_escape_in_string.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessEscapeInStringOptions {} diff --git a/crates/biome_rule_options/src/no_useless_fragments.rs b/crates/biome_rule_options/src/no_useless_fragments.rs new file mode 100644 index 000000000000..36e48eb65244 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_fragments.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessFragmentsOptions {} diff --git a/crates/biome_rule_options/src/no_useless_label.rs b/crates/biome_rule_options/src/no_useless_label.rs new file mode 100644 index 000000000000..4088aa974289 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_label.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessLabelOptions {} diff --git a/crates/biome_rule_options/src/no_useless_lone_block_statements.rs b/crates/biome_rule_options/src/no_useless_lone_block_statements.rs new file mode 100644 index 000000000000..1b9067bd7e30 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_lone_block_statements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessLoneBlockStatementsOptions {} diff --git a/crates/biome_rule_options/src/no_useless_rename.rs b/crates/biome_rule_options/src/no_useless_rename.rs new file mode 100644 index 000000000000..ab14fd5c8f10 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_rename.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessRenameOptions {} diff --git a/crates/biome_rule_options/src/no_useless_string_concat.rs b/crates/biome_rule_options/src/no_useless_string_concat.rs new file mode 100644 index 000000000000..0446125cef7f --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_string_concat.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessStringConcatOptions {} diff --git a/crates/biome_rule_options/src/no_useless_string_raw.rs b/crates/biome_rule_options/src/no_useless_string_raw.rs new file mode 100644 index 000000000000..d1b43ee5353d --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_string_raw.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessStringRawOptions {} diff --git a/crates/biome_rule_options/src/no_useless_switch_case.rs b/crates/biome_rule_options/src/no_useless_switch_case.rs new file mode 100644 index 000000000000..19a1b7ab48c6 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_switch_case.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessSwitchCaseOptions {} diff --git a/crates/biome_rule_options/src/no_useless_ternary.rs b/crates/biome_rule_options/src/no_useless_ternary.rs new file mode 100644 index 000000000000..77da77f113ee --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_ternary.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessTernaryOptions {} diff --git a/crates/biome_rule_options/src/no_useless_this_alias.rs b/crates/biome_rule_options/src/no_useless_this_alias.rs new file mode 100644 index 000000000000..d9136a0ed6ad --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_this_alias.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessThisAliasOptions {} diff --git a/crates/biome_rule_options/src/no_useless_type_constraint.rs b/crates/biome_rule_options/src/no_useless_type_constraint.rs new file mode 100644 index 000000000000..276076efc653 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_type_constraint.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessTypeConstraintOptions {} diff --git a/crates/biome_rule_options/src/no_useless_undefined.rs b/crates/biome_rule_options/src/no_useless_undefined.rs new file mode 100644 index 000000000000..5e03d58c950a --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_undefined.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessUndefinedOptions {} diff --git a/crates/biome_rule_options/src/no_useless_undefined_initialization.rs b/crates/biome_rule_options/src/no_useless_undefined_initialization.rs new file mode 100644 index 000000000000..e7a638e8b6a3 --- /dev/null +++ b/crates/biome_rule_options/src/no_useless_undefined_initialization.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoUselessUndefinedInitializationOptions {} diff --git a/crates/biome_rule_options/src/no_value_at_rule.rs b/crates/biome_rule_options/src/no_value_at_rule.rs new file mode 100644 index 000000000000..7df75dc36002 --- /dev/null +++ b/crates/biome_rule_options/src/no_value_at_rule.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoValueAtRuleOptions {} diff --git a/crates/biome_rule_options/src/no_var.rs b/crates/biome_rule_options/src/no_var.rs new file mode 100644 index 000000000000..428cfbff9f25 --- /dev/null +++ b/crates/biome_rule_options/src/no_var.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoVarOptions {} diff --git a/crates/biome_rule_options/src/no_void.rs b/crates/biome_rule_options/src/no_void.rs new file mode 100644 index 000000000000..529841a1cf86 --- /dev/null +++ b/crates/biome_rule_options/src/no_void.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoVoidOptions {} diff --git a/crates/biome_rule_options/src/no_void_elements_with_children.rs b/crates/biome_rule_options/src/no_void_elements_with_children.rs new file mode 100644 index 000000000000..c6405d506991 --- /dev/null +++ b/crates/biome_rule_options/src/no_void_elements_with_children.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoVoidElementsWithChildrenOptions {} diff --git a/crates/biome_rule_options/src/no_void_type_return.rs b/crates/biome_rule_options/src/no_void_type_return.rs new file mode 100644 index 000000000000..822b4362fd96 --- /dev/null +++ b/crates/biome_rule_options/src/no_void_type_return.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoVoidTypeReturnOptions {} diff --git a/crates/biome_rule_options/src/no_with.rs b/crates/biome_rule_options/src/no_with.rs new file mode 100644 index 000000000000..c82675bd97d2 --- /dev/null +++ b/crates/biome_rule_options/src/no_with.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoWithOptions {} diff --git a/crates/biome_rule_options/src/no_yoda_expression.rs b/crates/biome_rule_options/src/no_yoda_expression.rs new file mode 100644 index 000000000000..6742c29b1fdf --- /dev/null +++ b/crates/biome_rule_options/src/no_yoda_expression.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct NoYodaExpressionOptions {} diff --git a/crates/biome_rule_options/src/organize_imports.rs b/crates/biome_rule_options/src/organize_imports.rs new file mode 100644 index 000000000000..6f4ceddf0866 --- /dev/null +++ b/crates/biome_rule_options/src/organize_imports.rs @@ -0,0 +1,13 @@ +pub mod import_groups; +pub mod import_source; + +use crate::organize_imports::import_groups::ImportGroups; +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct OrganizeImportsOptions { + pub groups: ImportGroups, +} diff --git a/crates/biome_js_analyze/src/assist/source/organize_imports/import_groups.rs b/crates/biome_rule_options/src/organize_imports/import_groups.rs similarity index 100% rename from crates/biome_js_analyze/src/assist/source/organize_imports/import_groups.rs rename to crates/biome_rule_options/src/organize_imports/import_groups.rs diff --git a/crates/biome_js_analyze/src/assist/source/organize_imports/import_source.rs b/crates/biome_rule_options/src/organize_imports/import_source.rs similarity index 99% rename from crates/biome_js_analyze/src/assist/source/organize_imports/import_source.rs rename to crates/biome_rule_options/src/organize_imports/import_source.rs index 7d1506bf3539..69fe9f42bc43 100644 --- a/crates/biome_js_analyze/src/assist/source/organize_imports/import_source.rs +++ b/crates/biome_rule_options/src/organize_imports/import_source.rs @@ -15,7 +15,7 @@ use biome_string_case::AsciiCollator; /// See [ImportSourceAsciiCollator] for more details. /// /// ``` -/// use biome_js_analyze::assist::source::organize_imports::import_source::ImportSource; +/// use biome_rule_options::organize_imports::import_source::ImportSource; /// /// assert!(ImportSource::from("https://example.org") < ImportSource::from("bun:test")); /// assert!(ImportSource::from("node:test") < ImportSource::from("@scope/package")); diff --git a/crates/biome_rule_options/src/shared/mod.rs b/crates/biome_rule_options/src/shared/mod.rs new file mode 100644 index 000000000000..e744bd2e321b --- /dev/null +++ b/crates/biome_rule_options/src/shared/mod.rs @@ -0,0 +1 @@ +pub mod restricted_regex; diff --git a/crates/biome_js_analyze/src/utils/restricted_regex.rs b/crates/biome_rule_options/src/shared/restricted_regex.rs similarity index 99% rename from crates/biome_js_analyze/src/utils/restricted_regex.rs rename to crates/biome_rule_options/src/shared/restricted_regex.rs index 77b5a3f2a583..b2159aba26e3 100644 --- a/crates/biome_js_analyze/src/utils/restricted_regex.rs +++ b/crates/biome_rule_options/src/shared/restricted_regex.rs @@ -98,7 +98,7 @@ impl biome_deserialize::Deserializable for RestrictedRegex { } } -#[cfg(feature = "schemars")] +#[cfg(feature = "schema")] impl schemars::JsonSchema for RestrictedRegex { fn schema_name() -> String { "Regex".to_string() diff --git a/crates/biome_rule_options/src/use_adjacent_getter_setter.rs b/crates/biome_rule_options/src/use_adjacent_getter_setter.rs new file mode 100644 index 000000000000..af92ae7dd276 --- /dev/null +++ b/crates/biome_rule_options/src/use_adjacent_getter_setter.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAdjacentGetterSetterOptions {} diff --git a/crates/biome_rule_options/src/use_adjacent_overload_signatures.rs b/crates/biome_rule_options/src/use_adjacent_overload_signatures.rs new file mode 100644 index 000000000000..6be7eb6bbe83 --- /dev/null +++ b/crates/biome_rule_options/src/use_adjacent_overload_signatures.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAdjacentOverloadSignaturesOptions {} diff --git a/crates/biome_rule_options/src/use_alt_text.rs b/crates/biome_rule_options/src/use_alt_text.rs new file mode 100644 index 000000000000..a8d1a8040cc8 --- /dev/null +++ b/crates/biome_rule_options/src/use_alt_text.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAltTextOptions {} diff --git a/crates/biome_rule_options/src/use_anchor_content.rs b/crates/biome_rule_options/src/use_anchor_content.rs new file mode 100644 index 000000000000..c844388f842f --- /dev/null +++ b/crates/biome_rule_options/src/use_anchor_content.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAnchorContentOptions {} diff --git a/crates/biome_rule_options/src/use_aria_activedescendant_with_tabindex.rs b/crates/biome_rule_options/src/use_aria_activedescendant_with_tabindex.rs new file mode 100644 index 000000000000..0c901d4a28b4 --- /dev/null +++ b/crates/biome_rule_options/src/use_aria_activedescendant_with_tabindex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAriaActivedescendantWithTabindexOptions {} diff --git a/crates/biome_rule_options/src/use_aria_props_for_role.rs b/crates/biome_rule_options/src/use_aria_props_for_role.rs new file mode 100644 index 000000000000..344adbaa613b --- /dev/null +++ b/crates/biome_rule_options/src/use_aria_props_for_role.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAriaPropsForRoleOptions {} diff --git a/crates/biome_rule_options/src/use_aria_props_supported_by_role.rs b/crates/biome_rule_options/src/use_aria_props_supported_by_role.rs new file mode 100644 index 000000000000..ebfc52492914 --- /dev/null +++ b/crates/biome_rule_options/src/use_aria_props_supported_by_role.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAriaPropsSupportedByRoleOptions {} diff --git a/crates/biome_rule_options/src/use_array_literals.rs b/crates/biome_rule_options/src/use_array_literals.rs new file mode 100644 index 000000000000..a09ec3ebdf34 --- /dev/null +++ b/crates/biome_rule_options/src/use_array_literals.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseArrayLiteralsOptions {} diff --git a/crates/biome_rule_options/src/use_arrow_function.rs b/crates/biome_rule_options/src/use_arrow_function.rs new file mode 100644 index 000000000000..40ed4bf9b031 --- /dev/null +++ b/crates/biome_rule_options/src/use_arrow_function.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseArrowFunctionOptions {} diff --git a/crates/biome_rule_options/src/use_as_const_assertion.rs b/crates/biome_rule_options/src/use_as_const_assertion.rs new file mode 100644 index 000000000000..7a02c4ec0e72 --- /dev/null +++ b/crates/biome_rule_options/src/use_as_const_assertion.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAsConstAssertionOptions {} diff --git a/crates/biome_rule_options/src/use_at_index.rs b/crates/biome_rule_options/src/use_at_index.rs new file mode 100644 index 000000000000..0a2953a0c998 --- /dev/null +++ b/crates/biome_rule_options/src/use_at_index.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAtIndexOptions {} diff --git a/crates/biome_rule_options/src/use_await.rs b/crates/biome_rule_options/src/use_await.rs new file mode 100644 index 000000000000..1feff13534d4 --- /dev/null +++ b/crates/biome_rule_options/src/use_await.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseAwaitOptions {} diff --git a/crates/biome_rule_options/src/use_block_statements.rs b/crates/biome_rule_options/src/use_block_statements.rs new file mode 100644 index 000000000000..b203f14de8ab --- /dev/null +++ b/crates/biome_rule_options/src/use_block_statements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseBlockStatementsOptions {} diff --git a/crates/biome_rule_options/src/use_button_type.rs b/crates/biome_rule_options/src/use_button_type.rs new file mode 100644 index 000000000000..b1c4c9bd611f --- /dev/null +++ b/crates/biome_rule_options/src/use_button_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseButtonTypeOptions {} diff --git a/crates/biome_rule_options/src/use_collapsed_else_if.rs b/crates/biome_rule_options/src/use_collapsed_else_if.rs new file mode 100644 index 000000000000..030729d0d79b --- /dev/null +++ b/crates/biome_rule_options/src/use_collapsed_else_if.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseCollapsedElseIfOptions {} diff --git a/crates/biome_rule_options/src/use_collapsed_if.rs b/crates/biome_rule_options/src/use_collapsed_if.rs new file mode 100644 index 000000000000..cb2f5adf3040 --- /dev/null +++ b/crates/biome_rule_options/src/use_collapsed_if.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseCollapsedIfOptions {} diff --git a/crates/biome_rule_options/src/use_component_export_only_modules.rs b/crates/biome_rule_options/src/use_component_export_only_modules.rs new file mode 100644 index 000000000000..b2758e4d54df --- /dev/null +++ b/crates/biome_rule_options/src/use_component_export_only_modules.rs @@ -0,0 +1,13 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseComponentExportOnlyModulesOptions { + /// Allows the export of constants. This option is for environments that support it, such as [Vite](https://vitejs.dev/) + #[serde(default)] + pub allow_constant_export: bool, + /// A list of names that can be additionally exported from the module This option is for exports that do not hinder [React Fast Refresh](https://github.com/facebook/react/tree/main/packages/react-refresh), such as [`meta` in Remix](https://remix.run/docs/en/main/route/meta) + #[serde(default, skip_serializing_if = "<[_]>::is_empty")] + pub allow_export_names: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/use_consistent_array_type.rs b/crates/biome_rule_options/src/use_consistent_array_type.rs new file mode 100644 index 000000000000..04392f6a3dc3 --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_array_type.rs @@ -0,0 +1,32 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +use std::str::FromStr; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentArrayTypeOptions { + pub syntax: ConsistentArrayType, +} + +#[derive(Clone, Copy, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase")] +pub enum ConsistentArrayType { + /// `ItemType[]` + #[default] + Shorthand, + /// `Array` + Generic, +} + +impl FromStr for ConsistentArrayType { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + match s { + "shorthand" => Ok(Self::Shorthand), + "generic" => Ok(Self::Generic), + _ => Err("Value not supported for array type syntax"), + } + } +} diff --git a/crates/biome_rule_options/src/use_consistent_builtin_instantiation.rs b/crates/biome_rule_options/src/use_consistent_builtin_instantiation.rs new file mode 100644 index 000000000000..e45a7139d700 --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_builtin_instantiation.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentBuiltinInstantiationOptions {} diff --git a/crates/biome_rule_options/src/use_consistent_curly_braces.rs b/crates/biome_rule_options/src/use_consistent_curly_braces.rs new file mode 100644 index 000000000000..33f581c6dce7 --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_curly_braces.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentCurlyBracesOptions {} diff --git a/crates/biome_rule_options/src/use_consistent_member_accessibility.rs b/crates/biome_rule_options/src/use_consistent_member_accessibility.rs new file mode 100644 index 000000000000..d016afdf7a97 --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_member_accessibility.rs @@ -0,0 +1,19 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentMemberAccessibilityOptions { + /// The kind of accessibility you want to enforce. Default to "noPublic" + pub accessibility: Accessibility, +} + +#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub enum Accessibility { + #[default] + NoPublic, + Explicit, + None, +} diff --git a/crates/biome_rule_options/src/use_consistent_object_definition.rs b/crates/biome_rule_options/src/use_consistent_object_definition.rs new file mode 100644 index 000000000000..f4d7508483f9 --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_object_definition.rs @@ -0,0 +1,20 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentObjectDefinitionOptions { + /// The preferred syntax to enforce. + pub syntax: ObjectPropertySyntax, +} + +#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub enum ObjectPropertySyntax { + /// `{foo: foo}` + Explicit, + /// `{foo}` + #[default] + Shorthand, +} diff --git a/crates/biome_rule_options/src/use_consistent_response.rs b/crates/biome_rule_options/src/use_consistent_response.rs new file mode 100644 index 000000000000..54206081534a --- /dev/null +++ b/crates/biome_rule_options/src/use_consistent_response.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConsistentResponseOptions {} diff --git a/crates/biome_rule_options/src/use_const.rs b/crates/biome_rule_options/src/use_const.rs new file mode 100644 index 000000000000..efc9bc58c40f --- /dev/null +++ b/crates/biome_rule_options/src/use_const.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseConstOptions {} diff --git a/crates/biome_rule_options/src/use_date_now.rs b/crates/biome_rule_options/src/use_date_now.rs new file mode 100644 index 000000000000..bf8bca88b0aa --- /dev/null +++ b/crates/biome_rule_options/src/use_date_now.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseDateNowOptions {} diff --git a/crates/biome_rule_options/src/use_default_parameter_last.rs b/crates/biome_rule_options/src/use_default_parameter_last.rs new file mode 100644 index 000000000000..e4a8d2cccbc0 --- /dev/null +++ b/crates/biome_rule_options/src/use_default_parameter_last.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseDefaultParameterLastOptions {} diff --git a/crates/biome_rule_options/src/use_default_switch_clause.rs b/crates/biome_rule_options/src/use_default_switch_clause.rs new file mode 100644 index 000000000000..2ab104e8f39c --- /dev/null +++ b/crates/biome_rule_options/src/use_default_switch_clause.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseDefaultSwitchClauseOptions {} diff --git a/crates/biome_rule_options/src/use_default_switch_clause_last.rs b/crates/biome_rule_options/src/use_default_switch_clause_last.rs new file mode 100644 index 000000000000..43b7c1d70c6e --- /dev/null +++ b/crates/biome_rule_options/src/use_default_switch_clause_last.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseDefaultSwitchClauseLastOptions {} diff --git a/crates/biome_rule_options/src/use_deprecated_reason.rs b/crates/biome_rule_options/src/use_deprecated_reason.rs new file mode 100644 index 000000000000..84cbd65edc57 --- /dev/null +++ b/crates/biome_rule_options/src/use_deprecated_reason.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseDeprecatedReasonOptions {} diff --git a/crates/biome_rule_options/src/use_enum_initializers.rs b/crates/biome_rule_options/src/use_enum_initializers.rs new file mode 100644 index 000000000000..9e482094ac74 --- /dev/null +++ b/crates/biome_rule_options/src/use_enum_initializers.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseEnumInitializersOptions {} diff --git a/crates/biome_rule_options/src/use_error_message.rs b/crates/biome_rule_options/src/use_error_message.rs new file mode 100644 index 000000000000..8402b950c741 --- /dev/null +++ b/crates/biome_rule_options/src/use_error_message.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseErrorMessageOptions {} diff --git a/crates/biome_rule_options/src/use_exhaustive_dependencies.rs b/crates/biome_rule_options/src/use_exhaustive_dependencies.rs new file mode 100644 index 000000000000..7ad44f863e4c --- /dev/null +++ b/crates/biome_rule_options/src/use_exhaustive_dependencies.rs @@ -0,0 +1,265 @@ +use biome_console::markup; +use biome_deserialize::{ + DeserializableTypes, DeserializableValidator, DeserializableValue, DeserializationContext, + DeserializationDiagnostic, DeserializationVisitor, TextRange, non_empty, +}; +use biome_deserialize_macros::Deserializable; +use biome_diagnostics::Severity; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExhaustiveDependenciesOptions { + /// Whether to report an error when a dependency is listed in the dependencies array but isn't used. Defaults to true. + #[serde(default = "report_unnecessary_dependencies_default")] + pub report_unnecessary_dependencies: bool, + + /// Whether to report an error when a hook has no dependencies array. + #[serde(default)] + pub report_missing_dependencies_array: bool, + + /// List of hooks of which the dependencies should be validated. + #[serde(default)] + #[deserializable(validate = "non_empty")] + pub hooks: Box<[Hook]>, +} + +fn report_unnecessary_dependencies_default() -> bool { + true +} + +impl Default for UseExhaustiveDependenciesOptions { + fn default() -> Self { + Self { + report_unnecessary_dependencies: report_unnecessary_dependencies_default(), + report_missing_dependencies_array: false, + hooks: Vec::new().into_boxed_slice(), + } + } +} + +#[derive(Clone, Debug, Default, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +#[deserializable(with_validator)] +pub struct Hook { + /// The name of the hook. + #[deserializable(validate = "non_empty")] + pub name: Box, + + /// The "position" of the closure function, starting from zero. + /// + /// For example, for React's `useEffect()` hook, the closure index is 0. + pub closure_index: Option, + + /// The "position" of the array of dependencies, starting from zero. + /// + /// For example, for React's `useEffect()` hook, the dependencies index is 1. + pub dependencies_index: Option, + + /// Whether the result of the hook is stable. + /// + /// Set to `true` to mark the identity of the hook's return value as stable, + /// or use a number/an array of numbers to mark the "positions" in the + /// return array as stable. + /// + /// For example, for React's `useRef()` hook the value would be `true`, + /// while for `useState()` it would be `[1]`. + pub stable_result: Option, +} + +impl DeserializableValidator for Hook { + fn validate( + &mut self, + ctx: &mut impl DeserializationContext, + _name: &str, + range: TextRange, + ) -> bool { + match (self.closure_index, self.dependencies_index) { + (Some(closure_index), Some(dependencies_index)) + if closure_index == dependencies_index => + { + ctx.report( + DeserializationDiagnostic::new(markup! { + "closureIndex"" and ""dependenciesIndex"" may not be the same" + }) + .with_range(range), + ); + + self.closure_index = None; + self.dependencies_index = None; + } + _ => {} + } + + true + } +} + +#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum StableHookResult { + /// Used to indicate the hook does not have a stable result. + #[default] + None, + + /// Used to indicate the identity of the result value is stable. + /// + /// Note this does not imply internal stability. For instance, the ref + /// objects returned by React's `useRef()` always have a stable identity, + /// but their internal value may be mutable. + Identity, + + /// Used to indicate the hook returns an array and some of its indices have + /// stable identities. + /// + /// For example, React's `useState()` hook returns a stable function at + /// index 1. + Indices(Vec), +} + +#[cfg(feature = "schema")] +impl schemars::JsonSchema for StableHookResult { + fn schema_name() -> String { + "StableHookResult".to_owned() + } + + fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + use schemars::schema::*; + Schema::Object(SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + one_of: Some(vec![ + Schema::Object(SchemaObject { + instance_type: Some(InstanceType::Boolean.into()), + metadata: Some(Box::new(Metadata { + description: Some("Whether the hook has a stable result.".to_owned()), + ..Default::default() + })), + ..Default::default() + }), + Schema::Object(SchemaObject { + instance_type: Some(InstanceType::Array.into()), + array: Some(Box::new(ArrayValidation { + items: Some(SingleOrVec::Single(Box::new(Schema::Object(SchemaObject { + instance_type: Some(InstanceType::Integer.into()), + format: Some("uint8".to_owned()), + number: Some(Box::new(NumberValidation { + minimum: Some(0.), + maximum: Some(255.), + ..Default::default() + })), + ..Default::default() + })))), + min_items: Some(1), + ..Default::default() + })), + metadata: Some(Box::new(Metadata { + description: Some("Used to indicate the hook returns an array and some of its indices have stable identities.".to_owned()), + ..Default::default() + })), + ..Default::default() + }) + ]), + ..Default::default() + })), + ..Default::default() + }) + } +} + +impl biome_deserialize::Deserializable for StableHookResult { + fn deserialize( + ctx: &mut impl DeserializationContext, + value: &impl DeserializableValue, + name: &str, + ) -> Option { + value.deserialize(ctx, StableResultVisitor, name) + } +} + +struct StableResultVisitor; +impl DeserializationVisitor for StableResultVisitor { + type Output = StableHookResult; + + const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::ARRAY + .union(DeserializableTypes::BOOL) + .union(DeserializableTypes::NUMBER); + + fn visit_array( + self, + ctx: &mut impl DeserializationContext, + items: impl Iterator>, + _range: TextRange, + _name: &str, + ) -> Option { + let indices: Vec = items + .filter_map(|value| { + DeserializableValue::deserialize(&value?, ctx, StableResultIndexVisitor, "") + }) + .collect(); + + Some(if indices.is_empty() { + StableHookResult::None + } else { + StableHookResult::Indices(indices) + }) + } + + fn visit_bool( + self, + ctx: &mut impl DeserializationContext, + value: bool, + range: TextRange, + _name: &str, + ) -> Option { + match value { + true => Some(StableHookResult::Identity), + false => { + ctx.report( + DeserializationDiagnostic::new( + markup! { "This hook is configured to not have a stable result" }, + ) + .with_custom_severity(Severity::Warning) + .with_range(range), + ); + Some(StableHookResult::None) + } + } + } + + fn visit_number( + self, + ctx: &mut impl DeserializationContext, + value: biome_deserialize::TextNumber, + range: TextRange, + name: &str, + ) -> Option { + StableResultIndexVisitor::visit_number(StableResultIndexVisitor, ctx, value, range, name) + .map(|index| StableHookResult::Indices(vec![index])) + } +} + +struct StableResultIndexVisitor; +impl DeserializationVisitor for StableResultIndexVisitor { + type Output = u8; + + const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::NUMBER; + + fn visit_number( + self, + ctx: &mut impl DeserializationContext, + value: biome_deserialize::TextNumber, + range: TextRange, + _name: &str, + ) -> Option { + match value.parse::() { + Ok(index) => Some(index), + Err(_) => { + ctx.report(DeserializationDiagnostic::new_out_of_bound_integer( + 0, 255, range, + )); + None + } + } + } +} diff --git a/crates/biome_rule_options/src/use_exhaustive_switch_cases.rs b/crates/biome_rule_options/src/use_exhaustive_switch_cases.rs new file mode 100644 index 000000000000..c044d6c00700 --- /dev/null +++ b/crates/biome_rule_options/src/use_exhaustive_switch_cases.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExhaustiveSwitchCasesOptions {} diff --git a/crates/biome_rule_options/src/use_explicit_length_check.rs b/crates/biome_rule_options/src/use_explicit_length_check.rs new file mode 100644 index 000000000000..95e8977470f1 --- /dev/null +++ b/crates/biome_rule_options/src/use_explicit_length_check.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExplicitLengthCheckOptions {} diff --git a/crates/biome_rule_options/src/use_explicit_type.rs b/crates/biome_rule_options/src/use_explicit_type.rs new file mode 100644 index 000000000000..3cb78412bdff --- /dev/null +++ b/crates/biome_rule_options/src/use_explicit_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExplicitTypeOptions {} diff --git a/crates/biome_rule_options/src/use_exponentiation_operator.rs b/crates/biome_rule_options/src/use_exponentiation_operator.rs new file mode 100644 index 000000000000..6f7cccc87e5d --- /dev/null +++ b/crates/biome_rule_options/src/use_exponentiation_operator.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExponentiationOperatorOptions {} diff --git a/crates/biome_rule_options/src/use_export_type.rs b/crates/biome_rule_options/src/use_export_type.rs new file mode 100644 index 000000000000..8d25ae168168 --- /dev/null +++ b/crates/biome_rule_options/src/use_export_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExportTypeOptions {} diff --git a/crates/biome_rule_options/src/use_exports_last.rs b/crates/biome_rule_options/src/use_exports_last.rs new file mode 100644 index 000000000000..a100f2c79225 --- /dev/null +++ b/crates/biome_rule_options/src/use_exports_last.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseExportsLastOptions {} diff --git a/crates/biome_rule_options/src/use_filenaming_convention.rs b/crates/biome_rule_options/src/use_filenaming_convention.rs new file mode 100644 index 000000000000..c9e81f643af9 --- /dev/null +++ b/crates/biome_rule_options/src/use_filenaming_convention.rs @@ -0,0 +1,219 @@ +use crate::restricted_regex::RestrictedRegex; +use biome_console::markup; +use biome_deserialize::{DeserializationContext, TextRange}; +use biome_deserialize_macros::Deserializable; +use biome_string_case::{Case, Cases}; +use serde::{Deserialize, Serialize}; +use smallvec::SmallVec; +use std::str::FromStr; + +#[derive(Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseFilenamingConventionOptions { + /// If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. + /// This does not affect other [Case]. + #[serde(default = "enabled", skip_serializing_if = "bool::clone")] + pub strict_case: bool, + + /// If `false`, then non-ASCII characters are allowed. + #[serde(default = "enabled", skip_serializing_if = "bool::clone")] + pub require_ascii: bool, + + /// Regular expression to enforce + #[serde(default, rename = "match", skip_serializing_if = "Option::is_none")] + pub matching: Option, + + /// Allowed cases for file names. + #[serde(default, skip_serializing_if = "is_default")] + pub filename_cases: FilenameCases, +} + +const fn enabled() -> bool { + true +} + +fn is_default(value: &T) -> bool { + value == &T::default() +} + +impl Default for UseFilenamingConventionOptions { + fn default() -> Self { + Self { + strict_case: true, + require_ascii: true, + matching: None, + filename_cases: FilenameCases::default(), + } + } +} + +#[derive( + Clone, Copy, Debug, Deserializable, Eq, Hash, PartialEq, serde::Deserialize, serde::Serialize, +)] +#[serde( + from = "SmallVec<[FilenameCase; 5]>", + into = "SmallVec<[FilenameCase; 5]>" +)] +#[deserializable(with_validator)] +pub struct FilenameCases { + pub cases: Cases, + /// `true` is the filename can be equal to the name of an export. + pub allow_export: bool, +} +impl From> for FilenameCases { + fn from(values: SmallVec<[FilenameCase; 5]>) -> Self { + Self::from_iter(values) + } +} +impl FromIterator for FilenameCases { + fn from_iter>(values: T) -> Self { + let mut result = Self { + cases: Cases::empty(), + allow_export: false, + }; + for filename_case in values { + if let Ok(case) = Case::try_from(filename_case) { + result.cases |= case; + } else { + result.allow_export = true; + } + } + result + } +} +impl From for SmallVec<[FilenameCase; 5]> { + fn from(value: FilenameCases) -> Self { + let maybe_export = if value.allow_export { + &[FilenameCase::Export][..] + } else { + &[] + }; + value + .cases + .into_iter() + .filter_map(|case| FilenameCase::try_from(case).ok()) + .chain(maybe_export.iter().copied()) + .collect() + } +} +#[cfg(feature = "schema")] +impl schemars::JsonSchema for FilenameCases { + fn schema_name() -> String { + "FilenameCases".to_string() + } + fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + >::json_schema(generator) + } +} +impl Default for FilenameCases { + fn default() -> Self { + Self { + cases: Case::Camel | Case::Kebab | Case::Snake, + allow_export: true, + } + } +} + +impl biome_deserialize::DeserializableValidator for FilenameCases { + fn validate( + &mut self, + ctx: &mut impl DeserializationContext, + name: &str, + range: TextRange, + ) -> bool { + if !self.allow_export && self.cases.is_empty() { + ctx.report( + biome_deserialize::DeserializationDiagnostic::new(markup! { + ""{name}" cannot be an empty array." + }) + .with_range(range), + ); + false + } else { + true + } + } +} + +/// Supported cases for file names. +#[derive( + Clone, Copy, Debug, serde::Deserialize, Deserializable, Eq, Hash, PartialEq, serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +pub enum FilenameCase { + /// camelCase + #[serde(rename = "camelCase")] + Camel, + + /// Match an export name + #[serde(rename = "export")] + Export, + + /// kebab-case + #[serde(rename = "kebab-case")] + Kebab, + + /// PascalCase + #[serde(rename = "PascalCase")] + Pascal, + + /// snake_case + #[serde(rename = "snake_case")] + Snake, +} +impl FilenameCase { + pub const ALLOWED_VARIANTS: &'static [&'static str] = &[ + "camelCase", + "export", + "kebab-case", + "PascalCase", + "snake_case", + ]; +} +impl FromStr for FilenameCase { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + match s { + "camelCase" => Ok(Self::Camel), + "export" => Ok(Self::Export), + "kebab-case" => Ok(Self::Kebab), + "PascalCase" => Ok(Self::Pascal), + "snake_case" => Ok(Self::Snake), + _ => Err("Value not supported for enum member case"), + } + } +} +impl TryFrom for Case { + type Error = &'static str; + + fn try_from(case: FilenameCase) -> Result { + match case { + FilenameCase::Camel => Ok(Self::Camel), + FilenameCase::Export => Err("`export` is not a valid case"), + FilenameCase::Kebab => Ok(Self::Kebab), + FilenameCase::Pascal => Ok(Self::Pascal), + FilenameCase::Snake => Ok(Self::Snake), + } + } +} +impl TryFrom for FilenameCase { + type Error = &'static str; + + fn try_from(value: Case) -> Result { + match value { + Case::Camel => Ok(Self::Camel), + Case::Kebab => Ok(Self::Kebab), + Case::Pascal => Ok(Self::Pascal), + Case::Snake => Ok(Self::Snake), + Case::Constant + | Case::Lower + | Case::Number + | Case::NumberableCapital + | Case::Uni + | Case::Upper + | Case::Unknown => Err("Unsupported case"), + } + } +} diff --git a/crates/biome_rule_options/src/use_flat_map.rs b/crates/biome_rule_options/src/use_flat_map.rs new file mode 100644 index 000000000000..929ae0d45696 --- /dev/null +++ b/crates/biome_rule_options/src/use_flat_map.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseFlatMapOptions {} diff --git a/crates/biome_rule_options/src/use_focusable_interactive.rs b/crates/biome_rule_options/src/use_focusable_interactive.rs new file mode 100644 index 000000000000..dc2aa90f1dad --- /dev/null +++ b/crates/biome_rule_options/src/use_focusable_interactive.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseFocusableInteractiveOptions {} diff --git a/crates/biome_rule_options/src/use_for_component.rs b/crates/biome_rule_options/src/use_for_component.rs new file mode 100644 index 000000000000..272969abe14d --- /dev/null +++ b/crates/biome_rule_options/src/use_for_component.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseForComponentOptions {} diff --git a/crates/biome_rule_options/src/use_for_of.rs b/crates/biome_rule_options/src/use_for_of.rs new file mode 100644 index 000000000000..c5e00f7928a2 --- /dev/null +++ b/crates/biome_rule_options/src/use_for_of.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseForOfOptions {} diff --git a/crates/biome_rule_options/src/use_fragment_syntax.rs b/crates/biome_rule_options/src/use_fragment_syntax.rs new file mode 100644 index 000000000000..2ea3e37e955f --- /dev/null +++ b/crates/biome_rule_options/src/use_fragment_syntax.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseFragmentSyntaxOptions {} diff --git a/crates/biome_rule_options/src/use_generic_font_names.rs b/crates/biome_rule_options/src/use_generic_font_names.rs new file mode 100644 index 000000000000..d6d08269c353 --- /dev/null +++ b/crates/biome_rule_options/src/use_generic_font_names.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseGenericFontNamesOptions {} diff --git a/crates/biome_rule_options/src/use_getter_return.rs b/crates/biome_rule_options/src/use_getter_return.rs new file mode 100644 index 000000000000..6bed3ea04319 --- /dev/null +++ b/crates/biome_rule_options/src/use_getter_return.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseGetterReturnOptions {} diff --git a/crates/biome_rule_options/src/use_google_font_display.rs b/crates/biome_rule_options/src/use_google_font_display.rs new file mode 100644 index 000000000000..2d078b43e331 --- /dev/null +++ b/crates/biome_rule_options/src/use_google_font_display.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseGoogleFontDisplayOptions {} diff --git a/crates/biome_rule_options/src/use_google_font_preconnect.rs b/crates/biome_rule_options/src/use_google_font_preconnect.rs new file mode 100644 index 000000000000..8699ddc7c085 --- /dev/null +++ b/crates/biome_rule_options/src/use_google_font_preconnect.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseGoogleFontPreconnectOptions {} diff --git a/crates/biome_rule_options/src/use_guard_for_in.rs b/crates/biome_rule_options/src/use_guard_for_in.rs new file mode 100644 index 000000000000..a91e60ab125f --- /dev/null +++ b/crates/biome_rule_options/src/use_guard_for_in.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseGuardForInOptions {} diff --git a/crates/biome_rule_options/src/use_heading_content.rs b/crates/biome_rule_options/src/use_heading_content.rs new file mode 100644 index 000000000000..bfd700cffb19 --- /dev/null +++ b/crates/biome_rule_options/src/use_heading_content.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseHeadingContentOptions {} diff --git a/crates/biome_rule_options/src/use_hook_at_top_level.rs b/crates/biome_rule_options/src/use_hook_at_top_level.rs new file mode 100644 index 000000000000..240ebac1e571 --- /dev/null +++ b/crates/biome_rule_options/src/use_hook_at_top_level.rs @@ -0,0 +1,64 @@ +use biome_console::markup; +use biome_deserialize::{ + Deserializable, DeserializableTypes, DeserializableValue, DeserializationContext, + DeserializationDiagnostic, DeserializationVisitor, TextRange, +}; +use biome_rowan::Text; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseHookAtTopLevelOptions {} + +impl Deserializable for UseHookAtTopLevelOptions { + fn deserialize( + ctx: &mut impl DeserializationContext, + value: &impl DeserializableValue, + name: &str, + ) -> Option { + value.deserialize(ctx, DeprecatedHooksOptionsVisitor, name) + } +} + +// TODO: remove in Biome 2.0 +struct DeprecatedHooksOptionsVisitor; +impl DeserializationVisitor for DeprecatedHooksOptionsVisitor { + type Output = UseHookAtTopLevelOptions; + + const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::MAP; + + fn visit_map( + self, + ctx: &mut impl DeserializationContext, + members: impl Iterator>, + _range: TextRange, + _name: &str, + ) -> Option { + const ALLOWED_KEYS: &[&str] = &["hooks"]; + for (key, value) in members.flatten() { + let Some(key_text) = Text::deserialize(ctx, &key, "") else { + continue; + }; + match key_text.text() { + "hooks" => { + ctx.report( + DeserializationDiagnostic::new_deprecated( + key_text.text(), + value.range() + ).with_note( + markup! { + "useHookAtTopLevel"" now uses the React hook naming convention to determine hook calls." + }) + ); + } + text => ctx.report(DeserializationDiagnostic::new_unknown_key( + text, + key.range(), + ALLOWED_KEYS, + )), + } + } + Some(Self::Output::default()) + } +} diff --git a/crates/biome_rule_options/src/use_html_lang.rs b/crates/biome_rule_options/src/use_html_lang.rs new file mode 100644 index 000000000000..1053ff0fd0cf --- /dev/null +++ b/crates/biome_rule_options/src/use_html_lang.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseHtmlLangOptions {} diff --git a/crates/biome_rule_options/src/use_iframe_title.rs b/crates/biome_rule_options/src/use_iframe_title.rs new file mode 100644 index 000000000000..2772a3538f53 --- /dev/null +++ b/crates/biome_rule_options/src/use_iframe_title.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseIframeTitleOptions {} diff --git a/crates/biome_rule_options/src/use_import_extensions.rs b/crates/biome_rule_options/src/use_import_extensions.rs new file mode 100644 index 000000000000..c42790b797f9 --- /dev/null +++ b/crates/biome_rule_options/src/use_import_extensions.rs @@ -0,0 +1,10 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseImportExtensionsOptions { + /// If `true`, the suggested extension is always `.js` regardless of what + /// extension the source file has in your project. + pub force_js_extensions: bool, +} diff --git a/crates/biome_rule_options/src/use_import_type.rs b/crates/biome_rule_options/src/use_import_type.rs new file mode 100644 index 000000000000..c87585540369 --- /dev/null +++ b/crates/biome_rule_options/src/use_import_type.rs @@ -0,0 +1,25 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseImportTypeOptions { + /// The style to apply when import types. Default to "auto" + pub style: Style, +} + +/// Rule's options. +#[derive( + Debug, Default, Copy, Clone, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub enum Style { + /// Use the best fitting style according to the situation + #[default] + Auto, + /// Always use inline type keywords + InlineType, + /// Always separate types in a dedicated `import type` + SeparatedType, +} diff --git a/crates/biome_rule_options/src/use_index_of.rs b/crates/biome_rule_options/src/use_index_of.rs new file mode 100644 index 000000000000..fc8ec6f07753 --- /dev/null +++ b/crates/biome_rule_options/src/use_index_of.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseIndexOfOptions {} diff --git a/crates/biome_rule_options/src/use_is_array.rs b/crates/biome_rule_options/src/use_is_array.rs new file mode 100644 index 000000000000..0d61199fb713 --- /dev/null +++ b/crates/biome_rule_options/src/use_is_array.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseIsArrayOptions {} diff --git a/crates/biome_rule_options/src/use_is_nan.rs b/crates/biome_rule_options/src/use_is_nan.rs new file mode 100644 index 000000000000..1024cf4f25b4 --- /dev/null +++ b/crates/biome_rule_options/src/use_is_nan.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseIsNanOptions {} diff --git a/crates/biome_rule_options/src/use_iterable_callback_return.rs b/crates/biome_rule_options/src/use_iterable_callback_return.rs new file mode 100644 index 000000000000..74b01ab0ec02 --- /dev/null +++ b/crates/biome_rule_options/src/use_iterable_callback_return.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseIterableCallbackReturnOptions {} diff --git a/crates/biome_rule_options/src/use_json_import_attribute.rs b/crates/biome_rule_options/src/use_json_import_attribute.rs new file mode 100644 index 000000000000..0e3ad707c36a --- /dev/null +++ b/crates/biome_rule_options/src/use_json_import_attribute.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseJsonImportAttributeOptions {} diff --git a/crates/biome_rule_options/src/use_jsx_key_in_iterable.rs b/crates/biome_rule_options/src/use_jsx_key_in_iterable.rs new file mode 100644 index 000000000000..e37af675cd85 --- /dev/null +++ b/crates/biome_rule_options/src/use_jsx_key_in_iterable.rs @@ -0,0 +1,9 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseJsxKeyInIterableOptions { + /// Set to `true` to check shorthand fragments (`<>`) + pub check_shorthand_fragments: bool, +} diff --git a/crates/biome_rule_options/src/use_key_with_click_events.rs b/crates/biome_rule_options/src/use_key_with_click_events.rs new file mode 100644 index 000000000000..5823f3dfb536 --- /dev/null +++ b/crates/biome_rule_options/src/use_key_with_click_events.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseKeyWithClickEventsOptions {} diff --git a/crates/biome_rule_options/src/use_key_with_mouse_events.rs b/crates/biome_rule_options/src/use_key_with_mouse_events.rs new file mode 100644 index 000000000000..df642f0c3a40 --- /dev/null +++ b/crates/biome_rule_options/src/use_key_with_mouse_events.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseKeyWithMouseEventsOptions {} diff --git a/crates/biome_rule_options/src/use_literal_enum_members.rs b/crates/biome_rule_options/src/use_literal_enum_members.rs new file mode 100644 index 000000000000..f2dea26cf1e6 --- /dev/null +++ b/crates/biome_rule_options/src/use_literal_enum_members.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseLiteralEnumMembersOptions {} diff --git a/crates/biome_rule_options/src/use_literal_keys.rs b/crates/biome_rule_options/src/use_literal_keys.rs new file mode 100644 index 000000000000..d912ae61f7ae --- /dev/null +++ b/crates/biome_rule_options/src/use_literal_keys.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseLiteralKeysOptions {} diff --git a/crates/biome_rule_options/src/use_media_caption.rs b/crates/biome_rule_options/src/use_media_caption.rs new file mode 100644 index 000000000000..426cf92109d1 --- /dev/null +++ b/crates/biome_rule_options/src/use_media_caption.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseMediaCaptionOptions {} diff --git a/crates/biome_rule_options/src/use_named_operation.rs b/crates/biome_rule_options/src/use_named_operation.rs new file mode 100644 index 000000000000..cf526d832afe --- /dev/null +++ b/crates/biome_rule_options/src/use_named_operation.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNamedOperationOptions {} diff --git a/crates/biome_rule_options/src/use_namespace_keyword.rs b/crates/biome_rule_options/src/use_namespace_keyword.rs new file mode 100644 index 000000000000..4447150c33c2 --- /dev/null +++ b/crates/biome_rule_options/src/use_namespace_keyword.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNamespaceKeywordOptions {} diff --git a/crates/biome_rule_options/src/use_naming_convention.rs b/crates/biome_rule_options/src/use_naming_convention.rs new file mode 100644 index 000000000000..215a3037c0c7 --- /dev/null +++ b/crates/biome_rule_options/src/use_naming_convention.rs @@ -0,0 +1,673 @@ +use crate::shared::restricted_regex::RestrictedRegex; +use biome_deserialize::{ + DeserializableValidator, DeserializationContext, DeserializationDiagnostic, +}; +use biome_deserialize_macros::Deserializable; +use biome_string_case::{Case, Cases}; +use enumflags2::BitFlags; +use smallvec::SmallVec; +use std::ops::Deref; + +/// Rule's options. +#[derive(Debug, Clone, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct UseNamingConventionOptions { + /// If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. + /// This does not affect other [Case]. + #[serde(default = "enabled", skip_serializing_if = "bool::clone")] + pub strict_case: bool, + + /// If `false`, then non-ASCII characters are allowed. + #[serde(default = "enabled", skip_serializing_if = "bool::clone")] + pub require_ascii: bool, + + /// Custom conventions. + #[serde(default, skip_serializing_if = "<[_]>::is_empty")] + pub conventions: Box<[Convention]>, +} +impl Default for UseNamingConventionOptions { + fn default() -> Self { + Self { + strict_case: true, + require_ascii: true, + conventions: Vec::new().into_boxed_slice(), + } + } +} + +const fn enabled() -> bool { + true +} +fn is_default(value: &T) -> bool { + value == &T::default() +} + +#[derive( + Clone, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(deny_unknown_fields)] +#[deserializable(with_validator)] +pub struct Convention { + /// Declarations concerned by this convention + #[serde(default, skip_serializing_if = "is_default")] + pub selector: Selector, + + /// Regular expression to enforce + #[serde(default, rename = "match", skip_serializing_if = "Option::is_none")] + pub matching: Option, + + /// String cases to enforce + #[serde(default, skip_serializing_if = "is_default")] + pub formats: Formats, +} + +impl DeserializableValidator for Convention { + fn validate( + &mut self, + ctx: &mut impl DeserializationContext, + _name: &str, + range: biome_rowan::TextRange, + ) -> bool { + if self.formats.is_empty() && self.matching.is_none() { + ctx.report( + DeserializationDiagnostic::new( + "At least one field among `formats` and `match` must be set.", + ) + .with_range(range), + ); + false + } else { + true + } + } +} + +#[derive( + Clone, Copy, Debug, Default, Deserializable, Eq, PartialEq, serde::Deserialize, serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[deserializable(with_validator)] +#[serde(deny_unknown_fields)] +pub struct Selector { + /// Declaration kind + #[serde(default, skip_serializing_if = "is_default")] + pub kind: Kind, + + /// Modifiers used on the declaration + #[serde(default, skip_serializing_if = "is_default")] + pub modifiers: RestrictedModifiers, + + /// Scope of the declaration + #[serde(default, skip_serializing_if = "is_default")] + pub scope: Scope, +} + +#[derive(Copy, Clone, Debug)] +pub enum InvalidSelector { + IncompatibleModifiers(RestrictedModifier, RestrictedModifier), + UnsupportedModifiers(Kind, RestrictedModifier), + UnsupportedScope(Kind, Scope), +} +impl std::error::Error for InvalidSelector {} +impl std::fmt::Display for InvalidSelector { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::IncompatibleModifiers(modifier1, modifier2) => { + write!( + f, + "The `{modifier1}` and `{modifier2}` modifiers cannot be used together.", + ) + } + Self::UnsupportedModifiers(kind, modifier) => { + write!( + f, + "The `{modifier}` modifier cannot be used with the `{kind}` kind." + ) + } + Self::UnsupportedScope(kind, scope) => { + let scope = scope.to_string(); + let scope = scope.trim_end(); + write!( + f, + "The `{scope}` scope cannot be used with the `{kind}` kind." + ) + } + } + } +} + +impl Selector { + /// Returns an error if the current selector is not valid. + pub fn check(self) -> Result<(), InvalidSelector> { + if self.modifiers.contains(RestrictedModifier::Abstract) { + if self.kind != Kind::Class && !Kind::ClassMember.contains(self.kind) { + return Err(InvalidSelector::UnsupportedModifiers( + self.kind, + RestrictedModifier::Abstract, + )); + } + if self.modifiers.contains(RestrictedModifier::Static) { + return Err(InvalidSelector::IncompatibleModifiers( + RestrictedModifier::Abstract, + RestrictedModifier::Static, + )); + } + } + if self.modifiers.contains(RestrictedModifier::Readonly) + && !matches!( + self.kind, + Kind::ClassProperty | Kind::IndexParameter | Kind::TypeProperty + ) + { + return Err(InvalidSelector::UnsupportedModifiers( + self.kind, + RestrictedModifier::Readonly, + )); + } + if self + .modifiers + .intersects(RestrictedModifier::CLASS_MEMBER_ONLY) + && !Kind::ClassMember.contains(self.kind) + { + let modifiers = self.modifiers.0 & RestrictedModifier::CLASS_MEMBER_ONLY; + if let Some(modifier) = modifiers.iter().next() { + return Err(InvalidSelector::UnsupportedModifiers(self.kind, modifier)); + } + } + // The rule doesn't allow `Modifier::Public`. + // So we only need to check for `Modifier::Private`/`Modifier::Protected` incompatibility. + let accessibility = RestrictedModifier::Private | RestrictedModifier::Protected; + if *self.modifiers & accessibility == accessibility { + return Err(InvalidSelector::IncompatibleModifiers( + RestrictedModifier::Private, + RestrictedModifier::Protected, + )); + } + let abstarct_or_static = RestrictedModifier::Abstract | RestrictedModifier::Static; + if *self.modifiers & abstarct_or_static == abstarct_or_static { + return Err(InvalidSelector::IncompatibleModifiers( + RestrictedModifier::Abstract, + RestrictedModifier::Static, + )); + } + if self.scope == Scope::Global + && !Kind::Variable.contains(self.kind) + && !Kind::Function.contains(self.kind) + && !Kind::TypeLike.contains(self.kind) + { + return Err(InvalidSelector::UnsupportedScope(self.kind, Scope::Global)); + } + Ok(()) + } + + pub fn with_modifiers(kind: Kind, modifiers: impl Into) -> Self { + Self { + kind, + modifiers: modifiers.into(), + ..Default::default() + } + } + + pub fn with_scope(kind: Kind, scope: Scope) -> Self { + Self { + kind, + scope, + ..Default::default() + } + } + + pub fn contains(&self, other: Self) -> bool { + other.kind.contains(self.kind) + && self.modifiers.contains(other.modifiers.0) + && other.scope.contains(self.scope) + } +} + +impl DeserializableValidator for Selector { + fn validate( + &mut self, + ctx: &mut impl DeserializationContext, + _name: &str, + range: biome_rowan::TextRange, + ) -> bool { + if let Err(error) = self.check() { + ctx.report(DeserializationDiagnostic::new(format_args!("{error}")).with_range(range)); + return false; + } + true + } +} + +impl From for Selector { + fn from(kind: Kind) -> Self { + Self { + kind, + modifiers: RestrictedModifiers::default(), + scope: Scope::Any, + } + } +} +impl std::fmt::Display for Selector { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}{}{}", self.scope, self.modifiers, self.kind) + } +} + +impl std::fmt::Display for Scope { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let repr = match self { + Self::Any => "", + Self::Global => "global ", + }; + write!(f, "{repr}") + } +} + +#[derive( + Clone, + Copy, + Debug, + Default, + Deserializable, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase")] +pub enum Kind { + /// All kinds + #[default] + Any, + /// All type definitions: classes, enums, interfaces, and type aliases + TypeLike, + Class, + Enum, + /// Named function declarations and expressions + Function, + Interface, + EnumMember, + /// TypeScript namespaces, import and export namespaces + NamespaceLike, + /// TypeScript mamespaces + Namespace, + ImportNamespace, + ExportNamespace, + // All variable declaration: const, let, using, var + Variable, + Const, + Let, + Using, + Var, + /// All function parameters, but parameter properties + FunctionParameter, + CatchParameter, + IndexParameter, + /// All generic type parameters + TypeParameter, + // All re-export default exports and aliases of re-exported names + ExportAlias, + // All default imports and aliases of named imports + ImportAlias, + /// All class members: properties, methods, getters, and setters + ClassMember, + /// All class properties, including parameter properties + ClassProperty, + ClassGetter, + ClassSetter, + ClassMethod, + /// All object literal members: properties, methods, getters, and setters + ObjectLiteralMember, + ObjectLiteralProperty, + ObjectLiteralGetter, + ObjectLiteralSetter, + ObjectLiteralMethod, + TypeAlias, + /// All members defined in type alaises and interfaces + TypeMember, + /// All getters defined in type alaises and interfaces + TypeGetter, + /// All properties defined in type alaises and interfaces + TypeProperty, + /// All setters defined in type alaises and interfaces + TypeSetter, + /// All methods defined in type alaises and interfaces + TypeMethod, +} + +impl Kind { + pub fn contains(self, other: Self) -> bool { + self == other + || matches!( + (self, other), + (Self::Any, _) + | ( + Self::Variable, + Self::Const | Self::Let | Self::Using | Self::Var, + ) + | ( + Self::ClassMember, + Self::ClassGetter + | Self::ClassMethod + | Self::ClassProperty + | Self::ClassSetter + ) + | ( + Self::ObjectLiteralMember, + Self::ObjectLiteralGetter + | Self::ObjectLiteralMethod + | Self::ObjectLiteralProperty + | Self::ObjectLiteralSetter + ) + | ( + Self::TypeMember, + Self::TypeGetter + | Self::TypeMethod + | Self::TypeParameter + | Self::TypeProperty + | Self::TypeSetter + ) + | ( + Self::NamespaceLike, + Self::ExportNamespace | Self::ImportNamespace | Self::Namespace + ) + | ( + Self::TypeLike, + Self::Class + | Self::Enum + | Self::EnumMember + | Self::Interface + | Self::TypeAlias + | Self::TypeParameter + ) + ) + } +} +impl std::fmt::Display for Kind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let repr = match self { + Self::Any => "declaration", + Self::CatchParameter => "catch parameter", + Self::Class => "class", + Self::ClassGetter => "class getter", + Self::ClassMember => "class member", + Self::ClassMethod => "class method", + Self::ClassProperty => "class property", + Self::ClassSetter => "class setter", + Self::Const => "const", + Self::Enum => "enum", + Self::EnumMember => "enum member", + Self::ExportAlias => "export alias", + Self::ExportNamespace => "export namespace", + Self::Function => "function", + Self::ImportAlias => "import alias", + Self::ImportNamespace => "import namespace", + Self::IndexParameter => "index parameter", + Self::Interface => "interface", + Self::Let => "let", + Self::Namespace => "namespace", + Self::NamespaceLike => "namespace", + Self::ObjectLiteralGetter => "object getter", + Self::ObjectLiteralMember => "object member", + Self::ObjectLiteralMethod => "object method", + Self::ObjectLiteralProperty => "object property", + Self::ObjectLiteralSetter => "object setter", + Self::FunctionParameter => "function parameter", + Self::TypeAlias => "type alias", + Self::TypeGetter => "getter", + Self::TypeLike => "type", + Self::TypeMember => "type member", + Self::TypeMethod => "method", + Self::TypeParameter => "type parameter", + Self::TypeProperty => "property", + Self::TypeSetter => "setter", + Self::Using => "using", + Self::Var => "var", + Self::Variable => "variable", + }; + write!(f, "{repr}") + } +} + +#[derive( + Debug, + Copy, + Default, + Deserializable, + Clone, + Hash, + Eq, + PartialEq, + serde::Deserialize, + serde::Serialize, +)] +#[serde( + from = "SmallVec<[RestrictedModifier; 4]>", + into = "SmallVec<[RestrictedModifier; 4]>" +)] +pub struct RestrictedModifiers(BitFlags); + +impl Deref for RestrictedModifiers { + type Target = BitFlags; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From for RestrictedModifiers { + fn from(value: RestrictedModifier) -> Self { + RestrictedModifiers(value.into()) + } +} +impl From for SmallVec<[RestrictedModifier; 4]> { + fn from(value: RestrictedModifiers) -> Self { + value.into_iter().collect() + } +} +impl From> for RestrictedModifiers { + fn from(values: SmallVec<[RestrictedModifier; 4]>) -> Self { + Self::from_iter(values) + } +} +impl FromIterator for RestrictedModifiers { + fn from_iter>(values: T) -> Self { + Self(values.into_iter().fold(BitFlags::empty(), |acc, m| acc | m)) + } +} +#[cfg(feature = "schema")] +impl schemars::JsonSchema for RestrictedModifiers { + fn schema_name() -> String { + "Modifiers".to_string() + } + + fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + >::json_schema(generator) + } +} + +impl std::fmt::Display for RestrictedModifiers { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + for value in self.0.iter() { + write!(f, "{value} ")?; + } + Ok(()) + } +} + +#[derive( + Debug, + Copy, + Default, + Deserializable, + Clone, + Hash, + Eq, + PartialEq, + serde::Deserialize, + serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase")] +pub enum Scope { + #[default] + Any, + Global, +} + +impl Scope { + pub fn contains(self, scope: Self) -> bool { + matches!(self, Self::Any) || self == scope + } +} + +/// Supported cases. +#[derive( + Clone, + Copy, + Debug, + Default, + Deserializable, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +pub enum Format { + #[serde(rename = "camelCase")] + Camel, + + #[serde(rename = "CONSTANT_CASE")] + Constant, + + #[serde(rename = "PascalCase")] + #[default] + Pascal, + + #[serde(rename = "snake_case")] + Snake, +} + +impl From for Case { + fn from(value: Format) -> Self { + match value { + Format::Camel => Case::Camel, + Format::Constant => Case::Constant, + Format::Pascal => Case::Pascal, + Format::Snake => Case::Snake, + } + } +} +impl TryFrom for Format { + type Error = &'static str; + + fn try_from(value: Case) -> Result { + match value { + Case::Camel => Ok(Format::Camel), + Case::Constant => Ok(Format::Constant), + Case::Pascal => Ok(Format::Pascal), + Case::Snake => Ok(Format::Snake), + Case::Kebab + | Case::Lower + | Case::Number + | Case::NumberableCapital + | Case::Uni + | Case::Upper + | Case::Unknown => Err("Unsupported case"), + } + } +} + +#[derive( + Clone, + Copy, + Debug, + Default, + Deserializable, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, +)] +#[serde(from = "SmallVec<[Format; 4]>", into = "SmallVec<[Format; 4]>")] +pub struct Formats(Cases); + +impl Deref for Formats { + type Target = Cases; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From for Formats { + fn from(value: Cases) -> Self { + Self(value) + } +} +impl From> for Formats { + fn from(values: SmallVec<[Format; 4]>) -> Self { + Self::from_iter(values) + } +} +impl FromIterator for Formats { + fn from_iter>(values: T) -> Self { + Self(values.into_iter().map(|format| format.into()).collect()) + } +} +impl From for SmallVec<[Format; 4]> { + fn from(value: Formats) -> Self { + value + .0 + .into_iter() + .filter_map(|case| case.try_into().ok()) + .collect() + } +} +#[cfg(feature = "schema")] +impl schemars::JsonSchema for Formats { + fn schema_name() -> String { + "Formats".to_string() + } + fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + >::json_schema(generator) + } +} + +#[derive(Debug, Deserializable, Copy, Clone, serde::Deserialize, serde::Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase")] +#[enumflags2::bitflags] +#[repr(u8)] +pub enum RestrictedModifier { + Abstract = 1 << 0, + Private = 1 << 1, + Protected = 1 << 2, + Readonly = 1 << 3, + Static = 1 << 4, +} +impl RestrictedModifier { + pub const ACCESSIBILITY: BitFlags = BitFlags::::from_bits_truncate_c( + Self::Private as u8 | Self::Protected as u8, + BitFlags::CONST_TOKEN, + ); + pub const CLASS_MEMBER_ONLY: BitFlags = Self::ACCESSIBILITY.union_c( + BitFlags::::from_bits_truncate_c(Self::Static as u8, BitFlags::CONST_TOKEN), + ); + pub const CLASS_TYPE_PROPERTY: BitFlags = + BitFlags::::from_bits_truncate_c(Self::Readonly as u8, BitFlags::CONST_TOKEN); +} +impl std::fmt::Display for RestrictedModifier { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::Abstract => "abstract", + Self::Private => "private", + Self::Protected => "protected", + Self::Readonly => "readonly", + Self::Static => "static", + }) + } +} diff --git a/crates/biome_rule_options/src/use_node_assert_strict.rs b/crates/biome_rule_options/src/use_node_assert_strict.rs new file mode 100644 index 000000000000..981ca776f807 --- /dev/null +++ b/crates/biome_rule_options/src/use_node_assert_strict.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNodeAssertStrictOptions {} diff --git a/crates/biome_rule_options/src/use_nodejs_import_protocol.rs b/crates/biome_rule_options/src/use_nodejs_import_protocol.rs new file mode 100644 index 000000000000..dd0b569d45ea --- /dev/null +++ b/crates/biome_rule_options/src/use_nodejs_import_protocol.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNodejsImportProtocolOptions {} diff --git a/crates/biome_rule_options/src/use_number_namespace.rs b/crates/biome_rule_options/src/use_number_namespace.rs new file mode 100644 index 000000000000..6ec09fa123f6 --- /dev/null +++ b/crates/biome_rule_options/src/use_number_namespace.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNumberNamespaceOptions {} diff --git a/crates/biome_rule_options/src/use_number_to_fixed_digits_argument.rs b/crates/biome_rule_options/src/use_number_to_fixed_digits_argument.rs new file mode 100644 index 000000000000..53c7d8160b03 --- /dev/null +++ b/crates/biome_rule_options/src/use_number_to_fixed_digits_argument.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNumberToFixedDigitsArgumentOptions {} diff --git a/crates/biome_rule_options/src/use_numeric_literals.rs b/crates/biome_rule_options/src/use_numeric_literals.rs new file mode 100644 index 000000000000..002c0cee56ef --- /dev/null +++ b/crates/biome_rule_options/src/use_numeric_literals.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNumericLiteralsOptions {} diff --git a/crates/biome_rule_options/src/use_numeric_separators.rs b/crates/biome_rule_options/src/use_numeric_separators.rs new file mode 100644 index 000000000000..c046d3501c00 --- /dev/null +++ b/crates/biome_rule_options/src/use_numeric_separators.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseNumericSeparatorsOptions {} diff --git a/crates/biome_rule_options/src/use_object_spread.rs b/crates/biome_rule_options/src/use_object_spread.rs new file mode 100644 index 000000000000..4113d68d5bdd --- /dev/null +++ b/crates/biome_rule_options/src/use_object_spread.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseObjectSpreadOptions {} diff --git a/crates/biome_rule_options/src/use_optional_chain.rs b/crates/biome_rule_options/src/use_optional_chain.rs new file mode 100644 index 000000000000..c366cd902826 --- /dev/null +++ b/crates/biome_rule_options/src/use_optional_chain.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseOptionalChainOptions {} diff --git a/crates/biome_rule_options/src/use_parse_int_radix.rs b/crates/biome_rule_options/src/use_parse_int_radix.rs new file mode 100644 index 000000000000..5846854f901a --- /dev/null +++ b/crates/biome_rule_options/src/use_parse_int_radix.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseParseIntRadixOptions {} diff --git a/crates/biome_rule_options/src/use_readonly_class_properties.rs b/crates/biome_rule_options/src/use_readonly_class_properties.rs new file mode 100644 index 000000000000..d54792321149 --- /dev/null +++ b/crates/biome_rule_options/src/use_readonly_class_properties.rs @@ -0,0 +1,14 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseReadonlyClassPropertiesOptions { + /// When `true`, the keywords `public`, `protected`, and `private` are analyzed by the rule. + #[serde(default, skip_serializing_if = "is_default")] + pub check_all_properties: bool, +} + +fn is_default(value: &T) -> bool { + value == &T::default() +} diff --git a/crates/biome_rule_options/src/use_regex_literals.rs b/crates/biome_rule_options/src/use_regex_literals.rs new file mode 100644 index 000000000000..b5b46ca749bb --- /dev/null +++ b/crates/biome_rule_options/src/use_regex_literals.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseRegexLiteralsOptions {} diff --git a/crates/biome_rule_options/src/use_self_closing_elements.rs b/crates/biome_rule_options/src/use_self_closing_elements.rs new file mode 100644 index 000000000000..f40cb68de2f9 --- /dev/null +++ b/crates/biome_rule_options/src/use_self_closing_elements.rs @@ -0,0 +1,9 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSelfClosingElementsOptions { + // Whether or not to ignore checking native HTML elements. Default is false. + pub ignore_html_elements: bool, +} diff --git a/crates/biome_rule_options/src/use_semantic_elements.rs b/crates/biome_rule_options/src/use_semantic_elements.rs new file mode 100644 index 000000000000..f32aa34b651d --- /dev/null +++ b/crates/biome_rule_options/src/use_semantic_elements.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSemanticElementsOptions {} diff --git a/crates/biome_rule_options/src/use_shorthand_array_type.rs b/crates/biome_rule_options/src/use_shorthand_array_type.rs new file mode 100644 index 000000000000..3fd5feeca367 --- /dev/null +++ b/crates/biome_rule_options/src/use_shorthand_array_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseShorthandArrayTypeOptions {} diff --git a/crates/biome_rule_options/src/use_shorthand_assign.rs b/crates/biome_rule_options/src/use_shorthand_assign.rs new file mode 100644 index 000000000000..191d77d9ef97 --- /dev/null +++ b/crates/biome_rule_options/src/use_shorthand_assign.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseShorthandAssignOptions {} diff --git a/crates/biome_rule_options/src/use_shorthand_function_type.rs b/crates/biome_rule_options/src/use_shorthand_function_type.rs new file mode 100644 index 000000000000..2c6f33a3d09b --- /dev/null +++ b/crates/biome_rule_options/src/use_shorthand_function_type.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseShorthandFunctionTypeOptions {} diff --git a/crates/biome_rule_options/src/use_simple_number_keys.rs b/crates/biome_rule_options/src/use_simple_number_keys.rs new file mode 100644 index 000000000000..97317569353f --- /dev/null +++ b/crates/biome_rule_options/src/use_simple_number_keys.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSimpleNumberKeysOptions {} diff --git a/crates/biome_rule_options/src/use_simplified_logic_expression.rs b/crates/biome_rule_options/src/use_simplified_logic_expression.rs new file mode 100644 index 000000000000..44e63f01b5da --- /dev/null +++ b/crates/biome_rule_options/src/use_simplified_logic_expression.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSimplifiedLogicExpressionOptions {} diff --git a/crates/biome_rule_options/src/use_single_case_statement.rs b/crates/biome_rule_options/src/use_single_case_statement.rs new file mode 100644 index 000000000000..ca345b468d85 --- /dev/null +++ b/crates/biome_rule_options/src/use_single_case_statement.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSingleCaseStatementOptions {} diff --git a/crates/biome_rule_options/src/use_single_js_doc_asterisk.rs b/crates/biome_rule_options/src/use_single_js_doc_asterisk.rs new file mode 100644 index 000000000000..d2be05bd6d6b --- /dev/null +++ b/crates/biome_rule_options/src/use_single_js_doc_asterisk.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSingleJsDocAsteriskOptions {} diff --git a/crates/biome_rule_options/src/use_single_var_declarator.rs b/crates/biome_rule_options/src/use_single_var_declarator.rs new file mode 100644 index 000000000000..9f1172aef9a0 --- /dev/null +++ b/crates/biome_rule_options/src/use_single_var_declarator.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSingleVarDeclaratorOptions {} diff --git a/crates/biome_rule_options/src/use_sorted_attributes.rs b/crates/biome_rule_options/src/use_sorted_attributes.rs new file mode 100644 index 000000000000..fee965f6015a --- /dev/null +++ b/crates/biome_rule_options/src/use_sorted_attributes.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSortedAttributesOptions {} diff --git a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/options.rs b/crates/biome_rule_options/src/use_sorted_classes.rs similarity index 82% rename from crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/options.rs rename to crates/biome_rule_options/src/use_sorted_classes.rs index 72057b12096c..4683cb5e6d1b 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/options.rs +++ b/crates/biome_rule_options/src/use_sorted_classes.rs @@ -1,19 +1,14 @@ use biome_deserialize::{ Deserializable, DeserializableTypes, DeserializableValue, DeserializationContext, - DeserializationDiagnostic, DeserializationVisitor, Text, + DeserializationDiagnostic, DeserializationVisitor, TextRange, }; -use biome_rowan::TextRange; -#[cfg(feature = "schemars")] -use schemars::JsonSchema; +use biome_rowan::Text; use serde::{Deserialize, Serialize}; -/// Attributes that are always targets. -const CLASS_ATTRIBUTES: [&str; 2] = ["class", "className"]; - -#[derive(Default, Deserialize, Serialize, Eq, PartialEq, Debug, Clone)] -#[cfg_attr(feature = "schemars", derive(JsonSchema))] +#[derive(Default, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields, default)] -pub struct UtilityClassSortingOptions { +pub struct UseSortedClassesOptions { /// Additional attributes that will be sorted. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option]>>, @@ -22,8 +17,8 @@ pub struct UtilityClassSortingOptions { pub functions: Option>>, } -impl UtilityClassSortingOptions { - pub(crate) fn has_function(&self, name: &str) -> bool { +impl UseSortedClassesOptions { + pub fn has_function(&self, name: &str) -> bool { let iter = self.functions.iter().flatten(); for v in iter { if v.as_ref() == name { @@ -33,7 +28,7 @@ impl UtilityClassSortingOptions { false } - pub(crate) fn match_function(&self, name: &str) -> bool { + pub fn match_function(&self, name: &str) -> bool { self.functions.iter().flatten().any(|matcher| { let mut matcher_parts = matcher.split('.'); let mut name_parts = name.split('.'); @@ -47,15 +42,18 @@ impl UtilityClassSortingOptions { }) } - pub(crate) fn has_attribute(&self, name: &str) -> bool { + pub fn has_attribute(&self, name: &str) -> bool { CLASS_ATTRIBUTES.contains(&name) || self.attributes.iter().flatten().any(|v| v.as_ref() == name) } } +/// Attributes that are always targets. +const CLASS_ATTRIBUTES: [&str; 2] = ["class", "className"]; + const ALLOWED_OPTIONS: &[&str] = &["attributes", "functions"]; -impl Deserializable for UtilityClassSortingOptions { +impl Deserializable for UseSortedClassesOptions { fn deserialize( ctx: &mut impl DeserializationContext, value: &impl DeserializableValue, @@ -67,7 +65,7 @@ impl Deserializable for UtilityClassSortingOptions { struct UtilityClassSortingOptionsVisitor; impl DeserializationVisitor for UtilityClassSortingOptionsVisitor { - type Output = UtilityClassSortingOptions; + type Output = UseSortedClassesOptions; const EXPECTED_TYPE: DeserializableTypes = DeserializableTypes::MAP; @@ -78,7 +76,7 @@ impl DeserializationVisitor for UtilityClassSortingOptionsVisitor { _range: TextRange, _name: &str, ) -> Option { - let mut result = UtilityClassSortingOptions::default(); + let mut result = UseSortedClassesOptions::default(); let mut attributes = Vec::new(); for (key, value) in members.flatten() { diff --git a/crates/biome_rule_options/src/use_sorted_keys.rs b/crates/biome_rule_options/src/use_sorted_keys.rs new file mode 100644 index 000000000000..97aedbd23e26 --- /dev/null +++ b/crates/biome_rule_options/src/use_sorted_keys.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSortedKeysOptions {} diff --git a/crates/biome_rule_options/src/use_sorted_properties.rs b/crates/biome_rule_options/src/use_sorted_properties.rs new file mode 100644 index 000000000000..e589ca9285d6 --- /dev/null +++ b/crates/biome_rule_options/src/use_sorted_properties.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSortedPropertiesOptions {} diff --git a/crates/biome_rule_options/src/use_strict_mode.rs b/crates/biome_rule_options/src/use_strict_mode.rs new file mode 100644 index 000000000000..0457ab4c57c9 --- /dev/null +++ b/crates/biome_rule_options/src/use_strict_mode.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseStrictModeOptions {} diff --git a/crates/biome_rule_options/src/use_symbol_description.rs b/crates/biome_rule_options/src/use_symbol_description.rs new file mode 100644 index 000000000000..42442b060f53 --- /dev/null +++ b/crates/biome_rule_options/src/use_symbol_description.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseSymbolDescriptionOptions {} diff --git a/crates/biome_rule_options/src/use_template.rs b/crates/biome_rule_options/src/use_template.rs new file mode 100644 index 000000000000..3d1aee60a59d --- /dev/null +++ b/crates/biome_rule_options/src/use_template.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseTemplateOptions {} diff --git a/crates/biome_rule_options/src/use_throw_new_error.rs b/crates/biome_rule_options/src/use_throw_new_error.rs new file mode 100644 index 000000000000..d370c96cb791 --- /dev/null +++ b/crates/biome_rule_options/src/use_throw_new_error.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseThrowNewErrorOptions {} diff --git a/crates/biome_rule_options/src/use_throw_only_error.rs b/crates/biome_rule_options/src/use_throw_only_error.rs new file mode 100644 index 000000000000..b2cbccd497a8 --- /dev/null +++ b/crates/biome_rule_options/src/use_throw_only_error.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseThrowOnlyErrorOptions {} diff --git a/crates/biome_rule_options/src/use_top_level_regex.rs b/crates/biome_rule_options/src/use_top_level_regex.rs new file mode 100644 index 000000000000..bd6c407ca7fd --- /dev/null +++ b/crates/biome_rule_options/src/use_top_level_regex.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseTopLevelRegexOptions {} diff --git a/crates/biome_rule_options/src/use_trim_start_end.rs b/crates/biome_rule_options/src/use_trim_start_end.rs new file mode 100644 index 000000000000..2b300ddce8b9 --- /dev/null +++ b/crates/biome_rule_options/src/use_trim_start_end.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseTrimStartEndOptions {} diff --git a/crates/biome_rule_options/src/use_unified_type_signature.rs b/crates/biome_rule_options/src/use_unified_type_signature.rs new file mode 100644 index 000000000000..33b3668754c0 --- /dev/null +++ b/crates/biome_rule_options/src/use_unified_type_signature.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseUnifiedTypeSignatureOptions {} diff --git a/crates/biome_rule_options/src/use_unique_element_ids.rs b/crates/biome_rule_options/src/use_unique_element_ids.rs new file mode 100644 index 000000000000..7445c1fc086a --- /dev/null +++ b/crates/biome_rule_options/src/use_unique_element_ids.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseUniqueElementIdsOptions {} diff --git a/crates/biome_rule_options/src/use_valid_anchor.rs b/crates/biome_rule_options/src/use_valid_anchor.rs new file mode 100644 index 000000000000..0ffa52f30fae --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_anchor.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidAnchorOptions {} diff --git a/crates/biome_rule_options/src/use_valid_aria_props.rs b/crates/biome_rule_options/src/use_valid_aria_props.rs new file mode 100644 index 000000000000..0b91744cf67c --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_aria_props.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidAriaPropsOptions {} diff --git a/crates/biome_rule_options/src/use_valid_aria_role.rs b/crates/biome_rule_options/src/use_valid_aria_role.rs new file mode 100644 index 000000000000..d497acdd2a40 --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_aria_role.rs @@ -0,0 +1,11 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidAriaRoleOptions { + /// It allows specifying a list of roles that might be invalid otherwise + pub allow_invalid_roles: Box<[Box]>, + /// Use this option to ignore non-DOM elements, such as custom components + pub ignore_non_dom: bool, +} diff --git a/crates/biome_rule_options/src/use_valid_aria_values.rs b/crates/biome_rule_options/src/use_valid_aria_values.rs new file mode 100644 index 000000000000..b36f696cb16f --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_aria_values.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidAriaValuesOptions {} diff --git a/crates/biome_rule_options/src/use_valid_autocomplete.rs b/crates/biome_rule_options/src/use_valid_autocomplete.rs new file mode 100644 index 000000000000..9f341154a05e --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_autocomplete.rs @@ -0,0 +1,9 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidAutocompleteOptions { + /// `input` like custom components that should be checked. + pub input_components: Box<[Box]>, +} diff --git a/crates/biome_rule_options/src/use_valid_for_direction.rs b/crates/biome_rule_options/src/use_valid_for_direction.rs new file mode 100644 index 000000000000..27ef03e8adc1 --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_for_direction.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidForDirectionOptions {} diff --git a/crates/biome_rule_options/src/use_valid_lang.rs b/crates/biome_rule_options/src/use_valid_lang.rs new file mode 100644 index 000000000000..bae8343a52dd --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_lang.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidLangOptions {} diff --git a/crates/biome_rule_options/src/use_valid_typeof.rs b/crates/biome_rule_options/src/use_valid_typeof.rs new file mode 100644 index 000000000000..6a26a70ea704 --- /dev/null +++ b/crates/biome_rule_options/src/use_valid_typeof.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseValidTypeofOptions {} diff --git a/crates/biome_rule_options/src/use_while.rs b/crates/biome_rule_options/src/use_while.rs new file mode 100644 index 000000000000..f67ed3041bdf --- /dev/null +++ b/crates/biome_rule_options/src/use_while.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseWhileOptions {} diff --git a/crates/biome_rule_options/src/use_yield.rs b/crates/biome_rule_options/src/use_yield.rs new file mode 100644 index 000000000000..8b05c98bc105 --- /dev/null +++ b/crates/biome_rule_options/src/use_yield.rs @@ -0,0 +1,6 @@ +use biome_deserialize_macros::Deserializable; +use serde::{Deserialize, Serialize}; +#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, default)] +pub struct UseYieldOptions {} diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts index 821da5207213..178197287938 100644 --- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts +++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts @@ -835,7 +835,7 @@ export interface Source { /** * Provides a code action to sort the imports and exports in the file using a built-in or custom order. */ - organizeImports?: RuleAssistConfiguration_for_Options; + organizeImports?: RuleAssistConfiguration_for_OrganizeImportsOptions; /** * It enables the recommended rules for this group */ @@ -843,15 +843,15 @@ export interface Source { /** * Enforce attribute sorting in JSX elements. */ - useSortedAttributes?: RuleAssistConfiguration_for_Null; + useSortedAttributes?: RuleAssistConfiguration_for_UseSortedAttributesOptions; /** * Sorts the keys of a JSON object in natural order */ - useSortedKeys?: RuleAssistConfiguration_for_Null; + useSortedKeys?: RuleAssistConfiguration_for_UseSortedKeysOptions; /** * Enforce ordering of CSS properties and nested rules. */ - useSortedProperties?: RuleAssistConfiguration_for_Null; + useSortedProperties?: RuleAssistConfiguration_for_UseSortedPropertiesOptions; } export type Glob = string; export type QuoteStyle = "double" | "single"; @@ -988,12 +988,18 @@ export interface OverrideLinterConfiguration { */ rules?: Rules; } -export type RuleAssistConfiguration_for_Options = +export type RuleAssistConfiguration_for_OrganizeImportsOptions = | RuleAssistPlainConfiguration - | RuleAssistWithOptions_for_Options; -export type RuleAssistConfiguration_for_Null = + | RuleAssistWithOptions_for_OrganizeImportsOptions; +export type RuleAssistConfiguration_for_UseSortedAttributesOptions = | RuleAssistPlainConfiguration - | RuleAssistWithOptions_for_Null; + | RuleAssistWithOptions_for_UseSortedAttributesOptions; +export type RuleAssistConfiguration_for_UseSortedKeysOptions = + | RuleAssistPlainConfiguration + | RuleAssistWithOptions_for_UseSortedKeysOptions; +export type RuleAssistConfiguration_for_UseSortedPropertiesOptions = + | RuleAssistPlainConfiguration + | RuleAssistWithOptions_for_UseSortedPropertiesOptions; export type GroupPlainConfiguration = "off" | "on" | "info" | "warn" | "error"; /** * A list of rules that belong to this group @@ -1002,31 +1008,31 @@ export interface A11y { /** * Enforce that the accessKey attribute is not used on any HTML element. */ - noAccessKey?: RuleFixConfiguration_for_Null; + noAccessKey?: RuleFixConfiguration_for_NoAccessKeyOptions; /** * Enforce that aria-hidden="true" is not set on focusable elements. */ - noAriaHiddenOnFocusable?: RuleFixConfiguration_for_Null; + noAriaHiddenOnFocusable?: RuleFixConfiguration_for_NoAriaHiddenOnFocusableOptions; /** * Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. */ - noAriaUnsupportedElements?: RuleFixConfiguration_for_Null; + noAriaUnsupportedElements?: RuleFixConfiguration_for_NoAriaUnsupportedElementsOptions; /** * Enforce that autoFocus prop is not used on elements. */ - noAutofocus?: RuleFixConfiguration_for_Null; + noAutofocus?: RuleFixConfiguration_for_NoAutofocusOptions; /** * Enforces that no distracting elements are used. */ - noDistractingElements?: RuleFixConfiguration_for_Null; + noDistractingElements?: RuleFixConfiguration_for_NoDistractingElementsOptions; /** * The scope prop should be used only on \ elements. */ - noHeaderScope?: RuleFixConfiguration_for_Null; + noHeaderScope?: RuleFixConfiguration_for_NoHeaderScopeOptions; /** * Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements. */ - noInteractiveElementToNoninteractiveRole?: RuleFixConfiguration_for_Null; + noInteractiveElementToNoninteractiveRole?: RuleFixConfiguration_for_NoInteractiveElementToNoninteractiveRoleOptions; /** * Enforce that a label element or component has a text label and an associated input. */ @@ -1034,31 +1040,31 @@ export interface A11y { /** * Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements. */ - noNoninteractiveElementToInteractiveRole?: RuleFixConfiguration_for_Null; + noNoninteractiveElementToInteractiveRole?: RuleFixConfiguration_for_NoNoninteractiveElementToInteractiveRoleOptions; /** * Enforce that tabIndex is not assigned to non-interactive HTML elements. */ - noNoninteractiveTabindex?: RuleFixConfiguration_for_Null; + noNoninteractiveTabindex?: RuleFixConfiguration_for_NoNoninteractiveTabindexOptions; /** * Prevent the usage of positive integers on tabIndex property */ - noPositiveTabindex?: RuleFixConfiguration_for_Null; + noPositiveTabindex?: RuleFixConfiguration_for_NoPositiveTabindexOptions; /** * Enforce img alt prop does not contain the word "image", "picture", or "photo". */ - noRedundantAlt?: RuleConfiguration_for_Null; + noRedundantAlt?: RuleConfiguration_for_NoRedundantAltOptions; /** * Enforce explicit role property is not the same as implicit/default role property on an element. */ - noRedundantRoles?: RuleFixConfiguration_for_Null; + noRedundantRoles?: RuleFixConfiguration_for_NoRedundantRolesOptions; /** * Enforce that static, visible elements (such as \
) that have click handlers use the valid role attribute. */ - noStaticElementInteractions?: RuleConfiguration_for_Null; + noStaticElementInteractions?: RuleConfiguration_for_NoStaticElementInteractionsOptions; /** * Enforces the usage of the title element for the svg element. */ - noSvgWithoutTitle?: RuleConfiguration_for_Null; + noSvgWithoutTitle?: RuleConfiguration_for_NoSvgWithoutTitleOptions; /** * It enables the recommended rules for this group */ @@ -1066,79 +1072,79 @@ export interface A11y { /** * Enforce that all elements that require alternative text have meaningful information to relay back to the end user. */ - useAltText?: RuleConfiguration_for_Null; + useAltText?: RuleConfiguration_for_UseAltTextOptions; /** * Enforce that anchors have content and that the content is accessible to screen readers. */ - useAnchorContent?: RuleFixConfiguration_for_Null; + useAnchorContent?: RuleFixConfiguration_for_UseAnchorContentOptions; /** * Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant. */ - useAriaActivedescendantWithTabindex?: RuleFixConfiguration_for_Null; + useAriaActivedescendantWithTabindex?: RuleFixConfiguration_for_UseAriaActivedescendantWithTabindexOptions; /** * Enforce that elements with ARIA roles must have all required ARIA attributes for that role. */ - useAriaPropsForRole?: RuleConfiguration_for_Null; + useAriaPropsForRole?: RuleConfiguration_for_UseAriaPropsForRoleOptions; /** * Enforce that ARIA properties are valid for the roles that are supported by the element. */ - useAriaPropsSupportedByRole?: RuleConfiguration_for_Null; + useAriaPropsSupportedByRole?: RuleConfiguration_for_UseAriaPropsSupportedByRoleOptions; /** * Enforces the usage of the attribute type for the element button */ - useButtonType?: RuleConfiguration_for_Null; + useButtonType?: RuleConfiguration_for_UseButtonTypeOptions; /** * Elements with an interactive role and interaction handlers must be focusable. */ - useFocusableInteractive?: RuleConfiguration_for_Null; + useFocusableInteractive?: RuleConfiguration_for_UseFocusableInteractiveOptions; /** * Disallow a missing generic family keyword within font families. */ - useGenericFontNames?: RuleConfiguration_for_Null; + useGenericFontNames?: RuleConfiguration_for_UseGenericFontNamesOptions; /** * 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_for_Null; + useHeadingContent?: RuleConfiguration_for_UseHeadingContentOptions; /** * Enforce that html element has lang attribute. */ - useHtmlLang?: RuleConfiguration_for_Null; + useHtmlLang?: RuleConfiguration_for_UseHtmlLangOptions; /** * Enforces the usage of the attribute title for the element iframe. */ - useIframeTitle?: RuleConfiguration_for_Null; + useIframeTitle?: RuleConfiguration_for_UseIframeTitleOptions; /** * Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress. */ - useKeyWithClickEvents?: RuleConfiguration_for_Null; + useKeyWithClickEvents?: RuleConfiguration_for_UseKeyWithClickEventsOptions; /** * Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur. */ - useKeyWithMouseEvents?: RuleConfiguration_for_Null; + useKeyWithMouseEvents?: RuleConfiguration_for_UseKeyWithMouseEventsOptions; /** * Enforces that audio and video elements must have a track for captions. */ - useMediaCaption?: RuleConfiguration_for_Null; + useMediaCaption?: RuleConfiguration_for_UseMediaCaptionOptions; /** * It detects the use of role attributes in JSX elements and suggests using semantic elements instead. */ - useSemanticElements?: RuleConfiguration_for_Null; + useSemanticElements?: RuleConfiguration_for_UseSemanticElementsOptions; /** * Enforce that all anchors are valid, and they are navigable elements. */ - useValidAnchor?: RuleConfiguration_for_Null; + useValidAnchor?: RuleConfiguration_for_UseValidAnchorOptions; /** * Ensures that ARIA properties aria-* are all valid. */ - useValidAriaProps?: RuleFixConfiguration_for_Null; + useValidAriaProps?: RuleFixConfiguration_for_UseValidAriaPropsOptions; /** * Elements with ARIA roles must use a valid, non-abstract ARIA role. */ - useValidAriaRole?: RuleFixConfiguration_for_ValidAriaRoleOptions; + useValidAriaRole?: RuleFixConfiguration_for_UseValidAriaRoleOptions; /** * Enforce that ARIA state and property values are valid. */ - useValidAriaValues?: RuleConfiguration_for_Null; + useValidAriaValues?: RuleConfiguration_for_UseValidAriaValuesOptions; /** * Use valid values for the autocomplete attribute on input elements. */ @@ -1146,7 +1152,7 @@ export interface A11y { /** * Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country. */ - useValidLang?: RuleConfiguration_for_Null; + useValidLang?: RuleConfiguration_for_UseValidLangOptions; } /** * A list of rules that belong to this group @@ -1155,39 +1161,39 @@ export interface Complexity { /** * Disallow unclear usage of consecutive space characters in regular expression literals */ - noAdjacentSpacesInRegex?: RuleFixConfiguration_for_Null; + noAdjacentSpacesInRegex?: RuleFixConfiguration_for_NoAdjacentSpacesInRegexOptions; /** * Disallow the use of arguments. */ - noArguments?: RuleConfiguration_for_Null; + noArguments?: RuleConfiguration_for_NoArgumentsOptions; /** * Disallow primitive type aliases and misleading types. */ - noBannedTypes?: RuleFixConfiguration_for_Null; + noBannedTypes?: RuleFixConfiguration_for_NoBannedTypesOptions; /** * Disallow comma operator. */ - noCommaOperator?: RuleConfiguration_for_Null; + noCommaOperator?: RuleConfiguration_for_NoCommaOperatorOptions; /** * Disallow empty type parameters in type aliases and interfaces. */ - noEmptyTypeParameters?: RuleConfiguration_for_Null; + noEmptyTypeParameters?: RuleConfiguration_for_NoEmptyTypeParametersOptions; /** * Disallow functions that exceed a given Cognitive Complexity score. */ - noExcessiveCognitiveComplexity?: RuleConfiguration_for_ComplexityOptions; + noExcessiveCognitiveComplexity?: RuleConfiguration_for_NoExcessiveCognitiveComplexityOptions; /** * This rule enforces a maximum depth to nested describe() in test files. */ - noExcessiveNestedTestSuites?: RuleConfiguration_for_Null; + noExcessiveNestedTestSuites?: RuleConfiguration_for_NoExcessiveNestedTestSuitesOptions; /** * Disallow unnecessary boolean casts */ - noExtraBooleanCast?: RuleFixConfiguration_for_Null; + noExtraBooleanCast?: RuleFixConfiguration_for_NoExtraBooleanCastOptions; /** * Disallow to use unnecessary callback on flatMap. */ - noFlatMapIdentity?: RuleFixConfiguration_for_Null; + noFlatMapIdentity?: RuleFixConfiguration_for_NoFlatMapIdentityOptions; /** * Prefer for...of statement instead of Array.forEach. */ @@ -1195,79 +1201,79 @@ export interface Complexity { /** * This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace. */ - noStaticOnlyClass?: RuleConfiguration_for_Null; + noStaticOnlyClass?: RuleConfiguration_for_NoStaticOnlyClassOptions; /** * Disallow this and super in static contexts. */ - noThisInStatic?: RuleFixConfiguration_for_Null; + noThisInStatic?: RuleFixConfiguration_for_NoThisInStaticOptions; /** * Disallow unnecessary catch clauses. */ - noUselessCatch?: RuleFixConfiguration_for_Null; + noUselessCatch?: RuleFixConfiguration_for_NoUselessCatchOptions; /** * Disallow unnecessary constructors. */ - noUselessConstructor?: RuleFixConfiguration_for_Null; + noUselessConstructor?: RuleFixConfiguration_for_NoUselessConstructorOptions; /** * Avoid using unnecessary continue. */ - noUselessContinue?: RuleFixConfiguration_for_Null; + noUselessContinue?: RuleFixConfiguration_for_NoUselessContinueOptions; /** * Disallow empty exports that don't change anything in a module file. */ - noUselessEmptyExport?: RuleFixConfiguration_for_Null; + noUselessEmptyExport?: RuleFixConfiguration_for_NoUselessEmptyExportOptions; /** * Disallow unnecessary escape sequence in regular expression literals. */ - noUselessEscapeInRegex?: RuleFixConfiguration_for_Null; + noUselessEscapeInRegex?: RuleFixConfiguration_for_NoUselessEscapeInRegexOptions; /** * Disallow unnecessary fragments */ - noUselessFragments?: RuleFixConfiguration_for_Null; + noUselessFragments?: RuleFixConfiguration_for_NoUselessFragmentsOptions; /** * Disallow unnecessary labels. */ - noUselessLabel?: RuleFixConfiguration_for_Null; + noUselessLabel?: RuleFixConfiguration_for_NoUselessLabelOptions; /** * Disallow unnecessary nested block statements. */ - noUselessLoneBlockStatements?: RuleFixConfiguration_for_Null; + noUselessLoneBlockStatements?: RuleFixConfiguration_for_NoUselessLoneBlockStatementsOptions; /** * Disallow renaming import, export, and destructured assignments to the same name. */ - noUselessRename?: RuleFixConfiguration_for_Null; + noUselessRename?: RuleFixConfiguration_for_NoUselessRenameOptions; /** * Disallow unnecessary concatenation of string or template literals. */ - noUselessStringConcat?: RuleFixConfiguration_for_Null; + noUselessStringConcat?: RuleFixConfiguration_for_NoUselessStringConcatOptions; /** * Disallow unnecessary String.raw function in template string literals without any escape sequence. */ - noUselessStringRaw?: RuleConfiguration_for_Null; + noUselessStringRaw?: RuleConfiguration_for_NoUselessStringRawOptions; /** * Disallow useless case in switch statements. */ - noUselessSwitchCase?: RuleFixConfiguration_for_Null; + noUselessSwitchCase?: RuleFixConfiguration_for_NoUselessSwitchCaseOptions; /** * Disallow ternary operators when simpler alternatives exist. */ - noUselessTernary?: RuleFixConfiguration_for_Null; + noUselessTernary?: RuleFixConfiguration_for_NoUselessTernaryOptions; /** * Disallow useless this aliasing. */ - noUselessThisAlias?: RuleFixConfiguration_for_Null; + noUselessThisAlias?: RuleFixConfiguration_for_NoUselessThisAliasOptions; /** * Disallow using any or unknown as type constraint. */ - noUselessTypeConstraint?: RuleFixConfiguration_for_Null; + noUselessTypeConstraint?: RuleFixConfiguration_for_NoUselessTypeConstraintOptions; /** * Disallow initializing variables to undefined. */ - noUselessUndefinedInitialization?: RuleFixConfiguration_for_Null; + noUselessUndefinedInitialization?: RuleFixConfiguration_for_NoUselessUndefinedInitializationOptions; /** * Disallow the use of void operators, which is not a familiar operator. */ - noVoid?: RuleConfiguration_for_Null; + noVoid?: RuleConfiguration_for_NoVoidOptions; /** * It enables the recommended rules for this group */ @@ -1275,43 +1281,43 @@ export interface Complexity { /** * Use arrow functions over function expressions. */ - useArrowFunction?: RuleFixConfiguration_for_Null; + useArrowFunction?: RuleFixConfiguration_for_UseArrowFunctionOptions; /** * Use Date.now() to get the number of milliseconds since the Unix Epoch. */ - useDateNow?: RuleFixConfiguration_for_Null; + useDateNow?: RuleFixConfiguration_for_UseDateNowOptions; /** * Promotes the use of .flatMap() when map().flat() are used together. */ - useFlatMap?: RuleFixConfiguration_for_Null; + useFlatMap?: RuleFixConfiguration_for_UseFlatMapOptions; /** * Enforce the usage of a literal access to properties over computed property access. */ - useLiteralKeys?: RuleFixConfiguration_for_Null; + useLiteralKeys?: RuleFixConfiguration_for_UseLiteralKeysOptions; /** * Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals */ - useNumericLiterals?: RuleFixConfiguration_for_Null; + useNumericLiterals?: RuleFixConfiguration_for_UseNumericLiteralsOptions; /** * Enforce using concise optional chain instead of chained logical expressions. */ - useOptionalChain?: RuleFixConfiguration_for_Null; + useOptionalChain?: RuleFixConfiguration_for_UseOptionalChainOptions; /** * Enforce the use of the regular expression literals instead of the RegExp constructor if possible. */ - useRegexLiterals?: RuleFixConfiguration_for_Null; + useRegexLiterals?: RuleFixConfiguration_for_UseRegexLiteralsOptions; /** * Disallow number literal object member names which are not base 10 or use underscore as separator. */ - useSimpleNumberKeys?: RuleFixConfiguration_for_Null; + useSimpleNumberKeys?: RuleFixConfiguration_for_UseSimpleNumberKeysOptions; /** * Discard redundant terms from logical expressions. */ - useSimplifiedLogicExpression?: RuleFixConfiguration_for_Null; + useSimplifiedLogicExpression?: RuleFixConfiguration_for_UseSimplifiedLogicExpressionOptions; /** * Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed. */ - useWhile?: RuleFixConfiguration_for_Null; + useWhile?: RuleFixConfiguration_for_UseWhileOptions; } /** * A list of rules that belong to this group @@ -1320,79 +1326,79 @@ export interface Correctness { /** * Prevent passing of children as props. */ - noChildrenProp?: RuleConfiguration_for_Null; + noChildrenProp?: RuleConfiguration_for_NoChildrenPropOptions; /** * Prevents from having const variables being re-assigned. */ - noConstAssign?: RuleFixConfiguration_for_Null; + noConstAssign?: RuleFixConfiguration_for_NoConstAssignOptions; /** * Disallow constant expressions in conditions */ - noConstantCondition?: RuleConfiguration_for_Null; + noConstantCondition?: RuleConfiguration_for_NoConstantConditionOptions; /** * Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant. */ - noConstantMathMinMaxClamp?: RuleFixConfiguration_for_Null; + noConstantMathMinMaxClamp?: RuleFixConfiguration_for_NoConstantMathMinMaxClampOptions; /** * Disallow returning a value from a constructor. */ - noConstructorReturn?: RuleConfiguration_for_Null; + noConstructorReturn?: RuleConfiguration_for_NoConstructorReturnOptions; /** * Disallow empty character classes in regular expression literals. */ - noEmptyCharacterClassInRegex?: RuleConfiguration_for_Null; + noEmptyCharacterClassInRegex?: RuleConfiguration_for_NoEmptyCharacterClassInRegexOptions; /** * Disallows empty destructuring patterns. */ - noEmptyPattern?: RuleConfiguration_for_Null; + noEmptyPattern?: RuleConfiguration_for_NoEmptyPatternOptions; /** * Disallow calling global object properties as functions */ - noGlobalObjectCalls?: RuleConfiguration_for_Null; + noGlobalObjectCalls?: RuleConfiguration_for_NoGlobalObjectCallsOptions; /** * Disallow function and var declarations that are accessible outside their block. */ - noInnerDeclarations?: RuleConfiguration_for_Null; + noInnerDeclarations?: RuleConfiguration_for_NoInnerDeclarationsOptions; /** * Ensure that builtins are correctly instantiated. */ - noInvalidBuiltinInstantiation?: RuleFixConfiguration_for_Null; + noInvalidBuiltinInstantiation?: RuleFixConfiguration_for_NoInvalidBuiltinInstantiationOptions; /** * 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_for_Null; + noInvalidConstructorSuper?: RuleConfiguration_for_NoInvalidConstructorSuperOptions; /** * Disallow non-standard direction values for linear gradient functions. */ - noInvalidDirectionInLinearGradient?: RuleConfiguration_for_Null; + noInvalidDirectionInLinearGradient?: RuleConfiguration_for_NoInvalidDirectionInLinearGradientOptions; /** * Disallows invalid named grid areas in CSS Grid Layouts. */ - noInvalidGridAreas?: RuleConfiguration_for_Null; + noInvalidGridAreas?: RuleConfiguration_for_NoInvalidGridAreasOptions; /** * Disallow the use of @import at-rules in invalid positions. */ - noInvalidPositionAtImportRule?: RuleConfiguration_for_Null; + noInvalidPositionAtImportRule?: RuleConfiguration_for_NoInvalidPositionAtImportRuleOptions; /** * Disallow the use of variables and function parameters before their declaration */ - noInvalidUseBeforeDeclaration?: RuleConfiguration_for_Null; + noInvalidUseBeforeDeclaration?: RuleConfiguration_for_NoInvalidUseBeforeDeclarationOptions; /** * Disallow missing var function for css variables. */ - noMissingVarFunction?: RuleConfiguration_for_Null; + noMissingVarFunction?: RuleConfiguration_for_NoMissingVarFunctionOptions; /** * Forbid the use of Node.js builtin modules. */ - noNodejsModules?: RuleConfiguration_for_Null; + noNodejsModules?: RuleConfiguration_for_NoNodejsModulesOptions; /** * Disallow \8 and \9 escape sequences in string literals. */ - noNonoctalDecimalEscape?: RuleFixConfiguration_for_Null; + noNonoctalDecimalEscape?: RuleFixConfiguration_for_NoNonoctalDecimalEscapeOptions; /** * Disallow literal numbers that lose precision */ - noPrecisionLoss?: RuleConfiguration_for_Null; + noPrecisionLoss?: RuleConfiguration_for_NoPrecisionLossOptions; /** * Restrict imports of private exports. */ @@ -1400,23 +1406,23 @@ export interface Correctness { /** * Prevent the usage of the return value of React.render. */ - noRenderReturnValue?: RuleConfiguration_for_Null; + noRenderReturnValue?: RuleConfiguration_for_NoRenderReturnValueOptions; /** * Disallow assignments where both sides are exactly the same. */ - noSelfAssign?: RuleConfiguration_for_Null; + noSelfAssign?: RuleConfiguration_for_NoSelfAssignOptions; /** * Disallow returning a value from a setter */ - noSetterReturn?: RuleConfiguration_for_Null; + noSetterReturn?: RuleConfiguration_for_NoSetterReturnOptions; /** * Disallow comparison of expressions modifying the string case with non-compliant value. */ - noStringCaseMismatch?: RuleFixConfiguration_for_Null; + noStringCaseMismatch?: RuleFixConfiguration_for_NoStringCaseMismatchOptions; /** * Disallow lexical declarations in switch clauses. */ - noSwitchDeclarations?: RuleFixConfiguration_for_Null; + noSwitchDeclarations?: RuleFixConfiguration_for_NoSwitchDeclarationsOptions; /** * Disallow the use of dependencies that aren't specified in the package.json. */ @@ -1424,71 +1430,71 @@ export interface Correctness { /** * Prevents the usage of variables that haven't been declared inside the document. */ - noUndeclaredVariables?: RuleConfiguration_for_UndeclaredVariablesOptions; + noUndeclaredVariables?: RuleConfiguration_for_NoUndeclaredVariablesOptions; /** * Disallow unknown CSS value functions. */ - noUnknownFunction?: RuleConfiguration_for_Null; + noUnknownFunction?: RuleConfiguration_for_NoUnknownFunctionOptions; /** * Disallow unknown media feature names. */ - noUnknownMediaFeatureName?: RuleConfiguration_for_Null; + noUnknownMediaFeatureName?: RuleConfiguration_for_NoUnknownMediaFeatureNameOptions; /** * Disallow unknown properties. */ - noUnknownProperty?: RuleConfiguration_for_Null; + noUnknownProperty?: RuleConfiguration_for_NoUnknownPropertyOptions; /** * Disallow unknown pseudo-class selectors. */ - noUnknownPseudoClass?: RuleConfiguration_for_Null; + noUnknownPseudoClass?: RuleConfiguration_for_NoUnknownPseudoClassOptions; /** * Disallow unknown pseudo-element selectors. */ - noUnknownPseudoElement?: RuleConfiguration_for_Null; + noUnknownPseudoElement?: RuleConfiguration_for_NoUnknownPseudoElementOptions; /** * Disallow unknown type selectors. */ - noUnknownTypeSelector?: RuleConfiguration_for_Null; + noUnknownTypeSelector?: RuleConfiguration_for_NoUnknownTypeSelectorOptions; /** * Disallow unknown CSS units. */ - noUnknownUnit?: RuleConfiguration_for_Null; + noUnknownUnit?: RuleConfiguration_for_NoUnknownUnitOptions; /** * Disallow unmatchable An+B selectors. */ - noUnmatchableAnbSelector?: RuleConfiguration_for_Null; + noUnmatchableAnbSelector?: RuleConfiguration_for_NoUnmatchableAnbSelectorOptions; /** * Disallow unreachable code */ - noUnreachable?: RuleConfiguration_for_Null; + noUnreachable?: RuleConfiguration_for_NoUnreachableOptions; /** * 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_for_Null; + noUnreachableSuper?: RuleConfiguration_for_NoUnreachableSuperOptions; /** * Disallow control flow statements in finally blocks. */ - noUnsafeFinally?: RuleConfiguration_for_Null; + noUnsafeFinally?: RuleConfiguration_for_NoUnsafeFinallyOptions; /** * Disallow the use of optional chaining in contexts where the undefined value is not allowed. */ - noUnsafeOptionalChaining?: RuleConfiguration_for_Null; + noUnsafeOptionalChaining?: RuleConfiguration_for_NoUnsafeOptionalChainingOptions; /** * Disallow unused function parameters. */ - noUnusedFunctionParameters?: RuleFixConfiguration_for_Null; + noUnusedFunctionParameters?: RuleFixConfiguration_for_NoUnusedFunctionParametersOptions; /** * Disallow unused imports. */ - noUnusedImports?: RuleFixConfiguration_for_Null; + noUnusedImports?: RuleFixConfiguration_for_NoUnusedImportsOptions; /** * Disallow unused labels. */ - noUnusedLabels?: RuleFixConfiguration_for_Null; + noUnusedLabels?: RuleFixConfiguration_for_NoUnusedLabelsOptions; /** * Disallow unused private class members */ - noUnusedPrivateClassMembers?: RuleFixConfiguration_for_Null; + noUnusedPrivateClassMembers?: RuleFixConfiguration_for_NoUnusedPrivateClassMembersOptions; /** * Disallow unused variables. */ @@ -1496,11 +1502,11 @@ export interface Correctness { /** * This rules prevents void elements (AKA self-closing elements) from having children. */ - noVoidElementsWithChildren?: RuleFixConfiguration_for_Null; + noVoidElementsWithChildren?: RuleFixConfiguration_for_NoVoidElementsWithChildrenOptions; /** * Disallow returning a value from a function with the return type 'void' */ - noVoidTypeReturn?: RuleConfiguration_for_Null; + noVoidTypeReturn?: RuleConfiguration_for_NoVoidTypeReturnOptions; /** * It enables the recommended rules for this group */ @@ -1512,7 +1518,7 @@ export interface Correctness { /** * Enforce that all React hooks are being called from the Top Level component functions. */ - useHookAtTopLevel?: RuleConfiguration_for_DeprecatedHooksOptions; + useHookAtTopLevel?: RuleConfiguration_for_UseHookAtTopLevelOptions; /** * Enforce file extensions for relative imports. */ @@ -1520,7 +1526,7 @@ export interface Correctness { /** * Require calls to isNaN() when checking for NaN. */ - useIsNan?: RuleFixConfiguration_for_Null; + useIsNan?: RuleFixConfiguration_for_UseIsNanOptions; /** * Disallow missing key props in iterators/collection literals. */ @@ -1528,15 +1534,15 @@ export interface Correctness { /** * Enforce "for" loop update clause moving the counter in the right direction. */ - useValidForDirection?: RuleConfiguration_for_Null; + useValidForDirection?: RuleConfiguration_for_UseValidForDirectionOptions; /** * This rule checks that the result of a typeof expression is compared to a valid value. */ - useValidTypeof?: RuleFixConfiguration_for_Null; + useValidTypeof?: RuleFixConfiguration_for_UseValidTypeofOptions; /** * Require generator functions to contain yield. */ - useYield?: RuleConfiguration_for_Null; + useYield?: RuleConfiguration_for_UseYieldOptions; } /** * A list of rules that belong to this group @@ -1545,7 +1551,7 @@ export interface Nursery { /** * Disallow await inside loops. */ - noAwaitInLoop?: RuleConfiguration_for_Null; + noAwaitInLoop?: RuleConfiguration_for_NoAwaitInLoopOptions; /** * Disallow bitwise operators. */ @@ -1553,11 +1559,11 @@ export interface Nursery { /** * Disallow expressions where the operation doesn't affect the value */ - noConstantBinaryExpression?: RuleConfiguration_for_Null; + noConstantBinaryExpression?: RuleConfiguration_for_NoConstantBinaryExpressionOptions; /** * Disallow destructuring props inside JSX components in Solid projects. */ - noDestructuredProps?: RuleConfiguration_for_Null; + noDestructuredProps?: RuleConfiguration_for_NoDestructuredPropsOptions; /** * Restrict the number of lines of code in a function. */ @@ -1565,43 +1571,43 @@ export interface Nursery { /** * Require Promise-like statements to be handled appropriately. */ - noFloatingPromises?: RuleFixConfiguration_for_Null; + noFloatingPromises?: RuleFixConfiguration_for_NoFloatingPromisesOptions; /** * Disallow the use of __dirname and __filename in the global scope. */ - noGlobalDirnameFilename?: RuleFixConfiguration_for_Null; + noGlobalDirnameFilename?: RuleFixConfiguration_for_NoGlobalDirnameFilenameOptions; /** * Disallow shorthand type conversions. */ - noImplicitCoercion?: RuleFixConfiguration_for_Null; + noImplicitCoercion?: RuleFixConfiguration_for_NoImplicitCoercionOptions; /** * Prevent import cycles. */ - noImportCycles?: RuleConfiguration_for_Null; + noImportCycles?: RuleConfiguration_for_NoImportCyclesOptions; /** * Disallow the use of the !important style. */ - noImportantStyles?: RuleFixConfiguration_for_Null; + noImportantStyles?: RuleFixConfiguration_for_NoImportantStylesOptions; /** * Reports usage of "magic numbers" — numbers used directly instead of being assigned to named constants. */ - noMagicNumbers?: RuleConfiguration_for_Null; + noMagicNumbers?: RuleConfiguration_for_NoMagicNumbersOptions; /** * Disallows defining React components inside other components. */ - noNestedComponentDefinitions?: RuleConfiguration_for_Null; + noNestedComponentDefinitions?: RuleConfiguration_for_NoNestedComponentDefinitionsOptions; /** * Disallow use event handlers on non-interactive elements. */ - noNoninteractiveElementInteractions?: RuleConfiguration_for_Null; + noNoninteractiveElementInteractions?: RuleConfiguration_for_NoNoninteractiveElementInteractionsOptions; /** * Disallow the use of process global. */ - noProcessGlobal?: RuleFixConfiguration_for_Null; + noProcessGlobal?: RuleFixConfiguration_for_NoProcessGlobalOptions; /** * Disallow assigning to React component props. */ - noReactPropAssign?: RuleConfiguration_for_Null; + noReactPropAssign?: RuleConfiguration_for_NoReactPropAssignOptions; /** * Disallow the use of configured elements. */ @@ -1613,39 +1619,39 @@ export interface Nursery { /** * Disallow variable declarations from shadowing variables declared in the outer scope. */ - noShadow?: RuleConfiguration_for_Null; + noShadow?: RuleConfiguration_for_NoShadowOptions; /** * Prevents the use of the TypeScript directive @ts-ignore. */ - noTsIgnore?: RuleFixConfiguration_for_Null; + noTsIgnore?: RuleFixConfiguration_for_NoTsIgnoreOptions; /** * Disallow let or var variables that are read but never assigned. */ - noUnassignedVariables?: RuleConfiguration_for_Null; + noUnassignedVariables?: RuleConfiguration_for_NoUnassignedVariablesOptions; /** * Disallow unknown at-rules. */ - noUnknownAtRule?: RuleConfiguration_for_Null; + noUnknownAtRule?: RuleConfiguration_for_NoUnknownAtRuleOptions; /** * Warn when importing non-existing exports. */ - noUnresolvedImports?: RuleConfiguration_for_Null; + noUnresolvedImports?: RuleConfiguration_for_NoUnresolvedImportsOptions; /** * Prevent duplicate polyfills from Polyfill.io. */ - noUnwantedPolyfillio?: RuleConfiguration_for_Null; + noUnwantedPolyfillio?: RuleConfiguration_for_NoUnwantedPolyfillioOptions; /** * Disallow useless backreferences in regular expression literals that always match an empty string. */ - noUselessBackrefInRegex?: RuleConfiguration_for_Null; + noUselessBackrefInRegex?: RuleConfiguration_for_NoUselessBackrefInRegexOptions; /** * Disallow unnecessary escapes in string literals. */ - noUselessEscapeInString?: RuleFixConfiguration_for_Null; + noUselessEscapeInString?: RuleFixConfiguration_for_NoUselessEscapeInStringOptions; /** * Disallow the use of useless undefined. */ - noUselessUndefined?: RuleFixConfiguration_for_Null; + noUselessUndefined?: RuleFixConfiguration_for_NoUselessUndefinedOptions; /** * It enables the recommended rules for this group */ @@ -1653,7 +1659,7 @@ export interface Nursery { /** * Enforce that getters and setters for the same property are adjacent in class and object definitions. */ - useAdjacentGetterSetter?: RuleConfiguration_for_Null; + useAdjacentGetterSetter?: RuleConfiguration_for_UseAdjacentGetterSetterOptions; /** * Require the consistent declaration of object literals. Defaults to explicit definitions. */ @@ -1661,83 +1667,83 @@ export interface Nursery { /** * Use static Response methods instead of new Response() constructor when possible. */ - useConsistentResponse?: RuleFixConfiguration_for_Null; + useConsistentResponse?: RuleFixConfiguration_for_UseConsistentResponseOptions; /** * Require switch-case statements to be exhaustive. */ - useExhaustiveSwitchCases?: RuleFixConfiguration_for_Null; + useExhaustiveSwitchCases?: RuleFixConfiguration_for_UseExhaustiveSwitchCasesOptions; /** * Enforce types in functions, methods, variables, and parameters. */ - useExplicitType?: RuleConfiguration_for_Null; + useExplicitType?: RuleConfiguration_for_UseExplicitTypeOptions; /** * Require that all exports are declared after all non-export statements. */ - useExportsLast?: RuleConfiguration_for_Null; + useExportsLast?: RuleConfiguration_for_UseExportsLastOptions; /** * Enforce using Solid's \ component for mapping an array to JSX elements. */ - useForComponent?: RuleConfiguration_for_Null; + useForComponent?: RuleConfiguration_for_UseForComponentOptions; /** * Ensure the preconnect attribute is used when using Google Fonts. */ - useGoogleFontPreconnect?: RuleFixConfiguration_for_Null; + useGoogleFontPreconnect?: RuleFixConfiguration_for_UseGoogleFontPreconnectOptions; /** * Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item. */ - useIndexOf?: RuleFixConfiguration_for_Null; + useIndexOf?: RuleFixConfiguration_for_UseIndexOfOptions; /** * Enforce consistent return values in iterable callbacks. */ - useIterableCallbackReturn?: RuleConfiguration_for_Null; + useIterableCallbackReturn?: RuleConfiguration_for_UseIterableCallbackReturnOptions; /** * Enforces the use of with { type: "json" } for JSON module imports. */ - useJsonImportAttribute?: RuleFixConfiguration_for_Null; + useJsonImportAttribute?: RuleFixConfiguration_for_UseJsonImportAttributeOptions; /** * Enforce specifying the name of GraphQL operations. */ - useNamedOperation?: RuleFixConfiguration_for_Null; + useNamedOperation?: RuleFixConfiguration_for_UseNamedOperationOptions; /** * Validates that all enum values are capitalized. */ - useNamingConvention?: RuleConfiguration_for_Null; + useNamingConvention?: RuleConfiguration_for_UseNamingConventionOptions; /** * Enforce the use of numeric separators in numeric literals. */ - useNumericSeparators?: RuleFixConfiguration_for_Null; + useNumericSeparators?: RuleFixConfiguration_for_UseNumericSeparatorsOptions; /** * Prefer object spread over Object.assign() when constructing new objects. */ - useObjectSpread?: RuleFixConfiguration_for_Null; + useObjectSpread?: RuleFixConfiguration_for_UseObjectSpreadOptions; /** * Enforce the consistent use of the radix argument when using parseInt(). */ - useParseIntRadix?: RuleFixConfiguration_for_Null; + useParseIntRadix?: RuleFixConfiguration_for_UseParseIntRadixOptions; /** * Enforce marking members as readonly if they are never modified outside the constructor. */ - useReadonlyClassProperties?: RuleFixConfiguration_for_ReadonlyClassPropertiesOptions; + useReadonlyClassProperties?: RuleFixConfiguration_for_UseReadonlyClassPropertiesOptions; /** * Enforce JSDoc comment lines to start with a single asterisk, except for the first one. */ - useSingleJsDocAsterisk?: RuleFixConfiguration_for_Null; + useSingleJsDocAsterisk?: RuleFixConfiguration_for_UseSingleJsDocAsteriskOptions; /** * Enforce the sorting of CSS utility classes. */ - useSortedClasses?: RuleFixConfiguration_for_UtilityClassSortingOptions; + useSortedClasses?: RuleFixConfiguration_for_UseSortedClassesOptions; /** * Require a description parameter for the Symbol(). */ - useSymbolDescription?: RuleConfiguration_for_Null; + useSymbolDescription?: RuleConfiguration_for_UseSymbolDescriptionOptions; /** * Disallow overload signatures that can be unified into a single signature. */ - useUnifiedTypeSignature?: RuleFixConfiguration_for_Null; + useUnifiedTypeSignature?: RuleFixConfiguration_for_UseUnifiedTypeSignatureOptions; /** * Prevent the usage of static string literal id attribute on elements. */ - useUniqueElementIds?: RuleConfiguration_for_Null; + useUniqueElementIds?: RuleConfiguration_for_UseUniqueElementIdsOptions; } /** * A list of rules that belong to this group @@ -1746,31 +1752,31 @@ export interface Performance { /** * Disallow the use of spread (...) syntax on accumulators. */ - noAccumulatingSpread?: RuleConfiguration_for_Null; + noAccumulatingSpread?: RuleConfiguration_for_NoAccumulatingSpreadOptions; /** * Disallow the use of barrel file. */ - noBarrelFile?: RuleConfiguration_for_Null; + noBarrelFile?: RuleConfiguration_for_NoBarrelFileOptions; /** * Disallow the use of the delete operator. */ - noDelete?: RuleFixConfiguration_for_Null; + noDelete?: RuleFixConfiguration_for_NoDeleteOptions; /** * Disallow accessing namespace imports dynamically. */ - noDynamicNamespaceImportAccess?: RuleConfiguration_for_Null; + noDynamicNamespaceImportAccess?: RuleConfiguration_for_NoDynamicNamespaceImportAccessOptions; /** * Prevent usage of \ element in a Next.js project. */ - noImgElement?: RuleConfiguration_for_Null; + noImgElement?: RuleConfiguration_for_NoImgElementOptions; /** * Disallow the use of namespace imports. */ - noNamespaceImport?: RuleConfiguration_for_Null; + noNamespaceImport?: RuleConfiguration_for_NoNamespaceImportOptions; /** * Avoid re-export all. */ - noReExportAll?: RuleConfiguration_for_Null; + noReExportAll?: RuleConfiguration_for_NoReExportAllOptions; /** * It enables the recommended rules for this group */ @@ -1778,7 +1784,7 @@ export interface Performance { /** * Require regex literals to be declared at the top level. */ - useTopLevelRegex?: RuleConfiguration_for_Null; + useTopLevelRegex?: RuleConfiguration_for_UseTopLevelRegexOptions; } /** * A list of rules that belong to this group @@ -1791,15 +1797,15 @@ export interface Security { /** * Prevent the usage of dangerous JSX props */ - noDangerouslySetInnerHtml?: RuleConfiguration_for_Null; + noDangerouslySetInnerHtml?: RuleConfiguration_for_NoDangerouslySetInnerHtmlOptions; /** * Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop. */ - noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration_for_Null; + noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration_for_NoDangerouslySetInnerHtmlWithChildrenOptions; /** * Disallow the use of global eval(). */ - noGlobalEval?: RuleConfiguration_for_Null; + noGlobalEval?: RuleConfiguration_for_NoGlobalEvalOptions; /** * It enables the recommended rules for this group */ @@ -1812,55 +1818,55 @@ export interface Style { /** * Disallow use of CommonJs module system in favor of ESM style imports. */ - noCommonJs?: RuleConfiguration_for_Null; + noCommonJs?: RuleConfiguration_for_NoCommonJsOptions; /** * Disallow default exports. */ - noDefaultExport?: RuleConfiguration_for_Null; + noDefaultExport?: RuleConfiguration_for_NoDefaultExportOptions; /** * Disallow a lower specificity selector from coming after a higher specificity selector. */ - noDescendingSpecificity?: RuleConfiguration_for_Null; + noDescendingSpecificity?: RuleConfiguration_for_NoDescendingSpecificityOptions; /** * Disallow using a callback in asynchronous tests and hooks. */ - noDoneCallback?: RuleConfiguration_for_Null; + noDoneCallback?: RuleConfiguration_for_NoDoneCallbackOptions; /** * Disallow TypeScript enum. */ - noEnum?: RuleConfiguration_for_Null; + noEnum?: RuleConfiguration_for_NoEnumOptions; /** * Disallow exporting an imported variable. */ - noExportedImports?: RuleConfiguration_for_Null; + noExportedImports?: RuleConfiguration_for_NoExportedImportsOptions; /** * Prevent usage of \ element in a Next.js project. */ - noHeadElement?: RuleConfiguration_for_Null; + noHeadElement?: RuleConfiguration_for_NoHeadElementOptions; /** * Disallow implicit true values on JSX boolean attributes */ - noImplicitBoolean?: RuleFixConfiguration_for_Null; + noImplicitBoolean?: RuleFixConfiguration_for_NoImplicitBooleanOptions; /** * Disallow type annotations for variables, parameters, and class properties initialized with a literal expression. */ - noInferrableTypes?: RuleFixConfiguration_for_Null; + noInferrableTypes?: RuleFixConfiguration_for_NoInferrableTypesOptions; /** * Disallow the use of TypeScript's namespaces. */ - noNamespace?: RuleConfiguration_for_Null; + noNamespace?: RuleConfiguration_for_NoNamespaceOptions; /** * Disallow negation in the condition of an if statement if it has an else clause. */ - noNegationElse?: RuleFixConfiguration_for_Null; + noNegationElse?: RuleFixConfiguration_for_NoNegationElseOptions; /** * Disallow nested ternary expressions. */ - noNestedTernary?: RuleConfiguration_for_Null; + noNestedTernary?: RuleConfiguration_for_NoNestedTernaryOptions; /** * Disallow non-null assertions using the ! postfix operator. */ - noNonNullAssertion?: RuleFixConfiguration_for_Null; + noNonNullAssertion?: RuleFixConfiguration_for_NoNonNullAssertionOptions; /** * Disallow reassigning function parameters. */ @@ -1868,19 +1874,19 @@ export interface Style { /** * Disallow the use of parameter properties in class constructors. */ - noParameterProperties?: RuleConfiguration_for_Null; + noParameterProperties?: RuleConfiguration_for_NoParameterPropertiesOptions; /** * Disallow the use of process.env. */ - noProcessEnv?: RuleConfiguration_for_Null; + noProcessEnv?: RuleConfiguration_for_NoProcessEnvOptions; /** * This rule allows you to specify global variable names that you don’t want to use in your application. */ - noRestrictedGlobals?: RuleConfiguration_for_RestrictedGlobalsOptions; + noRestrictedGlobals?: RuleConfiguration_for_NoRestrictedGlobalsOptions; /** * Disallow specified modules when loaded by import or require. */ - noRestrictedImports?: RuleConfiguration_for_RestrictedImportsOptions; + noRestrictedImports?: RuleConfiguration_for_NoRestrictedImportsOptions; /** * Disallow user defined types. */ @@ -1888,27 +1894,27 @@ export interface Style { /** * Disallow the use of constants which its value is the upper-case version of its name. */ - noShoutyConstants?: RuleFixConfiguration_for_Null; + noShoutyConstants?: RuleFixConfiguration_for_NoShoutyConstantsOptions; /** * Enforce the use of String.slice() over String.substr() and String.substring(). */ - noSubstr?: RuleFixConfiguration_for_Null; + noSubstr?: RuleFixConfiguration_for_NoSubstrOptions; /** * Disallow template literals if interpolation and special-character handling are not needed */ - noUnusedTemplateLiteral?: RuleFixConfiguration_for_Null; + noUnusedTemplateLiteral?: RuleFixConfiguration_for_NoUnusedTemplateLiteralOptions; /** * Disallow else block when the if block breaks early. */ - noUselessElse?: RuleFixConfiguration_for_Null; + noUselessElse?: RuleFixConfiguration_for_NoUselessElseOptions; /** * Disallow use of @value rule in css modules. */ - noValueAtRule?: RuleConfiguration_for_Null; + noValueAtRule?: RuleConfiguration_for_NoValueAtRuleOptions; /** * Disallow the use of yoda expressions. */ - noYodaExpression?: RuleFixConfiguration_for_Null; + noYodaExpression?: RuleFixConfiguration_for_NoYodaExpressionOptions; /** * It enables the recommended rules for this group */ @@ -1916,27 +1922,27 @@ export interface Style { /** * Disallow Array constructors. */ - useArrayLiterals?: RuleFixConfiguration_for_Null; + useArrayLiterals?: RuleFixConfiguration_for_UseArrayLiteralsOptions; /** * Enforce the use of as const over literal type and type annotation. */ - useAsConstAssertion?: RuleFixConfiguration_for_Null; + useAsConstAssertion?: RuleFixConfiguration_for_UseAsConstAssertionOptions; /** * Use at() instead of integer index access. */ - useAtIndex?: RuleFixConfiguration_for_Null; + useAtIndex?: RuleFixConfiguration_for_UseAtIndexOptions; /** * Requires following curly brace conventions. */ - useBlockStatements?: RuleFixConfiguration_for_Null; + useBlockStatements?: RuleFixConfiguration_for_UseBlockStatementsOptions; /** * Enforce using else if instead of nested if in else clauses. */ - useCollapsedElseIf?: RuleFixConfiguration_for_Null; + useCollapsedElseIf?: RuleFixConfiguration_for_UseCollapsedElseIfOptions; /** * Enforce using single if instead of nested if clauses. */ - useCollapsedIf?: RuleFixConfiguration_for_Null; + useCollapsedIf?: RuleFixConfiguration_for_UseCollapsedIfOptions; /** * Enforce declaring components only within modules that export React Components exclusively. */ @@ -1944,87 +1950,87 @@ export interface Style { /** * Require consistently using either T\[] or Array\ */ - useConsistentArrayType?: RuleFixConfiguration_for_ConsistentArrayTypeOptions; + useConsistentArrayType?: RuleFixConfiguration_for_UseConsistentArrayTypeOptions; /** * Enforce the use of new for all builtins, except String, Number and Boolean. */ - useConsistentBuiltinInstantiation?: RuleFixConfiguration_for_Null; + useConsistentBuiltinInstantiation?: RuleFixConfiguration_for_UseConsistentBuiltinInstantiationOptions; /** * This rule enforces consistent use of curly braces inside JSX attributes and JSX children. */ - useConsistentCurlyBraces?: RuleFixConfiguration_for_Null; + useConsistentCurlyBraces?: RuleFixConfiguration_for_UseConsistentCurlyBracesOptions; /** * Require consistent accessibility modifiers on class properties and methods. */ - useConsistentMemberAccessibility?: RuleConfiguration_for_ConsistentMemberAccessibilityOptions; + useConsistentMemberAccessibility?: RuleConfiguration_for_UseConsistentMemberAccessibilityOptions; /** * Require const declarations for variables that are only assigned once. */ - useConst?: RuleFixConfiguration_for_Null; + useConst?: RuleFixConfiguration_for_UseConstOptions; /** * Enforce default function parameters and optional function parameters to be last. */ - useDefaultParameterLast?: RuleFixConfiguration_for_Null; + useDefaultParameterLast?: RuleFixConfiguration_for_UseDefaultParameterLastOptions; /** * Require the default clause in switch statements. */ - useDefaultSwitchClause?: RuleConfiguration_for_Null; + useDefaultSwitchClause?: RuleConfiguration_for_UseDefaultSwitchClauseOptions; /** * Require specifying the reason argument when using @deprecated directive */ - useDeprecatedReason?: RuleConfiguration_for_Null; + useDeprecatedReason?: RuleConfiguration_for_UseDeprecatedReasonOptions; /** * Require that each enum member value be explicitly initialized. */ - useEnumInitializers?: RuleFixConfiguration_for_Null; + useEnumInitializers?: RuleFixConfiguration_for_UseEnumInitializersOptions; /** * Enforce explicitly comparing the length, size, byteLength or byteOffset property of a value. */ - useExplicitLengthCheck?: RuleFixConfiguration_for_Null; + useExplicitLengthCheck?: RuleFixConfiguration_for_UseExplicitLengthCheckOptions; /** * Disallow the use of Math.pow in favor of the ** operator. */ - useExponentiationOperator?: RuleFixConfiguration_for_Null; + useExponentiationOperator?: RuleFixConfiguration_for_UseExponentiationOperatorOptions; /** * Promotes the use of export type for types. */ - useExportType?: RuleFixConfiguration_for_Null; + useExportType?: RuleFixConfiguration_for_UseExportTypeOptions; /** * Enforce naming conventions for JavaScript and TypeScript filenames. */ - useFilenamingConvention?: RuleConfiguration_for_FilenamingConventionOptions; + useFilenamingConvention?: RuleConfiguration_for_UseFilenamingConventionOptions; /** * 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_for_Null; + useForOf?: RuleConfiguration_for_UseForOfOptions; /** * This rule enforces the use of \<>...\ over \...\. */ - useFragmentSyntax?: RuleFixConfiguration_for_Null; + useFragmentSyntax?: RuleFixConfiguration_for_UseFragmentSyntaxOptions; /** * Promotes the use of import type for types. */ - useImportType?: RuleFixConfiguration_for_ImportTypeOptions; + useImportType?: RuleFixConfiguration_for_UseImportTypeOptions; /** * Require all enum members to be literal values. */ - useLiteralEnumMembers?: RuleConfiguration_for_Null; + useLiteralEnumMembers?: RuleConfiguration_for_UseLiteralEnumMembersOptions; /** * Enforce naming conventions for everything across a codebase. */ - useNamingConvention?: RuleFixConfiguration_for_NamingConventionOptions; + useNamingConvention?: RuleFixConfiguration_for_UseNamingConventionOptions; /** * Promotes the usage of node:assert/strict over node:assert. */ - useNodeAssertStrict?: RuleFixConfiguration_for_Null; + useNodeAssertStrict?: RuleFixConfiguration_for_UseNodeAssertStrictOptions; /** * Enforces using the node: protocol for Node.js builtin modules. */ - useNodejsImportProtocol?: RuleFixConfiguration_for_Null; + useNodejsImportProtocol?: RuleFixConfiguration_for_UseNodejsImportProtocolOptions; /** * Use the Number properties instead of global ones. */ - useNumberNamespace?: RuleFixConfiguration_for_Null; + useNumberNamespace?: RuleFixConfiguration_for_UseNumberNamespaceOptions; /** * Prevent extra closing tags for components without children. */ @@ -2032,31 +2038,31 @@ export interface Style { /** * Require assignment operator shorthand where possible. */ - useShorthandAssign?: RuleFixConfiguration_for_Null; + useShorthandAssign?: RuleFixConfiguration_for_UseShorthandAssignOptions; /** * Enforce using function types instead of object type with call signatures. */ - useShorthandFunctionType?: RuleFixConfiguration_for_Null; + useShorthandFunctionType?: RuleFixConfiguration_for_UseShorthandFunctionTypeOptions; /** * Disallow multiple variable declarations in the same variable statement */ - useSingleVarDeclarator?: RuleFixConfiguration_for_Null; + useSingleVarDeclarator?: RuleFixConfiguration_for_UseSingleVarDeclaratorOptions; /** * Prefer template literals over string concatenation. */ - useTemplate?: RuleFixConfiguration_for_Null; + useTemplate?: RuleFixConfiguration_for_UseTemplateOptions; /** * Require new when throwing an error. */ - useThrowNewError?: RuleFixConfiguration_for_Null; + useThrowNewError?: RuleFixConfiguration_for_UseThrowNewErrorOptions; /** * Disallow throwing non-Error values. */ - useThrowOnlyError?: RuleConfiguration_for_Null; + useThrowOnlyError?: RuleConfiguration_for_UseThrowOnlyErrorOptions; /** * Enforce the use of String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight(). */ - useTrimStartEnd?: RuleFixConfiguration_for_Null; + useTrimStartEnd?: RuleFixConfiguration_for_UseTrimStartEndOptions; } /** * A list of rules that belong to this group @@ -2065,39 +2071,39 @@ export interface Suspicious { /** * Disallow the use of alert, confirm, and prompt. */ - noAlert?: RuleConfiguration_for_Null; + noAlert?: RuleConfiguration_for_NoAlertOptions; /** * Use standard constants instead of approximated literals. */ - noApproximativeNumericConstant?: RuleFixConfiguration_for_Null; + noApproximativeNumericConstant?: RuleFixConfiguration_for_NoApproximativeNumericConstantOptions; /** * Discourage the usage of Array index in keys. */ - noArrayIndexKey?: RuleConfiguration_for_Null; + noArrayIndexKey?: RuleConfiguration_for_NoArrayIndexKeyOptions; /** * Disallow assignments in expressions. */ - noAssignInExpressions?: RuleConfiguration_for_Null; + noAssignInExpressions?: RuleConfiguration_for_NoAssignInExpressionsOptions; /** * Disallows using an async function as a Promise executor. */ - noAsyncPromiseExecutor?: RuleConfiguration_for_Null; + noAsyncPromiseExecutor?: RuleConfiguration_for_NoAsyncPromiseExecutorOptions; /** * Disallow reassigning exceptions in catch clauses. */ - noCatchAssign?: RuleConfiguration_for_Null; + noCatchAssign?: RuleConfiguration_for_NoCatchAssignOptions; /** * Disallow reassigning class members. */ - noClassAssign?: RuleConfiguration_for_Null; + noClassAssign?: RuleConfiguration_for_NoClassAssignOptions; /** * Prevent comments from being inserted as text nodes */ - noCommentText?: RuleFixConfiguration_for_Null; + noCommentText?: RuleFixConfiguration_for_NoCommentTextOptions; /** * Disallow comparing against -0 */ - noCompareNegZero?: RuleFixConfiguration_for_Null; + noCompareNegZero?: RuleFixConfiguration_for_NoCompareNegZeroOptions; /** * Disallow labeled statements that are not loops. */ @@ -2105,7 +2111,7 @@ export interface Suspicious { /** * Disallow void type outside of generic or return types. */ - noConfusingVoidType?: RuleFixConfiguration_for_Null; + noConfusingVoidType?: RuleFixConfiguration_for_NoConfusingVoidTypeOptions; /** * Disallow the use of console. */ @@ -2113,23 +2119,23 @@ export interface Suspicious { /** * Disallow TypeScript const enum */ - noConstEnum?: RuleFixConfiguration_for_Null; + noConstEnum?: RuleFixConfiguration_for_NoConstEnumOptions; /** * Prevents from having control characters and some escape sequences that match control characters in regular expression literals. */ - noControlCharactersInRegex?: RuleConfiguration_for_Null; + noControlCharactersInRegex?: RuleConfiguration_for_NoControlCharactersInRegexOptions; /** * Disallow the use of debugger */ - noDebugger?: RuleFixConfiguration_for_Null; + noDebugger?: RuleFixConfiguration_for_NoDebuggerOptions; /** * Disallow direct assignments to document.cookie. */ - noDocumentCookie?: RuleConfiguration_for_Null; + noDocumentCookie?: RuleConfiguration_for_NoDocumentCookieOptions; /** * Prevents importing next/document outside of pages/_document.jsx in Next.js projects. */ - noDocumentImportInPage?: RuleConfiguration_for_Null; + noDocumentImportInPage?: RuleConfiguration_for_NoDocumentImportInPageOptions; /** * Require the use of === and !==. */ @@ -2137,215 +2143,215 @@ export interface Suspicious { /** * Disallow duplicate @import rules. */ - noDuplicateAtImportRules?: RuleConfiguration_for_Null; + noDuplicateAtImportRules?: RuleConfiguration_for_NoDuplicateAtImportRulesOptions; /** * Disallow duplicate case labels. */ - noDuplicateCase?: RuleConfiguration_for_Null; + noDuplicateCase?: RuleConfiguration_for_NoDuplicateCaseOptions; /** * Disallow duplicate class members. */ - noDuplicateClassMembers?: RuleConfiguration_for_Null; + noDuplicateClassMembers?: RuleConfiguration_for_NoDuplicateClassMembersOptions; /** * Disallow duplicate custom properties within declaration blocks. */ - noDuplicateCustomProperties?: RuleConfiguration_for_Null; + noDuplicateCustomProperties?: RuleConfiguration_for_NoDuplicateCustomPropertiesOptions; /** * Disallow duplicate conditions in if-else-if chains */ - noDuplicateElseIf?: RuleConfiguration_for_Null; + noDuplicateElseIf?: RuleConfiguration_for_NoDuplicateElseIfOptions; /** * No duplicated fields in GraphQL operations. */ - noDuplicateFields?: RuleConfiguration_for_Null; + noDuplicateFields?: RuleConfiguration_for_NoDuplicateFieldsOptions; /** * Disallow duplicate names within font families. */ - noDuplicateFontNames?: RuleConfiguration_for_Null; + noDuplicateFontNames?: RuleConfiguration_for_NoDuplicateFontNamesOptions; /** * Prevents JSX properties to be assigned multiple times. */ - noDuplicateJsxProps?: RuleConfiguration_for_Null; + noDuplicateJsxProps?: RuleConfiguration_for_NoDuplicateJsxPropsOptions; /** * Disallow two keys with the same name inside objects. */ - noDuplicateObjectKeys?: RuleConfiguration_for_Null; + noDuplicateObjectKeys?: RuleConfiguration_for_NoDuplicateObjectKeysOptions; /** * Disallow duplicate function parameter name. */ - noDuplicateParameters?: RuleConfiguration_for_Null; + noDuplicateParameters?: RuleConfiguration_for_NoDuplicateParametersOptions; /** * Disallow duplicate properties within declaration blocks. */ - noDuplicateProperties?: RuleConfiguration_for_Null; + noDuplicateProperties?: RuleConfiguration_for_NoDuplicatePropertiesOptions; /** * Disallow duplicate selectors within keyframe blocks. */ - noDuplicateSelectorsKeyframeBlock?: RuleConfiguration_for_Null; + noDuplicateSelectorsKeyframeBlock?: RuleConfiguration_for_NoDuplicateSelectorsKeyframeBlockOptions; /** * A describe block should not contain duplicate hooks. */ - noDuplicateTestHooks?: RuleConfiguration_for_Null; + noDuplicateTestHooks?: RuleConfiguration_for_NoDuplicateTestHooksOptions; /** * Disallow CSS empty blocks. */ - noEmptyBlock?: RuleConfiguration_for_Null; + noEmptyBlock?: RuleConfiguration_for_NoEmptyBlockOptions; /** * Disallow empty block statements and static blocks. */ - noEmptyBlockStatements?: RuleConfiguration_for_Null; + noEmptyBlockStatements?: RuleConfiguration_for_NoEmptyBlockStatementsOptions; /** * Disallow the declaration of empty interfaces. */ - noEmptyInterface?: RuleFixConfiguration_for_Null; + noEmptyInterface?: RuleFixConfiguration_for_NoEmptyInterfaceOptions; /** * Disallow variables from evolving into any type through reassignments. */ - noEvolvingTypes?: RuleConfiguration_for_Null; + noEvolvingTypes?: RuleConfiguration_for_NoEvolvingTypesOptions; /** * Disallow the any type usage. */ - noExplicitAny?: RuleConfiguration_for_Null; + noExplicitAny?: RuleConfiguration_for_NoExplicitAnyOptions; /** * Disallow using export or module.exports in files containing tests */ - noExportsInTest?: RuleConfiguration_for_Null; + noExportsInTest?: RuleConfiguration_for_NoExportsInTestOptions; /** * Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files. */ - noExtraNonNullAssertion?: RuleFixConfiguration_for_Null; + noExtraNonNullAssertion?: RuleFixConfiguration_for_NoExtraNonNullAssertionOptions; /** * Disallow fallthrough of switch clauses. */ - noFallthroughSwitchClause?: RuleConfiguration_for_Null; + noFallthroughSwitchClause?: RuleConfiguration_for_NoFallthroughSwitchClauseOptions; /** * Disallow focused tests. */ - noFocusedTests?: RuleFixConfiguration_for_Null; + noFocusedTests?: RuleFixConfiguration_for_NoFocusedTestsOptions; /** * Disallow reassigning function declarations. */ - noFunctionAssign?: RuleConfiguration_for_Null; + noFunctionAssign?: RuleConfiguration_for_NoFunctionAssignOptions; /** * Disallow assignments to native objects and read-only global variables. */ - noGlobalAssign?: RuleConfiguration_for_Null; + noGlobalAssign?: RuleConfiguration_for_NoGlobalAssignOptions; /** * Use Number.isFinite instead of global isFinite. */ - noGlobalIsFinite?: RuleFixConfiguration_for_Null; + noGlobalIsFinite?: RuleFixConfiguration_for_NoGlobalIsFiniteOptions; /** * Use Number.isNaN instead of global isNaN. */ - noGlobalIsNan?: RuleFixConfiguration_for_Null; + noGlobalIsNan?: RuleFixConfiguration_for_NoGlobalIsNanOptions; /** * Prevent using the next/head module in pages/_document.js on Next.js projects. */ - noHeadImportInDocument?: RuleConfiguration_for_Null; + noHeadImportInDocument?: RuleConfiguration_for_NoHeadImportInDocumentOptions; /** * Disallow use of implicit any type on variable declarations. */ - noImplicitAnyLet?: RuleConfiguration_for_Null; + noImplicitAnyLet?: RuleConfiguration_for_NoImplicitAnyLetOptions; /** * Disallow assigning to imported bindings */ - noImportAssign?: RuleConfiguration_for_Null; + noImportAssign?: RuleConfiguration_for_NoImportAssignOptions; /** * Disallow invalid !important within keyframe declarations */ - noImportantInKeyframe?: RuleConfiguration_for_Null; + noImportantInKeyframe?: RuleConfiguration_for_NoImportantInKeyframeOptions; /** * Disallows the use of irregular whitespace characters. */ - noIrregularWhitespace?: RuleConfiguration_for_Null; + noIrregularWhitespace?: RuleConfiguration_for_NoIrregularWhitespaceOptions; /** * Disallow labels that share a name with a variable */ - noLabelVar?: RuleConfiguration_for_Null; + noLabelVar?: RuleConfiguration_for_NoLabelVarOptions; /** * Disallow characters made with multiple code points in character class syntax. */ - noMisleadingCharacterClass?: RuleFixConfiguration_for_Null; + noMisleadingCharacterClass?: RuleFixConfiguration_for_NoMisleadingCharacterClassOptions; /** * Enforce proper usage of new and constructor. */ - noMisleadingInstantiator?: RuleConfiguration_for_Null; + noMisleadingInstantiator?: RuleConfiguration_for_NoMisleadingInstantiatorOptions; /** * Checks that the assertion function, for example expect, is placed inside an it() function call. */ - noMisplacedAssertion?: RuleConfiguration_for_Null; + noMisplacedAssertion?: RuleConfiguration_for_NoMisplacedAssertionOptions; /** * Disallow shorthand assign when variable appears on both sides. */ - noMisrefactoredShorthandAssign?: RuleFixConfiguration_for_Null; + noMisrefactoredShorthandAssign?: RuleFixConfiguration_for_NoMisrefactoredShorthandAssignOptions; /** * Disallow octal escape sequences in string literals */ - noOctalEscape?: RuleFixConfiguration_for_Null; + noOctalEscape?: RuleFixConfiguration_for_NoOctalEscapeOptions; /** * Disallow direct use of Object.prototype builtins. */ - noPrototypeBuiltins?: RuleFixConfiguration_for_Null; + noPrototypeBuiltins?: RuleFixConfiguration_for_NoPrototypeBuiltinsOptions; /** * Prevents React-specific JSX properties from being used. */ - noReactSpecificProps?: RuleFixConfiguration_for_Null; + noReactSpecificProps?: RuleFixConfiguration_for_NoReactSpecificPropsOptions; /** * Disallow variable, function, class, and type redeclarations in the same scope. */ - noRedeclare?: RuleConfiguration_for_Null; + noRedeclare?: RuleConfiguration_for_NoRedeclareOptions; /** * Prevents from having redundant "use strict". */ - noRedundantUseStrict?: RuleFixConfiguration_for_Null; + noRedundantUseStrict?: RuleFixConfiguration_for_NoRedundantUseStrictOptions; /** * Disallow comparisons where both sides are exactly the same. */ - noSelfCompare?: RuleConfiguration_for_Null; + noSelfCompare?: RuleConfiguration_for_NoSelfCompareOptions; /** * Disallow identifiers from shadowing restricted names. */ - noShadowRestrictedNames?: RuleConfiguration_for_Null; + noShadowRestrictedNames?: RuleConfiguration_for_NoShadowRestrictedNamesOptions; /** * Disallow shorthand properties that override related longhand properties. */ - noShorthandPropertyOverrides?: RuleConfiguration_for_Null; + noShorthandPropertyOverrides?: RuleConfiguration_for_NoShorthandPropertyOverridesOptions; /** * Disallow disabled tests. */ - noSkippedTests?: RuleFixConfiguration_for_Null; + noSkippedTests?: RuleFixConfiguration_for_NoSkippedTestsOptions; /** * Prevents the use of sparse arrays (arrays with holes). */ - noSparseArray?: RuleFixConfiguration_for_Null; + noSparseArray?: RuleFixConfiguration_for_NoSparseArrayOptions; /** * It detects possible "wrong" semicolons inside JSX elements. */ - noSuspiciousSemicolonInJsx?: RuleConfiguration_for_Null; + noSuspiciousSemicolonInJsx?: RuleConfiguration_for_NoSuspiciousSemicolonInJsxOptions; /** * Disallow template literal placeholder syntax in regular strings. */ - noTemplateCurlyInString?: RuleConfiguration_for_Null; + noTemplateCurlyInString?: RuleConfiguration_for_NoTemplateCurlyInStringOptions; /** * Disallow then property. */ - noThenProperty?: RuleConfiguration_for_Null; + noThenProperty?: RuleConfiguration_for_NoThenPropertyOptions; /** * Disallow unsafe declaration merging between interfaces and classes. */ - noUnsafeDeclarationMerging?: RuleConfiguration_for_Null; + noUnsafeDeclarationMerging?: RuleConfiguration_for_NoUnsafeDeclarationMergingOptions; /** * Disallow using unsafe negation. */ - noUnsafeNegation?: RuleFixConfiguration_for_Null; + noUnsafeNegation?: RuleFixConfiguration_for_NoUnsafeNegationOptions; /** * Disallow the use of var */ - noVar?: RuleFixConfiguration_for_Null; + noVar?: RuleFixConfiguration_for_NoVarOptions; /** * Disallow with statements in non-strict contexts. */ - noWith?: RuleConfiguration_for_Null; + noWith?: RuleConfiguration_for_NoWithOptions; /** * It enables the recommended rules for this group */ @@ -2353,50 +2359,70 @@ export interface Suspicious { /** * Disallow the use of overload signatures that are not next to each other. */ - useAdjacentOverloadSignatures?: RuleConfiguration_for_Null; + useAdjacentOverloadSignatures?: RuleConfiguration_for_UseAdjacentOverloadSignaturesOptions; /** * Ensure async functions utilize await. */ - useAwait?: RuleConfiguration_for_Null; + useAwait?: RuleConfiguration_for_UseAwaitOptions; /** * Enforce default clauses in switch statements to be last */ - useDefaultSwitchClauseLast?: RuleConfiguration_for_Null; + useDefaultSwitchClauseLast?: RuleConfiguration_for_UseDefaultSwitchClauseLastOptions; /** * Enforce passing a message value when creating a built-in error. */ - useErrorMessage?: RuleConfiguration_for_Null; + useErrorMessage?: RuleConfiguration_for_UseErrorMessageOptions; /** * Enforce get methods to always return a value. */ - useGetterReturn?: RuleConfiguration_for_Null; + useGetterReturn?: RuleConfiguration_for_UseGetterReturnOptions; /** * Enforces the use of a recommended display strategy with Google Fonts. */ - useGoogleFontDisplay?: RuleConfiguration_for_Null; + useGoogleFontDisplay?: RuleConfiguration_for_UseGoogleFontDisplayOptions; /** * Require for-in loops to include an if statement. */ - useGuardForIn?: RuleConfiguration_for_Null; + useGuardForIn?: RuleConfiguration_for_UseGuardForInOptions; /** * Use Array.isArray() instead of instanceof Array. */ - useIsArray?: RuleFixConfiguration_for_Null; + useIsArray?: RuleFixConfiguration_for_UseIsArrayOptions; /** * Require using the namespace keyword over the module keyword to declare TypeScript namespaces. */ - useNamespaceKeyword?: RuleFixConfiguration_for_Null; + useNamespaceKeyword?: RuleFixConfiguration_for_UseNamespaceKeywordOptions; /** * Enforce using the digits argument with Number#toFixed(). */ - useNumberToFixedDigitsArgument?: RuleFixConfiguration_for_Null; + useNumberToFixedDigitsArgument?: RuleFixConfiguration_for_UseNumberToFixedDigitsArgumentOptions; /** * Enforce the use of the directive "use strict" in script files. */ - useStrictMode?: RuleFixConfiguration_for_Null; + useStrictMode?: RuleFixConfiguration_for_UseStrictModeOptions; } export type RuleAssistPlainConfiguration = "off" | "on"; -export interface RuleAssistWithOptions_for_Options { +export interface RuleAssistWithOptions_for_OrganizeImportsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RuleAssistPlainConfiguration; + /** + * Rule's options + */ + options: OrganizeImportsOptions; +} +export interface RuleAssistWithOptions_for_UseSortedAttributesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RuleAssistPlainConfiguration; + /** + * Rule's options + */ + options: UseSortedAttributesOptions; +} +export interface RuleAssistWithOptions_for_UseSortedKeysOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2404,9 +2430,9 @@ export interface RuleAssistWithOptions_for_Options { /** * Rule's options */ - options: Options; + options: UseSortedKeysOptions; } -export interface RuleAssistWithOptions_for_Null { +export interface RuleAssistWithOptions_for_UseSortedPropertiesOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2414,128 +2440,4424 @@ export interface RuleAssistWithOptions_for_Null { /** * Rule's options */ - options: null; + options: UseSortedPropertiesOptions; } -export type RuleFixConfiguration_for_Null = +export type RuleFixConfiguration_for_NoAccessKeyOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoAccessKeyOptions; +export type RuleFixConfiguration_for_NoAriaHiddenOnFocusableOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoAriaHiddenOnFocusableOptions; +export type RuleFixConfiguration_for_NoAriaUnsupportedElementsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoAriaUnsupportedElementsOptions; +export type RuleFixConfiguration_for_NoAutofocusOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoAutofocusOptions; +export type RuleFixConfiguration_for_NoDistractingElementsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoDistractingElementsOptions; +export type RuleFixConfiguration_for_NoHeaderScopeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoHeaderScopeOptions; +export type RuleFixConfiguration_for_NoInteractiveElementToNoninteractiveRoleOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_Null; + | RuleWithFixOptions_for_NoInteractiveElementToNoninteractiveRoleOptions; export type RuleConfiguration_for_NoLabelWithoutControlOptions = | RulePlainConfiguration | RuleWithOptions_for_NoLabelWithoutControlOptions; -export type RuleConfiguration_for_Null = +export type RuleFixConfiguration_for_NoNoninteractiveElementToInteractiveRoleOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoNoninteractiveElementToInteractiveRoleOptions; +export type RuleFixConfiguration_for_NoNoninteractiveTabindexOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoNoninteractiveTabindexOptions; +export type RuleFixConfiguration_for_NoPositiveTabindexOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoPositiveTabindexOptions; +export type RuleConfiguration_for_NoRedundantAltOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoRedundantAltOptions; +export type RuleFixConfiguration_for_NoRedundantRolesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoRedundantRolesOptions; +export type RuleConfiguration_for_NoStaticElementInteractionsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoStaticElementInteractionsOptions; +export type RuleConfiguration_for_NoSvgWithoutTitleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoSvgWithoutTitleOptions; +export type RuleConfiguration_for_UseAltTextOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAltTextOptions; +export type RuleFixConfiguration_for_UseAnchorContentOptions = | RulePlainConfiguration - | RuleWithOptions_for_Null; -export type RuleFixConfiguration_for_ValidAriaRoleOptions = + | RuleWithFixOptions_for_UseAnchorContentOptions; +export type RuleFixConfiguration_for_UseAriaActivedescendantWithTabindexOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_ValidAriaRoleOptions; + | RuleWithFixOptions_for_UseAriaActivedescendantWithTabindexOptions; +export type RuleConfiguration_for_UseAriaPropsForRoleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAriaPropsForRoleOptions; +export type RuleConfiguration_for_UseAriaPropsSupportedByRoleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAriaPropsSupportedByRoleOptions; +export type RuleConfiguration_for_UseButtonTypeOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseButtonTypeOptions; +export type RuleConfiguration_for_UseFocusableInteractiveOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseFocusableInteractiveOptions; +export type RuleConfiguration_for_UseGenericFontNamesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseGenericFontNamesOptions; +export type RuleConfiguration_for_UseHeadingContentOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseHeadingContentOptions; +export type RuleConfiguration_for_UseHtmlLangOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseHtmlLangOptions; +export type RuleConfiguration_for_UseIframeTitleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseIframeTitleOptions; +export type RuleConfiguration_for_UseKeyWithClickEventsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseKeyWithClickEventsOptions; +export type RuleConfiguration_for_UseKeyWithMouseEventsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseKeyWithMouseEventsOptions; +export type RuleConfiguration_for_UseMediaCaptionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseMediaCaptionOptions; +export type RuleConfiguration_for_UseSemanticElementsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseSemanticElementsOptions; +export type RuleConfiguration_for_UseValidAnchorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseValidAnchorOptions; +export type RuleFixConfiguration_for_UseValidAriaPropsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseValidAriaPropsOptions; +export type RuleFixConfiguration_for_UseValidAriaRoleOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseValidAriaRoleOptions; +export type RuleConfiguration_for_UseValidAriaValuesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseValidAriaValuesOptions; export type RuleConfiguration_for_UseValidAutocompleteOptions = | RulePlainConfiguration | RuleWithOptions_for_UseValidAutocompleteOptions; -export type RuleConfiguration_for_ComplexityOptions = +export type RuleConfiguration_for_UseValidLangOptions = | RulePlainConfiguration - | RuleWithOptions_for_ComplexityOptions; + | RuleWithOptions_for_UseValidLangOptions; +export type RuleFixConfiguration_for_NoAdjacentSpacesInRegexOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoAdjacentSpacesInRegexOptions; +export type RuleConfiguration_for_NoArgumentsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoArgumentsOptions; +export type RuleFixConfiguration_for_NoBannedTypesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoBannedTypesOptions; +export type RuleConfiguration_for_NoCommaOperatorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoCommaOperatorOptions; +export type RuleConfiguration_for_NoEmptyTypeParametersOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEmptyTypeParametersOptions; +export type RuleConfiguration_for_NoExcessiveCognitiveComplexityOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoExcessiveCognitiveComplexityOptions; +export type RuleConfiguration_for_NoExcessiveNestedTestSuitesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoExcessiveNestedTestSuitesOptions; +export type RuleFixConfiguration_for_NoExtraBooleanCastOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoExtraBooleanCastOptions; +export type RuleFixConfiguration_for_NoFlatMapIdentityOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoFlatMapIdentityOptions; export type RuleConfiguration_for_NoForEachOptions = | RulePlainConfiguration | RuleWithOptions_for_NoForEachOptions; +export type RuleConfiguration_for_NoStaticOnlyClassOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoStaticOnlyClassOptions; +export type RuleFixConfiguration_for_NoThisInStaticOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoThisInStaticOptions; +export type RuleFixConfiguration_for_NoUselessCatchOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessCatchOptions; +export type RuleFixConfiguration_for_NoUselessConstructorOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessConstructorOptions; +export type RuleFixConfiguration_for_NoUselessContinueOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessContinueOptions; +export type RuleFixConfiguration_for_NoUselessEmptyExportOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessEmptyExportOptions; +export type RuleFixConfiguration_for_NoUselessEscapeInRegexOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessEscapeInRegexOptions; +export type RuleFixConfiguration_for_NoUselessFragmentsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessFragmentsOptions; +export type RuleFixConfiguration_for_NoUselessLabelOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessLabelOptions; +export type RuleFixConfiguration_for_NoUselessLoneBlockStatementsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessLoneBlockStatementsOptions; +export type RuleFixConfiguration_for_NoUselessRenameOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessRenameOptions; +export type RuleFixConfiguration_for_NoUselessStringConcatOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessStringConcatOptions; +export type RuleConfiguration_for_NoUselessStringRawOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUselessStringRawOptions; +export type RuleFixConfiguration_for_NoUselessSwitchCaseOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessSwitchCaseOptions; +export type RuleFixConfiguration_for_NoUselessTernaryOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessTernaryOptions; +export type RuleFixConfiguration_for_NoUselessThisAliasOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessThisAliasOptions; +export type RuleFixConfiguration_for_NoUselessTypeConstraintOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessTypeConstraintOptions; +export type RuleFixConfiguration_for_NoUselessUndefinedInitializationOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessUndefinedInitializationOptions; +export type RuleConfiguration_for_NoVoidOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoVoidOptions; +export type RuleFixConfiguration_for_UseArrowFunctionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseArrowFunctionOptions; +export type RuleFixConfiguration_for_UseDateNowOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseDateNowOptions; +export type RuleFixConfiguration_for_UseFlatMapOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseFlatMapOptions; +export type RuleFixConfiguration_for_UseLiteralKeysOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseLiteralKeysOptions; +export type RuleFixConfiguration_for_UseNumericLiteralsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNumericLiteralsOptions; +export type RuleFixConfiguration_for_UseOptionalChainOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseOptionalChainOptions; +export type RuleFixConfiguration_for_UseRegexLiteralsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseRegexLiteralsOptions; +export type RuleFixConfiguration_for_UseSimpleNumberKeysOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseSimpleNumberKeysOptions; +export type RuleFixConfiguration_for_UseSimplifiedLogicExpressionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseSimplifiedLogicExpressionOptions; +export type RuleFixConfiguration_for_UseWhileOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseWhileOptions; +export type RuleConfiguration_for_NoChildrenPropOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoChildrenPropOptions; +export type RuleFixConfiguration_for_NoConstAssignOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoConstAssignOptions; +export type RuleConfiguration_for_NoConstantConditionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoConstantConditionOptions; +export type RuleFixConfiguration_for_NoConstantMathMinMaxClampOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoConstantMathMinMaxClampOptions; +export type RuleConfiguration_for_NoConstructorReturnOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoConstructorReturnOptions; +export type RuleConfiguration_for_NoEmptyCharacterClassInRegexOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEmptyCharacterClassInRegexOptions; +export type RuleConfiguration_for_NoEmptyPatternOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEmptyPatternOptions; +export type RuleConfiguration_for_NoGlobalObjectCallsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoGlobalObjectCallsOptions; +export type RuleConfiguration_for_NoInnerDeclarationsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInnerDeclarationsOptions; +export type RuleFixConfiguration_for_NoInvalidBuiltinInstantiationOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoInvalidBuiltinInstantiationOptions; +export type RuleConfiguration_for_NoInvalidConstructorSuperOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInvalidConstructorSuperOptions; +export type RuleConfiguration_for_NoInvalidDirectionInLinearGradientOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInvalidDirectionInLinearGradientOptions; +export type RuleConfiguration_for_NoInvalidGridAreasOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInvalidGridAreasOptions; +export type RuleConfiguration_for_NoInvalidPositionAtImportRuleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInvalidPositionAtImportRuleOptions; +export type RuleConfiguration_for_NoInvalidUseBeforeDeclarationOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoInvalidUseBeforeDeclarationOptions; +export type RuleConfiguration_for_NoMissingVarFunctionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoMissingVarFunctionOptions; +export type RuleConfiguration_for_NoNodejsModulesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNodejsModulesOptions; +export type RuleFixConfiguration_for_NoNonoctalDecimalEscapeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoNonoctalDecimalEscapeOptions; +export type RuleConfiguration_for_NoPrecisionLossOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoPrecisionLossOptions; export type RuleConfiguration_for_NoPrivateImportsOptions = | RulePlainConfiguration | RuleWithOptions_for_NoPrivateImportsOptions; +export type RuleConfiguration_for_NoRenderReturnValueOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoRenderReturnValueOptions; +export type RuleConfiguration_for_NoSelfAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoSelfAssignOptions; +export type RuleConfiguration_for_NoSetterReturnOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoSetterReturnOptions; +export type RuleFixConfiguration_for_NoStringCaseMismatchOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoStringCaseMismatchOptions; +export type RuleFixConfiguration_for_NoSwitchDeclarationsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoSwitchDeclarationsOptions; export type RuleConfiguration_for_NoUndeclaredDependenciesOptions = | RulePlainConfiguration | RuleWithOptions_for_NoUndeclaredDependenciesOptions; -export type RuleConfiguration_for_UndeclaredVariablesOptions = +export type RuleConfiguration_for_NoUndeclaredVariablesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUndeclaredVariablesOptions; +export type RuleConfiguration_for_NoUnknownFunctionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownFunctionOptions; +export type RuleConfiguration_for_NoUnknownMediaFeatureNameOptions = | RulePlainConfiguration - | RuleWithOptions_for_UndeclaredVariablesOptions; + | RuleWithOptions_for_NoUnknownMediaFeatureNameOptions; +export type RuleConfiguration_for_NoUnknownPropertyOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownPropertyOptions; +export type RuleConfiguration_for_NoUnknownPseudoClassOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownPseudoClassOptions; +export type RuleConfiguration_for_NoUnknownPseudoElementOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownPseudoElementOptions; +export type RuleConfiguration_for_NoUnknownTypeSelectorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownTypeSelectorOptions; +export type RuleConfiguration_for_NoUnknownUnitOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownUnitOptions; +export type RuleConfiguration_for_NoUnmatchableAnbSelectorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnmatchableAnbSelectorOptions; +export type RuleConfiguration_for_NoUnreachableOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnreachableOptions; +export type RuleConfiguration_for_NoUnreachableSuperOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnreachableSuperOptions; +export type RuleConfiguration_for_NoUnsafeFinallyOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnsafeFinallyOptions; +export type RuleConfiguration_for_NoUnsafeOptionalChainingOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnsafeOptionalChainingOptions; +export type RuleFixConfiguration_for_NoUnusedFunctionParametersOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnusedFunctionParametersOptions; +export type RuleFixConfiguration_for_NoUnusedImportsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnusedImportsOptions; +export type RuleFixConfiguration_for_NoUnusedLabelsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnusedLabelsOptions; +export type RuleFixConfiguration_for_NoUnusedPrivateClassMembersOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnusedPrivateClassMembersOptions; export type RuleFixConfiguration_for_NoUnusedVariablesOptions = | RulePlainConfiguration | RuleWithFixOptions_for_NoUnusedVariablesOptions; +export type RuleFixConfiguration_for_NoVoidElementsWithChildrenOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoVoidElementsWithChildrenOptions; +export type RuleConfiguration_for_NoVoidTypeReturnOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoVoidTypeReturnOptions; export type RuleFixConfiguration_for_UseExhaustiveDependenciesOptions = | RulePlainConfiguration | RuleWithFixOptions_for_UseExhaustiveDependenciesOptions; -export type RuleConfiguration_for_DeprecatedHooksOptions = +export type RuleConfiguration_for_UseHookAtTopLevelOptions = | RulePlainConfiguration - | RuleWithOptions_for_DeprecatedHooksOptions; + | RuleWithOptions_for_UseHookAtTopLevelOptions; export type RuleFixConfiguration_for_UseImportExtensionsOptions = | RulePlainConfiguration | RuleWithFixOptions_for_UseImportExtensionsOptions; +export type RuleFixConfiguration_for_UseIsNanOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseIsNanOptions; export type RuleConfiguration_for_UseJsxKeyInIterableOptions = | RulePlainConfiguration | RuleWithOptions_for_UseJsxKeyInIterableOptions; +export type RuleConfiguration_for_UseValidForDirectionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseValidForDirectionOptions; +export type RuleFixConfiguration_for_UseValidTypeofOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseValidTypeofOptions; +export type RuleConfiguration_for_UseYieldOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseYieldOptions; +export type RuleConfiguration_for_NoAwaitInLoopOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoAwaitInLoopOptions; export type RuleConfiguration_for_NoBitwiseOperatorsOptions = | RulePlainConfiguration | RuleWithOptions_for_NoBitwiseOperatorsOptions; +export type RuleConfiguration_for_NoConstantBinaryExpressionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoConstantBinaryExpressionOptions; +export type RuleConfiguration_for_NoDestructuredPropsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDestructuredPropsOptions; export type RuleConfiguration_for_NoExcessiveLinesPerFunctionOptions = | RulePlainConfiguration | RuleWithOptions_for_NoExcessiveLinesPerFunctionOptions; +export type RuleFixConfiguration_for_NoFloatingPromisesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoFloatingPromisesOptions; +export type RuleFixConfiguration_for_NoGlobalDirnameFilenameOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoGlobalDirnameFilenameOptions; +export type RuleFixConfiguration_for_NoImplicitCoercionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoImplicitCoercionOptions; +export type RuleConfiguration_for_NoImportCyclesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoImportCyclesOptions; +export type RuleFixConfiguration_for_NoImportantStylesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoImportantStylesOptions; +export type RuleConfiguration_for_NoMagicNumbersOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoMagicNumbersOptions; +export type RuleConfiguration_for_NoNestedComponentDefinitionsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNestedComponentDefinitionsOptions; +export type RuleConfiguration_for_NoNoninteractiveElementInteractionsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNoninteractiveElementInteractionsOptions; +export type RuleFixConfiguration_for_NoProcessGlobalOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoProcessGlobalOptions; +export type RuleConfiguration_for_NoReactPropAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoReactPropAssignOptions; export type RuleConfiguration_for_NoRestrictedElementsOptions = | RulePlainConfiguration | RuleWithOptions_for_NoRestrictedElementsOptions; export type RuleConfiguration_for_NoSecretsOptions = | RulePlainConfiguration | RuleWithOptions_for_NoSecretsOptions; +export type RuleConfiguration_for_NoShadowOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoShadowOptions; +export type RuleFixConfiguration_for_NoTsIgnoreOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoTsIgnoreOptions; +export type RuleConfiguration_for_NoUnassignedVariablesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnassignedVariablesOptions; +export type RuleConfiguration_for_NoUnknownAtRuleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnknownAtRuleOptions; +export type RuleConfiguration_for_NoUnresolvedImportsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnresolvedImportsOptions; +export type RuleConfiguration_for_NoUnwantedPolyfillioOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnwantedPolyfillioOptions; +export type RuleConfiguration_for_NoUselessBackrefInRegexOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUselessBackrefInRegexOptions; +export type RuleFixConfiguration_for_NoUselessEscapeInStringOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessEscapeInStringOptions; +export type RuleFixConfiguration_for_NoUselessUndefinedOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessUndefinedOptions; +export type RuleConfiguration_for_UseAdjacentGetterSetterOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAdjacentGetterSetterOptions; export type RuleFixConfiguration_for_UseConsistentObjectDefinitionOptions = | RulePlainConfiguration | RuleWithFixOptions_for_UseConsistentObjectDefinitionOptions; -export type RuleFixConfiguration_for_ReadonlyClassPropertiesOptions = +export type RuleFixConfiguration_for_UseConsistentResponseOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseConsistentResponseOptions; +export type RuleFixConfiguration_for_UseExhaustiveSwitchCasesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseExhaustiveSwitchCasesOptions; +export type RuleConfiguration_for_UseExplicitTypeOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseExplicitTypeOptions; +export type RuleConfiguration_for_UseExportsLastOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseExportsLastOptions; +export type RuleConfiguration_for_UseForComponentOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseForComponentOptions; +export type RuleFixConfiguration_for_UseGoogleFontPreconnectOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_ReadonlyClassPropertiesOptions; -export type RuleFixConfiguration_for_UtilityClassSortingOptions = + | RuleWithFixOptions_for_UseGoogleFontPreconnectOptions; +export type RuleFixConfiguration_for_UseIndexOfOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_UtilityClassSortingOptions; + | RuleWithFixOptions_for_UseIndexOfOptions; +export type RuleConfiguration_for_UseIterableCallbackReturnOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseIterableCallbackReturnOptions; +export type RuleFixConfiguration_for_UseJsonImportAttributeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseJsonImportAttributeOptions; +export type RuleFixConfiguration_for_UseNamedOperationOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNamedOperationOptions; +export type RuleConfiguration_for_UseNamingConventionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseNamingConventionOptions; +export type RuleFixConfiguration_for_UseNumericSeparatorsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNumericSeparatorsOptions; +export type RuleFixConfiguration_for_UseObjectSpreadOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseObjectSpreadOptions; +export type RuleFixConfiguration_for_UseParseIntRadixOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseParseIntRadixOptions; +export type RuleFixConfiguration_for_UseReadonlyClassPropertiesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseReadonlyClassPropertiesOptions; +export type RuleFixConfiguration_for_UseSingleJsDocAsteriskOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseSingleJsDocAsteriskOptions; +export type RuleFixConfiguration_for_UseSortedClassesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseSortedClassesOptions; +export type RuleConfiguration_for_UseSymbolDescriptionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseSymbolDescriptionOptions; +export type RuleFixConfiguration_for_UseUnifiedTypeSignatureOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseUnifiedTypeSignatureOptions; +export type RuleConfiguration_for_UseUniqueElementIdsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseUniqueElementIdsOptions; +export type RuleConfiguration_for_NoAccumulatingSpreadOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoAccumulatingSpreadOptions; +export type RuleConfiguration_for_NoBarrelFileOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoBarrelFileOptions; +export type RuleFixConfiguration_for_NoDeleteOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoDeleteOptions; +export type RuleConfiguration_for_NoDynamicNamespaceImportAccessOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDynamicNamespaceImportAccessOptions; +export type RuleConfiguration_for_NoImgElementOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoImgElementOptions; +export type RuleConfiguration_for_NoNamespaceImportOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNamespaceImportOptions; +export type RuleConfiguration_for_NoReExportAllOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoReExportAllOptions; +export type RuleConfiguration_for_UseTopLevelRegexOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseTopLevelRegexOptions; export type RuleFixConfiguration_for_NoBlankTargetOptions = | RulePlainConfiguration | RuleWithFixOptions_for_NoBlankTargetOptions; +export type RuleConfiguration_for_NoDangerouslySetInnerHtmlOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDangerouslySetInnerHtmlOptions; +export type RuleConfiguration_for_NoDangerouslySetInnerHtmlWithChildrenOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDangerouslySetInnerHtmlWithChildrenOptions; +export type RuleConfiguration_for_NoGlobalEvalOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoGlobalEvalOptions; +export type RuleConfiguration_for_NoCommonJsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoCommonJsOptions; +export type RuleConfiguration_for_NoDefaultExportOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDefaultExportOptions; +export type RuleConfiguration_for_NoDescendingSpecificityOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDescendingSpecificityOptions; +export type RuleConfiguration_for_NoDoneCallbackOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDoneCallbackOptions; +export type RuleConfiguration_for_NoEnumOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEnumOptions; +export type RuleConfiguration_for_NoExportedImportsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoExportedImportsOptions; +export type RuleConfiguration_for_NoHeadElementOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoHeadElementOptions; +export type RuleFixConfiguration_for_NoImplicitBooleanOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoImplicitBooleanOptions; +export type RuleFixConfiguration_for_NoInferrableTypesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoInferrableTypesOptions; +export type RuleConfiguration_for_NoNamespaceOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNamespaceOptions; +export type RuleFixConfiguration_for_NoNegationElseOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoNegationElseOptions; +export type RuleConfiguration_for_NoNestedTernaryOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoNestedTernaryOptions; +export type RuleFixConfiguration_for_NoNonNullAssertionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoNonNullAssertionOptions; export type RuleConfiguration_for_NoParameterAssignOptions = | RulePlainConfiguration | RuleWithOptions_for_NoParameterAssignOptions; -export type RuleConfiguration_for_RestrictedGlobalsOptions = +export type RuleConfiguration_for_NoParameterPropertiesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoParameterPropertiesOptions; +export type RuleConfiguration_for_NoProcessEnvOptions = | RulePlainConfiguration - | RuleWithOptions_for_RestrictedGlobalsOptions; -export type RuleConfiguration_for_RestrictedImportsOptions = + | RuleWithOptions_for_NoProcessEnvOptions; +export type RuleConfiguration_for_NoRestrictedGlobalsOptions = | RulePlainConfiguration - | RuleWithOptions_for_RestrictedImportsOptions; + | RuleWithOptions_for_NoRestrictedGlobalsOptions; +export type RuleConfiguration_for_NoRestrictedImportsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoRestrictedImportsOptions; export type RuleFixConfiguration_for_NoRestrictedTypesOptions = | RulePlainConfiguration | RuleWithFixOptions_for_NoRestrictedTypesOptions; +export type RuleFixConfiguration_for_NoShoutyConstantsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoShoutyConstantsOptions; +export type RuleFixConfiguration_for_NoSubstrOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoSubstrOptions; +export type RuleFixConfiguration_for_NoUnusedTemplateLiteralOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnusedTemplateLiteralOptions; +export type RuleFixConfiguration_for_NoUselessElseOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUselessElseOptions; +export type RuleConfiguration_for_NoValueAtRuleOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoValueAtRuleOptions; +export type RuleFixConfiguration_for_NoYodaExpressionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoYodaExpressionOptions; +export type RuleFixConfiguration_for_UseArrayLiteralsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseArrayLiteralsOptions; +export type RuleFixConfiguration_for_UseAsConstAssertionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseAsConstAssertionOptions; +export type RuleFixConfiguration_for_UseAtIndexOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseAtIndexOptions; +export type RuleFixConfiguration_for_UseBlockStatementsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseBlockStatementsOptions; +export type RuleFixConfiguration_for_UseCollapsedElseIfOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseCollapsedElseIfOptions; +export type RuleFixConfiguration_for_UseCollapsedIfOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseCollapsedIfOptions; export type RuleConfiguration_for_UseComponentExportOnlyModulesOptions = | RulePlainConfiguration | RuleWithOptions_for_UseComponentExportOnlyModulesOptions; -export type RuleFixConfiguration_for_ConsistentArrayTypeOptions = +export type RuleFixConfiguration_for_UseConsistentArrayTypeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseConsistentArrayTypeOptions; +export type RuleFixConfiguration_for_UseConsistentBuiltinInstantiationOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseConsistentBuiltinInstantiationOptions; +export type RuleFixConfiguration_for_UseConsistentCurlyBracesOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseConsistentCurlyBracesOptions; +export type RuleConfiguration_for_UseConsistentMemberAccessibilityOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseConsistentMemberAccessibilityOptions; +export type RuleFixConfiguration_for_UseConstOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseConstOptions; +export type RuleFixConfiguration_for_UseDefaultParameterLastOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseDefaultParameterLastOptions; +export type RuleConfiguration_for_UseDefaultSwitchClauseOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseDefaultSwitchClauseOptions; +export type RuleConfiguration_for_UseDeprecatedReasonOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseDeprecatedReasonOptions; +export type RuleFixConfiguration_for_UseEnumInitializersOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseEnumInitializersOptions; +export type RuleFixConfiguration_for_UseExplicitLengthCheckOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseExplicitLengthCheckOptions; +export type RuleFixConfiguration_for_UseExponentiationOperatorOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseExponentiationOperatorOptions; +export type RuleFixConfiguration_for_UseExportTypeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseExportTypeOptions; +export type RuleConfiguration_for_UseFilenamingConventionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseFilenamingConventionOptions; +export type RuleConfiguration_for_UseForOfOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_ConsistentArrayTypeOptions; -export type RuleConfiguration_for_ConsistentMemberAccessibilityOptions = + | RuleWithOptions_for_UseForOfOptions; +export type RuleFixConfiguration_for_UseFragmentSyntaxOptions = | RulePlainConfiguration - | RuleWithOptions_for_ConsistentMemberAccessibilityOptions; -export type RuleConfiguration_for_FilenamingConventionOptions = + | RuleWithFixOptions_for_UseFragmentSyntaxOptions; +export type RuleFixConfiguration_for_UseImportTypeOptions = | RulePlainConfiguration - | RuleWithOptions_for_FilenamingConventionOptions; -export type RuleFixConfiguration_for_ImportTypeOptions = + | RuleWithFixOptions_for_UseImportTypeOptions; +export type RuleConfiguration_for_UseLiteralEnumMembersOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_ImportTypeOptions; -export type RuleFixConfiguration_for_NamingConventionOptions = + | RuleWithOptions_for_UseLiteralEnumMembersOptions; +export type RuleFixConfiguration_for_UseNamingConventionOptions = | RulePlainConfiguration - | RuleWithFixOptions_for_NamingConventionOptions; + | RuleWithFixOptions_for_UseNamingConventionOptions; +export type RuleFixConfiguration_for_UseNodeAssertStrictOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNodeAssertStrictOptions; +export type RuleFixConfiguration_for_UseNodejsImportProtocolOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNodejsImportProtocolOptions; +export type RuleFixConfiguration_for_UseNumberNamespaceOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNumberNamespaceOptions; export type RuleFixConfiguration_for_UseSelfClosingElementsOptions = | RulePlainConfiguration | RuleWithFixOptions_for_UseSelfClosingElementsOptions; +export type RuleFixConfiguration_for_UseShorthandAssignOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseShorthandAssignOptions; +export type RuleFixConfiguration_for_UseShorthandFunctionTypeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseShorthandFunctionTypeOptions; +export type RuleFixConfiguration_for_UseSingleVarDeclaratorOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseSingleVarDeclaratorOptions; +export type RuleFixConfiguration_for_UseTemplateOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseTemplateOptions; +export type RuleFixConfiguration_for_UseThrowNewErrorOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseThrowNewErrorOptions; +export type RuleConfiguration_for_UseThrowOnlyErrorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseThrowOnlyErrorOptions; +export type RuleFixConfiguration_for_UseTrimStartEndOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseTrimStartEndOptions; +export type RuleConfiguration_for_NoAlertOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoAlertOptions; +export type RuleFixConfiguration_for_NoApproximativeNumericConstantOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoApproximativeNumericConstantOptions; +export type RuleConfiguration_for_NoArrayIndexKeyOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoArrayIndexKeyOptions; +export type RuleConfiguration_for_NoAssignInExpressionsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoAssignInExpressionsOptions; +export type RuleConfiguration_for_NoAsyncPromiseExecutorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoAsyncPromiseExecutorOptions; +export type RuleConfiguration_for_NoCatchAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoCatchAssignOptions; +export type RuleConfiguration_for_NoClassAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoClassAssignOptions; +export type RuleFixConfiguration_for_NoCommentTextOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoCommentTextOptions; +export type RuleFixConfiguration_for_NoCompareNegZeroOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoCompareNegZeroOptions; export type RuleConfiguration_for_NoConfusingLabelsOptions = | RulePlainConfiguration | RuleWithOptions_for_NoConfusingLabelsOptions; +export type RuleFixConfiguration_for_NoConfusingVoidTypeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoConfusingVoidTypeOptions; export type RuleFixConfiguration_for_NoConsoleOptions = | RulePlainConfiguration | RuleWithFixOptions_for_NoConsoleOptions; +export type RuleFixConfiguration_for_NoConstEnumOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoConstEnumOptions; +export type RuleConfiguration_for_NoControlCharactersInRegexOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoControlCharactersInRegexOptions; +export type RuleFixConfiguration_for_NoDebuggerOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoDebuggerOptions; +export type RuleConfiguration_for_NoDocumentCookieOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDocumentCookieOptions; +export type RuleConfiguration_for_NoDocumentImportInPageOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDocumentImportInPageOptions; export type RuleFixConfiguration_for_NoDoubleEqualsOptions = | RulePlainConfiguration | RuleWithFixOptions_for_NoDoubleEqualsOptions; -export interface Options { - groups?: ImportGroups; -} -export type RulePlainConfiguration = "off" | "on" | "info" | "warn" | "error"; -export interface RuleWithFixOptions_for_Null { - /** - * The kind of the code actions emitted by the rule - */ - fix?: FixKind; +export type RuleConfiguration_for_NoDuplicateAtImportRulesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateAtImportRulesOptions; +export type RuleConfiguration_for_NoDuplicateCaseOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateCaseOptions; +export type RuleConfiguration_for_NoDuplicateClassMembersOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateClassMembersOptions; +export type RuleConfiguration_for_NoDuplicateCustomPropertiesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateCustomPropertiesOptions; +export type RuleConfiguration_for_NoDuplicateElseIfOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateElseIfOptions; +export type RuleConfiguration_for_NoDuplicateFieldsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateFieldsOptions; +export type RuleConfiguration_for_NoDuplicateFontNamesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateFontNamesOptions; +export type RuleConfiguration_for_NoDuplicateJsxPropsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateJsxPropsOptions; +export type RuleConfiguration_for_NoDuplicateObjectKeysOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateObjectKeysOptions; +export type RuleConfiguration_for_NoDuplicateParametersOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateParametersOptions; +export type RuleConfiguration_for_NoDuplicatePropertiesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicatePropertiesOptions; +export type RuleConfiguration_for_NoDuplicateSelectorsKeyframeBlockOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateSelectorsKeyframeBlockOptions; +export type RuleConfiguration_for_NoDuplicateTestHooksOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoDuplicateTestHooksOptions; +export type RuleConfiguration_for_NoEmptyBlockOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEmptyBlockOptions; +export type RuleConfiguration_for_NoEmptyBlockStatementsOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEmptyBlockStatementsOptions; +export type RuleFixConfiguration_for_NoEmptyInterfaceOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoEmptyInterfaceOptions; +export type RuleConfiguration_for_NoEvolvingTypesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoEvolvingTypesOptions; +export type RuleConfiguration_for_NoExplicitAnyOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoExplicitAnyOptions; +export type RuleConfiguration_for_NoExportsInTestOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoExportsInTestOptions; +export type RuleFixConfiguration_for_NoExtraNonNullAssertionOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoExtraNonNullAssertionOptions; +export type RuleConfiguration_for_NoFallthroughSwitchClauseOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoFallthroughSwitchClauseOptions; +export type RuleFixConfiguration_for_NoFocusedTestsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoFocusedTestsOptions; +export type RuleConfiguration_for_NoFunctionAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoFunctionAssignOptions; +export type RuleConfiguration_for_NoGlobalAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoGlobalAssignOptions; +export type RuleFixConfiguration_for_NoGlobalIsFiniteOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoGlobalIsFiniteOptions; +export type RuleFixConfiguration_for_NoGlobalIsNanOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoGlobalIsNanOptions; +export type RuleConfiguration_for_NoHeadImportInDocumentOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoHeadImportInDocumentOptions; +export type RuleConfiguration_for_NoImplicitAnyLetOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoImplicitAnyLetOptions; +export type RuleConfiguration_for_NoImportAssignOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoImportAssignOptions; +export type RuleConfiguration_for_NoImportantInKeyframeOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoImportantInKeyframeOptions; +export type RuleConfiguration_for_NoIrregularWhitespaceOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoIrregularWhitespaceOptions; +export type RuleConfiguration_for_NoLabelVarOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoLabelVarOptions; +export type RuleFixConfiguration_for_NoMisleadingCharacterClassOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoMisleadingCharacterClassOptions; +export type RuleConfiguration_for_NoMisleadingInstantiatorOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoMisleadingInstantiatorOptions; +export type RuleConfiguration_for_NoMisplacedAssertionOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoMisplacedAssertionOptions; +export type RuleFixConfiguration_for_NoMisrefactoredShorthandAssignOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoMisrefactoredShorthandAssignOptions; +export type RuleFixConfiguration_for_NoOctalEscapeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoOctalEscapeOptions; +export type RuleFixConfiguration_for_NoPrototypeBuiltinsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoPrototypeBuiltinsOptions; +export type RuleFixConfiguration_for_NoReactSpecificPropsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoReactSpecificPropsOptions; +export type RuleConfiguration_for_NoRedeclareOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoRedeclareOptions; +export type RuleFixConfiguration_for_NoRedundantUseStrictOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoRedundantUseStrictOptions; +export type RuleConfiguration_for_NoSelfCompareOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoSelfCompareOptions; +export type RuleConfiguration_for_NoShadowRestrictedNamesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoShadowRestrictedNamesOptions; +export type RuleConfiguration_for_NoShorthandPropertyOverridesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoShorthandPropertyOverridesOptions; +export type RuleFixConfiguration_for_NoSkippedTestsOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoSkippedTestsOptions; +export type RuleFixConfiguration_for_NoSparseArrayOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoSparseArrayOptions; +export type RuleConfiguration_for_NoSuspiciousSemicolonInJsxOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoSuspiciousSemicolonInJsxOptions; +export type RuleConfiguration_for_NoTemplateCurlyInStringOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoTemplateCurlyInStringOptions; +export type RuleConfiguration_for_NoThenPropertyOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoThenPropertyOptions; +export type RuleConfiguration_for_NoUnsafeDeclarationMergingOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoUnsafeDeclarationMergingOptions; +export type RuleFixConfiguration_for_NoUnsafeNegationOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoUnsafeNegationOptions; +export type RuleFixConfiguration_for_NoVarOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_NoVarOptions; +export type RuleConfiguration_for_NoWithOptions = + | RulePlainConfiguration + | RuleWithOptions_for_NoWithOptions; +export type RuleConfiguration_for_UseAdjacentOverloadSignaturesOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAdjacentOverloadSignaturesOptions; +export type RuleConfiguration_for_UseAwaitOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseAwaitOptions; +export type RuleConfiguration_for_UseDefaultSwitchClauseLastOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseDefaultSwitchClauseLastOptions; +export type RuleConfiguration_for_UseErrorMessageOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseErrorMessageOptions; +export type RuleConfiguration_for_UseGetterReturnOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseGetterReturnOptions; +export type RuleConfiguration_for_UseGoogleFontDisplayOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseGoogleFontDisplayOptions; +export type RuleConfiguration_for_UseGuardForInOptions = + | RulePlainConfiguration + | RuleWithOptions_for_UseGuardForInOptions; +export type RuleFixConfiguration_for_UseIsArrayOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseIsArrayOptions; +export type RuleFixConfiguration_for_UseNamespaceKeywordOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNamespaceKeywordOptions; +export type RuleFixConfiguration_for_UseNumberToFixedDigitsArgumentOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseNumberToFixedDigitsArgumentOptions; +export type RuleFixConfiguration_for_UseStrictModeOptions = + | RulePlainConfiguration + | RuleWithFixOptions_for_UseStrictModeOptions; +export interface OrganizeImportsOptions { + groups?: ImportGroups; +} +export interface UseSortedAttributesOptions {} +export interface UseSortedKeysOptions {} +export interface UseSortedPropertiesOptions {} +export type RulePlainConfiguration = "off" | "on" | "info" | "warn" | "error"; +export interface RuleWithFixOptions_for_NoAccessKeyOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAccessKeyOptions; +} +export interface RuleWithFixOptions_for_NoAriaHiddenOnFocusableOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAriaHiddenOnFocusableOptions; +} +export interface RuleWithFixOptions_for_NoAriaUnsupportedElementsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAriaUnsupportedElementsOptions; +} +export interface RuleWithFixOptions_for_NoAutofocusOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAutofocusOptions; +} +export interface RuleWithFixOptions_for_NoDistractingElementsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDistractingElementsOptions; +} +export interface RuleWithFixOptions_for_NoHeaderScopeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoHeaderScopeOptions; +} +export interface RuleWithFixOptions_for_NoInteractiveElementToNoninteractiveRoleOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInteractiveElementToNoninteractiveRoleOptions; +} +export interface RuleWithOptions_for_NoLabelWithoutControlOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoLabelWithoutControlOptions; +} +export interface RuleWithFixOptions_for_NoNoninteractiveElementToInteractiveRoleOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNoninteractiveElementToInteractiveRoleOptions; +} +export interface RuleWithFixOptions_for_NoNoninteractiveTabindexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNoninteractiveTabindexOptions; +} +export interface RuleWithFixOptions_for_NoPositiveTabindexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoPositiveTabindexOptions; +} +export interface RuleWithOptions_for_NoRedundantAltOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRedundantAltOptions; +} +export interface RuleWithFixOptions_for_NoRedundantRolesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRedundantRolesOptions; +} +export interface RuleWithOptions_for_NoStaticElementInteractionsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoStaticElementInteractionsOptions; +} +export interface RuleWithOptions_for_NoSvgWithoutTitleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSvgWithoutTitleOptions; +} +export interface RuleWithOptions_for_UseAltTextOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAltTextOptions; +} +export interface RuleWithFixOptions_for_UseAnchorContentOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAnchorContentOptions; +} +export interface RuleWithFixOptions_for_UseAriaActivedescendantWithTabindexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAriaActivedescendantWithTabindexOptions; +} +export interface RuleWithOptions_for_UseAriaPropsForRoleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAriaPropsForRoleOptions; +} +export interface RuleWithOptions_for_UseAriaPropsSupportedByRoleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAriaPropsSupportedByRoleOptions; +} +export interface RuleWithOptions_for_UseButtonTypeOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseButtonTypeOptions; +} +export interface RuleWithOptions_for_UseFocusableInteractiveOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseFocusableInteractiveOptions; +} +export interface RuleWithOptions_for_UseGenericFontNamesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseGenericFontNamesOptions; +} +export interface RuleWithOptions_for_UseHeadingContentOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseHeadingContentOptions; +} +export interface RuleWithOptions_for_UseHtmlLangOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseHtmlLangOptions; +} +export interface RuleWithOptions_for_UseIframeTitleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseIframeTitleOptions; +} +export interface RuleWithOptions_for_UseKeyWithClickEventsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseKeyWithClickEventsOptions; +} +export interface RuleWithOptions_for_UseKeyWithMouseEventsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseKeyWithMouseEventsOptions; +} +export interface RuleWithOptions_for_UseMediaCaptionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseMediaCaptionOptions; +} +export interface RuleWithOptions_for_UseSemanticElementsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSemanticElementsOptions; +} +export interface RuleWithOptions_for_UseValidAnchorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidAnchorOptions; +} +export interface RuleWithFixOptions_for_UseValidAriaPropsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidAriaPropsOptions; +} +export interface RuleWithFixOptions_for_UseValidAriaRoleOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidAriaRoleOptions; +} +export interface RuleWithOptions_for_UseValidAriaValuesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidAriaValuesOptions; +} +export interface RuleWithOptions_for_UseValidAutocompleteOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidAutocompleteOptions; +} +export interface RuleWithOptions_for_UseValidLangOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidLangOptions; +} +export interface RuleWithFixOptions_for_NoAdjacentSpacesInRegexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAdjacentSpacesInRegexOptions; +} +export interface RuleWithOptions_for_NoArgumentsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoArgumentsOptions; +} +export interface RuleWithFixOptions_for_NoBannedTypesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoBannedTypesOptions; +} +export interface RuleWithOptions_for_NoCommaOperatorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoCommaOperatorOptions; +} +export interface RuleWithOptions_for_NoEmptyTypeParametersOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyTypeParametersOptions; +} +export interface RuleWithOptions_for_NoExcessiveCognitiveComplexityOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExcessiveCognitiveComplexityOptions; +} +export interface RuleWithOptions_for_NoExcessiveNestedTestSuitesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExcessiveNestedTestSuitesOptions; +} +export interface RuleWithFixOptions_for_NoExtraBooleanCastOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExtraBooleanCastOptions; +} +export interface RuleWithFixOptions_for_NoFlatMapIdentityOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoFlatMapIdentityOptions; +} +export interface RuleWithOptions_for_NoForEachOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoForEachOptions; +} +export interface RuleWithOptions_for_NoStaticOnlyClassOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoStaticOnlyClassOptions; +} +export interface RuleWithFixOptions_for_NoThisInStaticOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoThisInStaticOptions; +} +export interface RuleWithFixOptions_for_NoUselessCatchOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessCatchOptions; +} +export interface RuleWithFixOptions_for_NoUselessConstructorOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessConstructorOptions; +} +export interface RuleWithFixOptions_for_NoUselessContinueOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessContinueOptions; +} +export interface RuleWithFixOptions_for_NoUselessEmptyExportOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessEmptyExportOptions; +} +export interface RuleWithFixOptions_for_NoUselessEscapeInRegexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessEscapeInRegexOptions; +} +export interface RuleWithFixOptions_for_NoUselessFragmentsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessFragmentsOptions; +} +export interface RuleWithFixOptions_for_NoUselessLabelOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessLabelOptions; +} +export interface RuleWithFixOptions_for_NoUselessLoneBlockStatementsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessLoneBlockStatementsOptions; +} +export interface RuleWithFixOptions_for_NoUselessRenameOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessRenameOptions; +} +export interface RuleWithFixOptions_for_NoUselessStringConcatOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessStringConcatOptions; +} +export interface RuleWithOptions_for_NoUselessStringRawOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessStringRawOptions; +} +export interface RuleWithFixOptions_for_NoUselessSwitchCaseOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessSwitchCaseOptions; +} +export interface RuleWithFixOptions_for_NoUselessTernaryOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessTernaryOptions; +} +export interface RuleWithFixOptions_for_NoUselessThisAliasOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessThisAliasOptions; +} +export interface RuleWithFixOptions_for_NoUselessTypeConstraintOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessTypeConstraintOptions; +} +export interface RuleWithFixOptions_for_NoUselessUndefinedInitializationOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessUndefinedInitializationOptions; +} +export interface RuleWithOptions_for_NoVoidOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoVoidOptions; +} +export interface RuleWithFixOptions_for_UseArrowFunctionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseArrowFunctionOptions; +} +export interface RuleWithFixOptions_for_UseDateNowOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseDateNowOptions; +} +export interface RuleWithFixOptions_for_UseFlatMapOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseFlatMapOptions; +} +export interface RuleWithFixOptions_for_UseLiteralKeysOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseLiteralKeysOptions; +} +export interface RuleWithFixOptions_for_UseNumericLiteralsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNumericLiteralsOptions; +} +export interface RuleWithFixOptions_for_UseOptionalChainOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseOptionalChainOptions; +} +export interface RuleWithFixOptions_for_UseRegexLiteralsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseRegexLiteralsOptions; +} +export interface RuleWithFixOptions_for_UseSimpleNumberKeysOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSimpleNumberKeysOptions; +} +export interface RuleWithFixOptions_for_UseSimplifiedLogicExpressionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSimplifiedLogicExpressionOptions; +} +export interface RuleWithFixOptions_for_UseWhileOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseWhileOptions; +} +export interface RuleWithOptions_for_NoChildrenPropOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoChildrenPropOptions; +} +export interface RuleWithFixOptions_for_NoConstAssignOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstAssignOptions; +} +export interface RuleWithOptions_for_NoConstantConditionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstantConditionOptions; +} +export interface RuleWithFixOptions_for_NoConstantMathMinMaxClampOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstantMathMinMaxClampOptions; +} +export interface RuleWithOptions_for_NoConstructorReturnOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstructorReturnOptions; +} +export interface RuleWithOptions_for_NoEmptyCharacterClassInRegexOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyCharacterClassInRegexOptions; +} +export interface RuleWithOptions_for_NoEmptyPatternOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyPatternOptions; +} +export interface RuleWithOptions_for_NoGlobalObjectCallsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoGlobalObjectCallsOptions; +} +export interface RuleWithOptions_for_NoInnerDeclarationsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInnerDeclarationsOptions; +} +export interface RuleWithFixOptions_for_NoInvalidBuiltinInstantiationOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidBuiltinInstantiationOptions; +} +export interface RuleWithOptions_for_NoInvalidConstructorSuperOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidConstructorSuperOptions; +} +export interface RuleWithOptions_for_NoInvalidDirectionInLinearGradientOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidDirectionInLinearGradientOptions; +} +export interface RuleWithOptions_for_NoInvalidGridAreasOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidGridAreasOptions; +} +export interface RuleWithOptions_for_NoInvalidPositionAtImportRuleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidPositionAtImportRuleOptions; +} +export interface RuleWithOptions_for_NoInvalidUseBeforeDeclarationOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInvalidUseBeforeDeclarationOptions; +} +export interface RuleWithOptions_for_NoMissingVarFunctionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoMissingVarFunctionOptions; +} +export interface RuleWithOptions_for_NoNodejsModulesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNodejsModulesOptions; +} +export interface RuleWithFixOptions_for_NoNonoctalDecimalEscapeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNonoctalDecimalEscapeOptions; +} +export interface RuleWithOptions_for_NoPrecisionLossOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoPrecisionLossOptions; +} +export interface RuleWithOptions_for_NoPrivateImportsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoPrivateImportsOptions; +} +export interface RuleWithOptions_for_NoRenderReturnValueOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRenderReturnValueOptions; +} +export interface RuleWithOptions_for_NoSelfAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSelfAssignOptions; +} +export interface RuleWithOptions_for_NoSetterReturnOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSetterReturnOptions; +} +export interface RuleWithFixOptions_for_NoStringCaseMismatchOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoStringCaseMismatchOptions; +} +export interface RuleWithFixOptions_for_NoSwitchDeclarationsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSwitchDeclarationsOptions; +} +export interface RuleWithOptions_for_NoUndeclaredDependenciesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUndeclaredDependenciesOptions; +} +export interface RuleWithOptions_for_NoUndeclaredVariablesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUndeclaredVariablesOptions; +} +export interface RuleWithOptions_for_NoUnknownFunctionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownFunctionOptions; +} +export interface RuleWithOptions_for_NoUnknownMediaFeatureNameOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownMediaFeatureNameOptions; +} +export interface RuleWithOptions_for_NoUnknownPropertyOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownPropertyOptions; +} +export interface RuleWithOptions_for_NoUnknownPseudoClassOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownPseudoClassOptions; +} +export interface RuleWithOptions_for_NoUnknownPseudoElementOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownPseudoElementOptions; +} +export interface RuleWithOptions_for_NoUnknownTypeSelectorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownTypeSelectorOptions; +} +export interface RuleWithOptions_for_NoUnknownUnitOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownUnitOptions; +} +export interface RuleWithOptions_for_NoUnmatchableAnbSelectorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnmatchableAnbSelectorOptions; +} +export interface RuleWithOptions_for_NoUnreachableOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnreachableOptions; +} +export interface RuleWithOptions_for_NoUnreachableSuperOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnreachableSuperOptions; +} +export interface RuleWithOptions_for_NoUnsafeFinallyOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnsafeFinallyOptions; +} +export interface RuleWithOptions_for_NoUnsafeOptionalChainingOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnsafeOptionalChainingOptions; +} +export interface RuleWithFixOptions_for_NoUnusedFunctionParametersOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedFunctionParametersOptions; +} +export interface RuleWithFixOptions_for_NoUnusedImportsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedImportsOptions; +} +export interface RuleWithFixOptions_for_NoUnusedLabelsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedLabelsOptions; +} +export interface RuleWithFixOptions_for_NoUnusedPrivateClassMembersOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedPrivateClassMembersOptions; +} +export interface RuleWithFixOptions_for_NoUnusedVariablesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedVariablesOptions; +} +export interface RuleWithFixOptions_for_NoVoidElementsWithChildrenOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoVoidElementsWithChildrenOptions; +} +export interface RuleWithOptions_for_NoVoidTypeReturnOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoVoidTypeReturnOptions; +} +export interface RuleWithFixOptions_for_UseExhaustiveDependenciesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExhaustiveDependenciesOptions; +} +export interface RuleWithOptions_for_UseHookAtTopLevelOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseHookAtTopLevelOptions; +} +export interface RuleWithFixOptions_for_UseImportExtensionsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseImportExtensionsOptions; +} +export interface RuleWithFixOptions_for_UseIsNanOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseIsNanOptions; +} +export interface RuleWithOptions_for_UseJsxKeyInIterableOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseJsxKeyInIterableOptions; +} +export interface RuleWithOptions_for_UseValidForDirectionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidForDirectionOptions; +} +export interface RuleWithFixOptions_for_UseValidTypeofOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseValidTypeofOptions; +} +export interface RuleWithOptions_for_UseYieldOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseYieldOptions; +} +export interface RuleWithOptions_for_NoAwaitInLoopOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAwaitInLoopOptions; +} +export interface RuleWithOptions_for_NoBitwiseOperatorsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoBitwiseOperatorsOptions; +} +export interface RuleWithOptions_for_NoConstantBinaryExpressionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstantBinaryExpressionOptions; +} +export interface RuleWithOptions_for_NoDestructuredPropsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDestructuredPropsOptions; +} +export interface RuleWithOptions_for_NoExcessiveLinesPerFunctionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExcessiveLinesPerFunctionOptions; +} +export interface RuleWithFixOptions_for_NoFloatingPromisesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoFloatingPromisesOptions; +} +export interface RuleWithFixOptions_for_NoGlobalDirnameFilenameOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoGlobalDirnameFilenameOptions; +} +export interface RuleWithFixOptions_for_NoImplicitCoercionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoImplicitCoercionOptions; +} +export interface RuleWithOptions_for_NoImportCyclesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoImportCyclesOptions; +} +export interface RuleWithFixOptions_for_NoImportantStylesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoImportantStylesOptions; +} +export interface RuleWithOptions_for_NoMagicNumbersOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoMagicNumbersOptions; +} +export interface RuleWithOptions_for_NoNestedComponentDefinitionsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNestedComponentDefinitionsOptions; +} +export interface RuleWithOptions_for_NoNoninteractiveElementInteractionsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNoninteractiveElementInteractionsOptions; +} +export interface RuleWithFixOptions_for_NoProcessGlobalOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoProcessGlobalOptions; +} +export interface RuleWithOptions_for_NoReactPropAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoReactPropAssignOptions; +} +export interface RuleWithOptions_for_NoRestrictedElementsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRestrictedElementsOptions; +} +export interface RuleWithOptions_for_NoSecretsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSecretsOptions; +} +export interface RuleWithOptions_for_NoShadowOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoShadowOptions; +} +export interface RuleWithFixOptions_for_NoTsIgnoreOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoTsIgnoreOptions; +} +export interface RuleWithOptions_for_NoUnassignedVariablesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnassignedVariablesOptions; +} +export interface RuleWithOptions_for_NoUnknownAtRuleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnknownAtRuleOptions; +} +export interface RuleWithOptions_for_NoUnresolvedImportsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnresolvedImportsOptions; +} +export interface RuleWithOptions_for_NoUnwantedPolyfillioOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnwantedPolyfillioOptions; +} +export interface RuleWithOptions_for_NoUselessBackrefInRegexOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessBackrefInRegexOptions; +} +export interface RuleWithFixOptions_for_NoUselessEscapeInStringOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessEscapeInStringOptions; +} +export interface RuleWithFixOptions_for_NoUselessUndefinedOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessUndefinedOptions; +} +export interface RuleWithOptions_for_UseAdjacentGetterSetterOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAdjacentGetterSetterOptions; +} +export interface RuleWithFixOptions_for_UseConsistentObjectDefinitionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentObjectDefinitionOptions; +} +export interface RuleWithFixOptions_for_UseConsistentResponseOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentResponseOptions; +} +export interface RuleWithFixOptions_for_UseExhaustiveSwitchCasesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExhaustiveSwitchCasesOptions; +} +export interface RuleWithOptions_for_UseExplicitTypeOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExplicitTypeOptions; +} +export interface RuleWithOptions_for_UseExportsLastOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExportsLastOptions; +} +export interface RuleWithOptions_for_UseForComponentOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseForComponentOptions; +} +export interface RuleWithFixOptions_for_UseGoogleFontPreconnectOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseGoogleFontPreconnectOptions; +} +export interface RuleWithFixOptions_for_UseIndexOfOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseIndexOfOptions; +} +export interface RuleWithOptions_for_UseIterableCallbackReturnOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseIterableCallbackReturnOptions; +} +export interface RuleWithFixOptions_for_UseJsonImportAttributeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseJsonImportAttributeOptions; +} +export interface RuleWithFixOptions_for_UseNamedOperationOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNamedOperationOptions; +} +export interface RuleWithOptions_for_UseNamingConventionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNamingConventionOptions; +} +export interface RuleWithFixOptions_for_UseNumericSeparatorsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNumericSeparatorsOptions; +} +export interface RuleWithFixOptions_for_UseObjectSpreadOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseObjectSpreadOptions; +} +export interface RuleWithFixOptions_for_UseParseIntRadixOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseParseIntRadixOptions; +} +export interface RuleWithFixOptions_for_UseReadonlyClassPropertiesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseReadonlyClassPropertiesOptions; +} +export interface RuleWithFixOptions_for_UseSingleJsDocAsteriskOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSingleJsDocAsteriskOptions; +} +export interface RuleWithFixOptions_for_UseSortedClassesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSortedClassesOptions; +} +export interface RuleWithOptions_for_UseSymbolDescriptionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSymbolDescriptionOptions; +} +export interface RuleWithFixOptions_for_UseUnifiedTypeSignatureOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseUnifiedTypeSignatureOptions; +} +export interface RuleWithOptions_for_UseUniqueElementIdsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseUniqueElementIdsOptions; +} +export interface RuleWithOptions_for_NoAccumulatingSpreadOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAccumulatingSpreadOptions; +} +export interface RuleWithOptions_for_NoBarrelFileOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoBarrelFileOptions; +} +export interface RuleWithFixOptions_for_NoDeleteOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDeleteOptions; +} +export interface RuleWithOptions_for_NoDynamicNamespaceImportAccessOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDynamicNamespaceImportAccessOptions; +} +export interface RuleWithOptions_for_NoImgElementOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoImgElementOptions; +} +export interface RuleWithOptions_for_NoNamespaceImportOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNamespaceImportOptions; +} +export interface RuleWithOptions_for_NoReExportAllOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoReExportAllOptions; +} +export interface RuleWithOptions_for_UseTopLevelRegexOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseTopLevelRegexOptions; +} +export interface RuleWithFixOptions_for_NoBlankTargetOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoBlankTargetOptions; +} +export interface RuleWithOptions_for_NoDangerouslySetInnerHtmlOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDangerouslySetInnerHtmlOptions; +} +export interface RuleWithOptions_for_NoDangerouslySetInnerHtmlWithChildrenOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDangerouslySetInnerHtmlWithChildrenOptions; +} +export interface RuleWithOptions_for_NoGlobalEvalOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoGlobalEvalOptions; +} +export interface RuleWithOptions_for_NoCommonJsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoCommonJsOptions; +} +export interface RuleWithOptions_for_NoDefaultExportOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDefaultExportOptions; +} +export interface RuleWithOptions_for_NoDescendingSpecificityOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDescendingSpecificityOptions; +} +export interface RuleWithOptions_for_NoDoneCallbackOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDoneCallbackOptions; +} +export interface RuleWithOptions_for_NoEnumOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEnumOptions; +} +export interface RuleWithOptions_for_NoExportedImportsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExportedImportsOptions; +} +export interface RuleWithOptions_for_NoHeadElementOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoHeadElementOptions; +} +export interface RuleWithFixOptions_for_NoImplicitBooleanOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoImplicitBooleanOptions; +} +export interface RuleWithFixOptions_for_NoInferrableTypesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoInferrableTypesOptions; +} +export interface RuleWithOptions_for_NoNamespaceOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNamespaceOptions; +} +export interface RuleWithFixOptions_for_NoNegationElseOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNegationElseOptions; +} +export interface RuleWithOptions_for_NoNestedTernaryOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNestedTernaryOptions; +} +export interface RuleWithFixOptions_for_NoNonNullAssertionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoNonNullAssertionOptions; +} +export interface RuleWithOptions_for_NoParameterAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoParameterAssignOptions; +} +export interface RuleWithOptions_for_NoParameterPropertiesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoParameterPropertiesOptions; +} +export interface RuleWithOptions_for_NoProcessEnvOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoProcessEnvOptions; +} +export interface RuleWithOptions_for_NoRestrictedGlobalsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRestrictedGlobalsOptions; +} +export interface RuleWithOptions_for_NoRestrictedImportsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRestrictedImportsOptions; +} +export interface RuleWithFixOptions_for_NoRestrictedTypesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoRestrictedTypesOptions; +} +export interface RuleWithFixOptions_for_NoShoutyConstantsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoShoutyConstantsOptions; +} +export interface RuleWithFixOptions_for_NoSubstrOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoSubstrOptions; +} +export interface RuleWithFixOptions_for_NoUnusedTemplateLiteralOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUnusedTemplateLiteralOptions; +} +export interface RuleWithFixOptions_for_NoUselessElseOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoUselessElseOptions; +} +export interface RuleWithOptions_for_NoValueAtRuleOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoValueAtRuleOptions; +} +export interface RuleWithFixOptions_for_NoYodaExpressionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoYodaExpressionOptions; +} +export interface RuleWithFixOptions_for_UseArrayLiteralsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseArrayLiteralsOptions; +} +export interface RuleWithFixOptions_for_UseAsConstAssertionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAsConstAssertionOptions; +} +export interface RuleWithFixOptions_for_UseAtIndexOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseAtIndexOptions; +} +export interface RuleWithFixOptions_for_UseBlockStatementsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseBlockStatementsOptions; +} +export interface RuleWithFixOptions_for_UseCollapsedElseIfOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseCollapsedElseIfOptions; +} +export interface RuleWithFixOptions_for_UseCollapsedIfOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseCollapsedIfOptions; +} +export interface RuleWithOptions_for_UseComponentExportOnlyModulesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseComponentExportOnlyModulesOptions; +} +export interface RuleWithFixOptions_for_UseConsistentArrayTypeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentArrayTypeOptions; +} +export interface RuleWithFixOptions_for_UseConsistentBuiltinInstantiationOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentBuiltinInstantiationOptions; +} +export interface RuleWithFixOptions_for_UseConsistentCurlyBracesOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentCurlyBracesOptions; +} +export interface RuleWithOptions_for_UseConsistentMemberAccessibilityOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConsistentMemberAccessibilityOptions; +} +export interface RuleWithFixOptions_for_UseConstOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseConstOptions; +} +export interface RuleWithFixOptions_for_UseDefaultParameterLastOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseDefaultParameterLastOptions; +} +export interface RuleWithOptions_for_UseDefaultSwitchClauseOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseDefaultSwitchClauseOptions; +} +export interface RuleWithOptions_for_UseDeprecatedReasonOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseDeprecatedReasonOptions; +} +export interface RuleWithFixOptions_for_UseEnumInitializersOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseEnumInitializersOptions; +} +export interface RuleWithFixOptions_for_UseExplicitLengthCheckOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExplicitLengthCheckOptions; +} +export interface RuleWithFixOptions_for_UseExponentiationOperatorOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExponentiationOperatorOptions; +} +export interface RuleWithFixOptions_for_UseExportTypeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseExportTypeOptions; +} +export interface RuleWithOptions_for_UseFilenamingConventionOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseFilenamingConventionOptions; +} +export interface RuleWithOptions_for_UseForOfOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseForOfOptions; +} +export interface RuleWithFixOptions_for_UseFragmentSyntaxOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseFragmentSyntaxOptions; +} +export interface RuleWithFixOptions_for_UseImportTypeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseImportTypeOptions; +} +export interface RuleWithOptions_for_UseLiteralEnumMembersOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseLiteralEnumMembersOptions; +} +export interface RuleWithFixOptions_for_UseNamingConventionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNamingConventionOptions; +} +export interface RuleWithFixOptions_for_UseNodeAssertStrictOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNodeAssertStrictOptions; +} +export interface RuleWithFixOptions_for_UseNodejsImportProtocolOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNodejsImportProtocolOptions; +} +export interface RuleWithFixOptions_for_UseNumberNamespaceOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseNumberNamespaceOptions; +} +export interface RuleWithFixOptions_for_UseSelfClosingElementsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSelfClosingElementsOptions; +} +export interface RuleWithFixOptions_for_UseShorthandAssignOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseShorthandAssignOptions; +} +export interface RuleWithFixOptions_for_UseShorthandFunctionTypeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseShorthandFunctionTypeOptions; +} +export interface RuleWithFixOptions_for_UseSingleVarDeclaratorOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseSingleVarDeclaratorOptions; +} +export interface RuleWithFixOptions_for_UseTemplateOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseTemplateOptions; +} +export interface RuleWithFixOptions_for_UseThrowNewErrorOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseThrowNewErrorOptions; +} +export interface RuleWithOptions_for_UseThrowOnlyErrorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseThrowOnlyErrorOptions; +} +export interface RuleWithFixOptions_for_UseTrimStartEndOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseTrimStartEndOptions; +} +export interface RuleWithOptions_for_NoAlertOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAlertOptions; +} +export interface RuleWithFixOptions_for_NoApproximativeNumericConstantOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoApproximativeNumericConstantOptions; +} +export interface RuleWithOptions_for_NoArrayIndexKeyOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoArrayIndexKeyOptions; +} +export interface RuleWithOptions_for_NoAssignInExpressionsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAssignInExpressionsOptions; +} +export interface RuleWithOptions_for_NoAsyncPromiseExecutorOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoAsyncPromiseExecutorOptions; +} +export interface RuleWithOptions_for_NoCatchAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoCatchAssignOptions; +} +export interface RuleWithOptions_for_NoClassAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoClassAssignOptions; +} +export interface RuleWithFixOptions_for_NoCommentTextOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoCommentTextOptions; +} +export interface RuleWithFixOptions_for_NoCompareNegZeroOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoCompareNegZeroOptions; +} +export interface RuleWithOptions_for_NoConfusingLabelsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConfusingLabelsOptions; +} +export interface RuleWithFixOptions_for_NoConfusingVoidTypeOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConfusingVoidTypeOptions; +} +export interface RuleWithFixOptions_for_NoConsoleOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConsoleOptions; +} +export interface RuleWithFixOptions_for_NoConstEnumOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoConstEnumOptions; +} +export interface RuleWithOptions_for_NoControlCharactersInRegexOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoControlCharactersInRegexOptions; +} +export interface RuleWithFixOptions_for_NoDebuggerOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDebuggerOptions; +} +export interface RuleWithOptions_for_NoDocumentCookieOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDocumentCookieOptions; +} +export interface RuleWithOptions_for_NoDocumentImportInPageOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDocumentImportInPageOptions; +} +export interface RuleWithFixOptions_for_NoDoubleEqualsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDoubleEqualsOptions; +} +export interface RuleWithOptions_for_NoDuplicateAtImportRulesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateAtImportRulesOptions; +} +export interface RuleWithOptions_for_NoDuplicateCaseOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateCaseOptions; +} +export interface RuleWithOptions_for_NoDuplicateClassMembersOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateClassMembersOptions; +} +export interface RuleWithOptions_for_NoDuplicateCustomPropertiesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateCustomPropertiesOptions; +} +export interface RuleWithOptions_for_NoDuplicateElseIfOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateElseIfOptions; +} +export interface RuleWithOptions_for_NoDuplicateFieldsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateFieldsOptions; +} +export interface RuleWithOptions_for_NoDuplicateFontNamesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateFontNamesOptions; +} +export interface RuleWithOptions_for_NoDuplicateJsxPropsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateJsxPropsOptions; +} +export interface RuleWithOptions_for_NoDuplicateObjectKeysOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateObjectKeysOptions; +} +export interface RuleWithOptions_for_NoDuplicateParametersOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateParametersOptions; +} +export interface RuleWithOptions_for_NoDuplicatePropertiesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicatePropertiesOptions; +} +export interface RuleWithOptions_for_NoDuplicateSelectorsKeyframeBlockOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateSelectorsKeyframeBlockOptions; +} +export interface RuleWithOptions_for_NoDuplicateTestHooksOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoDuplicateTestHooksOptions; +} +export interface RuleWithOptions_for_NoEmptyBlockOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyBlockOptions; +} +export interface RuleWithOptions_for_NoEmptyBlockStatementsOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyBlockStatementsOptions; +} +export interface RuleWithFixOptions_for_NoEmptyInterfaceOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEmptyInterfaceOptions; +} +export interface RuleWithOptions_for_NoEvolvingTypesOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoEvolvingTypesOptions; +} +export interface RuleWithOptions_for_NoExplicitAnyOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExplicitAnyOptions; +} +export interface RuleWithOptions_for_NoExportsInTestOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExportsInTestOptions; +} +export interface RuleWithFixOptions_for_NoExtraNonNullAssertionOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoExtraNonNullAssertionOptions; +} +export interface RuleWithOptions_for_NoFallthroughSwitchClauseOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2543,9 +6865,13 @@ export interface RuleWithFixOptions_for_Null { /** * Rule's options */ - options: null; + options: NoFallthroughSwitchClauseOptions; } -export interface RuleWithOptions_for_NoLabelWithoutControlOptions { +export interface RuleWithFixOptions_for_NoFocusedTestsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2553,9 +6879,19 @@ export interface RuleWithOptions_for_NoLabelWithoutControlOptions { /** * Rule's options */ - options: NoLabelWithoutControlOptions; + options: NoFocusedTestsOptions; +} +export interface RuleWithOptions_for_NoFunctionAssignOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoFunctionAssignOptions; } -export interface RuleWithOptions_for_Null { +export interface RuleWithOptions_for_NoGlobalAssignOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2563,9 +6899,9 @@ export interface RuleWithOptions_for_Null { /** * Rule's options */ - options: null; + options: NoGlobalAssignOptions; } -export interface RuleWithFixOptions_for_ValidAriaRoleOptions { +export interface RuleWithFixOptions_for_NoGlobalIsFiniteOptions { /** * The kind of the code actions emitted by the rule */ @@ -2577,9 +6913,13 @@ export interface RuleWithFixOptions_for_ValidAriaRoleOptions { /** * Rule's options */ - options: ValidAriaRoleOptions; + options: NoGlobalIsFiniteOptions; } -export interface RuleWithOptions_for_UseValidAutocompleteOptions { +export interface RuleWithFixOptions_for_NoGlobalIsNanOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2587,9 +6927,9 @@ export interface RuleWithOptions_for_UseValidAutocompleteOptions { /** * Rule's options */ - options: UseValidAutocompleteOptions; + options: NoGlobalIsNanOptions; } -export interface RuleWithOptions_for_ComplexityOptions { +export interface RuleWithOptions_for_NoHeadImportInDocumentOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2597,9 +6937,9 @@ export interface RuleWithOptions_for_ComplexityOptions { /** * Rule's options */ - options: ComplexityOptions; + options: NoHeadImportInDocumentOptions; } -export interface RuleWithOptions_for_NoForEachOptions { +export interface RuleWithOptions_for_NoImplicitAnyLetOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2607,9 +6947,9 @@ export interface RuleWithOptions_for_NoForEachOptions { /** * Rule's options */ - options: NoForEachOptions; + options: NoImplicitAnyLetOptions; } -export interface RuleWithOptions_for_NoPrivateImportsOptions { +export interface RuleWithOptions_for_NoImportAssignOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2617,9 +6957,9 @@ export interface RuleWithOptions_for_NoPrivateImportsOptions { /** * Rule's options */ - options: NoPrivateImportsOptions; + options: NoImportAssignOptions; } -export interface RuleWithOptions_for_NoUndeclaredDependenciesOptions { +export interface RuleWithOptions_for_NoImportantInKeyframeOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2627,9 +6967,9 @@ export interface RuleWithOptions_for_NoUndeclaredDependenciesOptions { /** * Rule's options */ - options: NoUndeclaredDependenciesOptions; + options: NoImportantInKeyframeOptions; } -export interface RuleWithOptions_for_UndeclaredVariablesOptions { +export interface RuleWithOptions_for_NoIrregularWhitespaceOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2637,9 +6977,19 @@ export interface RuleWithOptions_for_UndeclaredVariablesOptions { /** * Rule's options */ - options: UndeclaredVariablesOptions; + options: NoIrregularWhitespaceOptions; } -export interface RuleWithFixOptions_for_NoUnusedVariablesOptions { +export interface RuleWithOptions_for_NoLabelVarOptions { + /** + * The severity of the emitted diagnostics by the rule + */ + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoLabelVarOptions; +} +export interface RuleWithFixOptions_for_NoMisleadingCharacterClassOptions { /** * The kind of the code actions emitted by the rule */ @@ -2651,13 +7001,19 @@ export interface RuleWithFixOptions_for_NoUnusedVariablesOptions { /** * Rule's options */ - options: NoUnusedVariablesOptions; + options: NoMisleadingCharacterClassOptions; } -export interface RuleWithFixOptions_for_UseExhaustiveDependenciesOptions { +export interface RuleWithOptions_for_NoMisleadingInstantiatorOptions { /** - * The kind of the code actions emitted by the rule + * The severity of the emitted diagnostics by the rule */ - fix?: FixKind; + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoMisleadingInstantiatorOptions; +} +export interface RuleWithOptions_for_NoMisplacedAssertionOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2665,9 +7021,13 @@ export interface RuleWithFixOptions_for_UseExhaustiveDependenciesOptions { /** * Rule's options */ - options: UseExhaustiveDependenciesOptions; + options: NoMisplacedAssertionOptions; } -export interface RuleWithOptions_for_DeprecatedHooksOptions { +export interface RuleWithFixOptions_for_NoMisrefactoredShorthandAssignOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2675,9 +7035,9 @@ export interface RuleWithOptions_for_DeprecatedHooksOptions { /** * Rule's options */ - options: DeprecatedHooksOptions; + options: NoMisrefactoredShorthandAssignOptions; } -export interface RuleWithFixOptions_for_UseImportExtensionsOptions { +export interface RuleWithFixOptions_for_NoOctalEscapeOptions { /** * The kind of the code actions emitted by the rule */ @@ -2689,9 +7049,13 @@ export interface RuleWithFixOptions_for_UseImportExtensionsOptions { /** * Rule's options */ - options: UseImportExtensionsOptions; + options: NoOctalEscapeOptions; } -export interface RuleWithOptions_for_UseJsxKeyInIterableOptions { +export interface RuleWithFixOptions_for_NoPrototypeBuiltinsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2699,9 +7063,13 @@ export interface RuleWithOptions_for_UseJsxKeyInIterableOptions { /** * Rule's options */ - options: UseJsxKeyInIterableOptions; + options: NoPrototypeBuiltinsOptions; } -export interface RuleWithOptions_for_NoBitwiseOperatorsOptions { +export interface RuleWithFixOptions_for_NoReactSpecificPropsOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2709,9 +7077,9 @@ export interface RuleWithOptions_for_NoBitwiseOperatorsOptions { /** * Rule's options */ - options: NoBitwiseOperatorsOptions; + options: NoReactSpecificPropsOptions; } -export interface RuleWithOptions_for_NoExcessiveLinesPerFunctionOptions { +export interface RuleWithOptions_for_NoRedeclareOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2719,9 +7087,13 @@ export interface RuleWithOptions_for_NoExcessiveLinesPerFunctionOptions { /** * Rule's options */ - options: NoExcessiveLinesPerFunctionOptions; + options: NoRedeclareOptions; } -export interface RuleWithOptions_for_NoRestrictedElementsOptions { +export interface RuleWithFixOptions_for_NoRedundantUseStrictOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2729,9 +7101,9 @@ export interface RuleWithOptions_for_NoRestrictedElementsOptions { /** * Rule's options */ - options: NoRestrictedElementsOptions; + options: NoRedundantUseStrictOptions; } -export interface RuleWithOptions_for_NoSecretsOptions { +export interface RuleWithOptions_for_NoSelfCompareOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2739,13 +7111,19 @@ export interface RuleWithOptions_for_NoSecretsOptions { /** * Rule's options */ - options: NoSecretsOptions; + options: NoSelfCompareOptions; } -export interface RuleWithFixOptions_for_UseConsistentObjectDefinitionOptions { +export interface RuleWithOptions_for_NoShadowRestrictedNamesOptions { /** - * The kind of the code actions emitted by the rule + * The severity of the emitted diagnostics by the rule */ - fix?: FixKind; + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoShadowRestrictedNamesOptions; +} +export interface RuleWithOptions_for_NoShorthandPropertyOverridesOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2753,9 +7131,9 @@ export interface RuleWithFixOptions_for_UseConsistentObjectDefinitionOptions { /** * Rule's options */ - options: UseConsistentObjectDefinitionOptions; + options: NoShorthandPropertyOverridesOptions; } -export interface RuleWithFixOptions_for_ReadonlyClassPropertiesOptions { +export interface RuleWithFixOptions_for_NoSkippedTestsOptions { /** * The kind of the code actions emitted by the rule */ @@ -2767,9 +7145,9 @@ export interface RuleWithFixOptions_for_ReadonlyClassPropertiesOptions { /** * Rule's options */ - options: ReadonlyClassPropertiesOptions; + options: NoSkippedTestsOptions; } -export interface RuleWithFixOptions_for_UtilityClassSortingOptions { +export interface RuleWithFixOptions_for_NoSparseArrayOptions { /** * The kind of the code actions emitted by the rule */ @@ -2781,13 +7159,9 @@ export interface RuleWithFixOptions_for_UtilityClassSortingOptions { /** * Rule's options */ - options: UtilityClassSortingOptions; + options: NoSparseArrayOptions; } -export interface RuleWithFixOptions_for_NoBlankTargetOptions { - /** - * The kind of the code actions emitted by the rule - */ - fix?: FixKind; +export interface RuleWithOptions_for_NoSuspiciousSemicolonInJsxOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2795,9 +7169,9 @@ export interface RuleWithFixOptions_for_NoBlankTargetOptions { /** * Rule's options */ - options: NoBlankTargetOptions; + options: NoSuspiciousSemicolonInJsxOptions; } -export interface RuleWithOptions_for_NoParameterAssignOptions { +export interface RuleWithOptions_for_NoTemplateCurlyInStringOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2805,9 +7179,9 @@ export interface RuleWithOptions_for_NoParameterAssignOptions { /** * Rule's options */ - options: NoParameterAssignOptions; + options: NoTemplateCurlyInStringOptions; } -export interface RuleWithOptions_for_RestrictedGlobalsOptions { +export interface RuleWithOptions_for_NoThenPropertyOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2815,9 +7189,9 @@ export interface RuleWithOptions_for_RestrictedGlobalsOptions { /** * Rule's options */ - options: RestrictedGlobalsOptions; + options: NoThenPropertyOptions; } -export interface RuleWithOptions_for_RestrictedImportsOptions { +export interface RuleWithOptions_for_NoUnsafeDeclarationMergingOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2825,9 +7199,9 @@ export interface RuleWithOptions_for_RestrictedImportsOptions { /** * Rule's options */ - options: RestrictedImportsOptions; + options: NoUnsafeDeclarationMergingOptions; } -export interface RuleWithFixOptions_for_NoRestrictedTypesOptions { +export interface RuleWithFixOptions_for_NoUnsafeNegationOptions { /** * The kind of the code actions emitted by the rule */ @@ -2839,9 +7213,13 @@ export interface RuleWithFixOptions_for_NoRestrictedTypesOptions { /** * Rule's options */ - options: NoRestrictedTypesOptions; + options: NoUnsafeNegationOptions; } -export interface RuleWithOptions_for_UseComponentExportOnlyModulesOptions { +export interface RuleWithFixOptions_for_NoVarOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2849,13 +7227,19 @@ export interface RuleWithOptions_for_UseComponentExportOnlyModulesOptions { /** * Rule's options */ - options: UseComponentExportOnlyModulesOptions; + options: NoVarOptions; } -export interface RuleWithFixOptions_for_ConsistentArrayTypeOptions { +export interface RuleWithOptions_for_NoWithOptions { /** - * The kind of the code actions emitted by the rule + * The severity of the emitted diagnostics by the rule */ - fix?: FixKind; + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: NoWithOptions; +} +export interface RuleWithOptions_for_UseAdjacentOverloadSignaturesOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2863,9 +7247,9 @@ export interface RuleWithFixOptions_for_ConsistentArrayTypeOptions { /** * Rule's options */ - options: ConsistentArrayTypeOptions; + options: UseAdjacentOverloadSignaturesOptions; } -export interface RuleWithOptions_for_ConsistentMemberAccessibilityOptions { +export interface RuleWithOptions_for_UseAwaitOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2873,9 +7257,9 @@ export interface RuleWithOptions_for_ConsistentMemberAccessibilityOptions { /** * Rule's options */ - options: ConsistentMemberAccessibilityOptions; + options: UseAwaitOptions; } -export interface RuleWithOptions_for_FilenamingConventionOptions { +export interface RuleWithOptions_for_UseDefaultSwitchClauseLastOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2883,13 +7267,19 @@ export interface RuleWithOptions_for_FilenamingConventionOptions { /** * Rule's options */ - options: FilenamingConventionOptions; + options: UseDefaultSwitchClauseLastOptions; } -export interface RuleWithFixOptions_for_ImportTypeOptions { +export interface RuleWithOptions_for_UseErrorMessageOptions { /** - * The kind of the code actions emitted by the rule + * The severity of the emitted diagnostics by the rule */ - fix?: FixKind; + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseErrorMessageOptions; +} +export interface RuleWithOptions_for_UseGetterReturnOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2897,13 +7287,19 @@ export interface RuleWithFixOptions_for_ImportTypeOptions { /** * Rule's options */ - options: ImportTypeOptions; + options: UseGetterReturnOptions; } -export interface RuleWithFixOptions_for_NamingConventionOptions { +export interface RuleWithOptions_for_UseGoogleFontDisplayOptions { /** - * The kind of the code actions emitted by the rule + * The severity of the emitted diagnostics by the rule */ - fix?: FixKind; + level: RulePlainConfiguration; + /** + * Rule's options + */ + options: UseGoogleFontDisplayOptions; +} +export interface RuleWithOptions_for_UseGuardForInOptions { /** * The severity of the emitted diagnostics by the rule */ @@ -2911,9 +7307,9 @@ export interface RuleWithFixOptions_for_NamingConventionOptions { /** * Rule's options */ - options: NamingConventionOptions; + options: UseGuardForInOptions; } -export interface RuleWithFixOptions_for_UseSelfClosingElementsOptions { +export interface RuleWithFixOptions_for_UseIsArrayOptions { /** * The kind of the code actions emitted by the rule */ @@ -2925,9 +7321,13 @@ export interface RuleWithFixOptions_for_UseSelfClosingElementsOptions { /** * Rule's options */ - options: UseSelfClosingElementsOptions; + options: UseIsArrayOptions; } -export interface RuleWithOptions_for_NoConfusingLabelsOptions { +export interface RuleWithFixOptions_for_UseNamespaceKeywordOptions { + /** + * The kind of the code actions emitted by the rule + */ + fix?: FixKind; /** * The severity of the emitted diagnostics by the rule */ @@ -2935,9 +7335,9 @@ export interface RuleWithOptions_for_NoConfusingLabelsOptions { /** * Rule's options */ - options: NoConfusingLabelsOptions; + options: UseNamespaceKeywordOptions; } -export interface RuleWithFixOptions_for_NoConsoleOptions { +export interface RuleWithFixOptions_for_UseNumberToFixedDigitsArgumentOptions { /** * The kind of the code actions emitted by the rule */ @@ -2949,9 +7349,9 @@ export interface RuleWithFixOptions_for_NoConsoleOptions { /** * Rule's options */ - options: NoConsoleOptions; + options: UseNumberToFixedDigitsArgumentOptions; } -export interface RuleWithFixOptions_for_NoDoubleEqualsOptions { +export interface RuleWithFixOptions_for_UseStrictModeOptions { /** * The kind of the code actions emitted by the rule */ @@ -2963,13 +7363,20 @@ export interface RuleWithFixOptions_for_NoDoubleEqualsOptions { /** * Rule's options */ - options: NoDoubleEqualsOptions; + options: UseStrictModeOptions; } export type ImportGroups = ImportGroup[]; /** * Used to identify the kind of code action emitted by a rule */ export type FixKind = "none" | "safe" | "unsafe"; +export interface NoAccessKeyOptions {} +export interface NoAriaHiddenOnFocusableOptions {} +export interface NoAriaUnsupportedElementsOptions {} +export interface NoAutofocusOptions {} +export interface NoDistractingElementsOptions {} +export interface NoHeaderScopeOptions {} +export interface NoInteractiveElementToNoninteractiveRoleOptions {} export interface NoLabelWithoutControlOptions { /** * Array of component names that should be considered the same as an `input` element. @@ -2984,34 +7391,116 @@ export interface NoLabelWithoutControlOptions { */ labelComponents?: string[]; } -export interface ValidAriaRoleOptions { +export interface NoNoninteractiveElementToInteractiveRoleOptions {} +export interface NoNoninteractiveTabindexOptions {} +export interface NoPositiveTabindexOptions {} +export interface NoRedundantAltOptions {} +export interface NoRedundantRolesOptions {} +export interface NoStaticElementInteractionsOptions {} +export interface NoSvgWithoutTitleOptions {} +export interface UseAltTextOptions {} +export interface UseAnchorContentOptions {} +export interface UseAriaActivedescendantWithTabindexOptions {} +export interface UseAriaPropsForRoleOptions {} +export interface UseAriaPropsSupportedByRoleOptions {} +export interface UseButtonTypeOptions {} +export interface UseFocusableInteractiveOptions {} +export interface UseGenericFontNamesOptions {} +export interface UseHeadingContentOptions {} +export interface UseHtmlLangOptions {} +export interface UseIframeTitleOptions {} +export interface UseKeyWithClickEventsOptions {} +export interface UseKeyWithMouseEventsOptions {} +export interface UseMediaCaptionOptions {} +export interface UseSemanticElementsOptions {} +export interface UseValidAnchorOptions {} +export interface UseValidAriaPropsOptions {} +export interface UseValidAriaRoleOptions { + /** + * It allows specifying a list of roles that might be invalid otherwise + */ allowInvalidRoles?: string[]; + /** + * Use this option to ignore non-DOM elements, such as custom components + */ ignoreNonDom?: boolean; } +export interface UseValidAriaValuesOptions {} export interface UseValidAutocompleteOptions { /** * `input` like custom components that should be checked. */ inputComponents?: string[]; } -/** - * Options for the rule `noExcessiveCognitiveComplexity`. - */ -export interface ComplexityOptions { +export interface UseValidLangOptions {} +export interface NoAdjacentSpacesInRegexOptions {} +export interface NoArgumentsOptions {} +export interface NoBannedTypesOptions {} +export interface NoCommaOperatorOptions {} +export interface NoEmptyTypeParametersOptions {} +export interface NoExcessiveCognitiveComplexityOptions { /** * The maximum complexity score that we allow. Anything higher is considered excessive. */ maxAllowedComplexity?: number; } +export interface NoExcessiveNestedTestSuitesOptions {} +export interface NoExtraBooleanCastOptions {} +export interface NoFlatMapIdentityOptions {} export interface NoForEachOptions { /** * A list of variable names allowed for `forEach` calls. */ - allowedIdentifiers: string[]; -} -/** - * Options for the rule `noPrivateImports`. - */ + allowedIdentifiers?: string[]; +} +export interface NoStaticOnlyClassOptions {} +export interface NoThisInStaticOptions {} +export interface NoUselessCatchOptions {} +export interface NoUselessConstructorOptions {} +export interface NoUselessContinueOptions {} +export interface NoUselessEmptyExportOptions {} +export interface NoUselessEscapeInRegexOptions {} +export interface NoUselessFragmentsOptions {} +export interface NoUselessLabelOptions {} +export interface NoUselessLoneBlockStatementsOptions {} +export interface NoUselessRenameOptions {} +export interface NoUselessStringConcatOptions {} +export interface NoUselessStringRawOptions {} +export interface NoUselessSwitchCaseOptions {} +export interface NoUselessTernaryOptions {} +export interface NoUselessThisAliasOptions {} +export interface NoUselessTypeConstraintOptions {} +export interface NoUselessUndefinedInitializationOptions {} +export interface NoVoidOptions {} +export interface UseArrowFunctionOptions {} +export interface UseDateNowOptions {} +export interface UseFlatMapOptions {} +export interface UseLiteralKeysOptions {} +export interface UseNumericLiteralsOptions {} +export interface UseOptionalChainOptions {} +export interface UseRegexLiteralsOptions {} +export interface UseSimpleNumberKeysOptions {} +export interface UseSimplifiedLogicExpressionOptions {} +export interface UseWhileOptions {} +export interface NoChildrenPropOptions {} +export interface NoConstAssignOptions {} +export interface NoConstantConditionOptions {} +export interface NoConstantMathMinMaxClampOptions {} +export interface NoConstructorReturnOptions {} +export interface NoEmptyCharacterClassInRegexOptions {} +export interface NoEmptyPatternOptions {} +export interface NoGlobalObjectCallsOptions {} +export interface NoInnerDeclarationsOptions {} +export interface NoInvalidBuiltinInstantiationOptions {} +export interface NoInvalidConstructorSuperOptions {} +export interface NoInvalidDirectionInLinearGradientOptions {} +export interface NoInvalidGridAreasOptions {} +export interface NoInvalidPositionAtImportRuleOptions {} +export interface NoInvalidUseBeforeDeclarationOptions {} +export interface NoMissingVarFunctionOptions {} +export interface NoNodejsModulesOptions {} +export interface NoNonoctalDecimalEscapeOptions {} +export interface NoPrecisionLossOptions {} export interface NoPrivateImportsOptions { /** * The default visibility to assume for symbols without visibility tag. @@ -3020,9 +7509,11 @@ Default: **public**. */ defaultVisibility?: Visibility; } -/** - * Rule's options - */ +export interface NoRenderReturnValueOptions {} +export interface NoSelfAssignOptions {} +export interface NoSetterReturnOptions {} +export interface NoStringCaseMismatchOptions {} +export interface NoSwitchDeclarationsOptions {} export interface NoUndeclaredDependenciesOptions { /** * If set to `false`, then the rule will show an error when `devDependencies` are imported. Defaults to `true`. @@ -3037,21 +7528,36 @@ export interface NoUndeclaredDependenciesOptions { */ peerDependencies?: DependencyAvailability; } -export interface UndeclaredVariablesOptions { +export interface NoUndeclaredVariablesOptions { /** * Check undeclared types. */ checkTypes?: boolean; } +export interface NoUnknownFunctionOptions {} +export interface NoUnknownMediaFeatureNameOptions {} +export interface NoUnknownPropertyOptions {} +export interface NoUnknownPseudoClassOptions {} +export interface NoUnknownPseudoElementOptions {} +export interface NoUnknownTypeSelectorOptions {} +export interface NoUnknownUnitOptions {} +export interface NoUnmatchableAnbSelectorOptions {} +export interface NoUnreachableOptions {} +export interface NoUnreachableSuperOptions {} +export interface NoUnsafeFinallyOptions {} +export interface NoUnsafeOptionalChainingOptions {} +export interface NoUnusedFunctionParametersOptions {} +export interface NoUnusedImportsOptions {} +export interface NoUnusedLabelsOptions {} +export interface NoUnusedPrivateClassMembersOptions {} export interface NoUnusedVariablesOptions { /** * Whether to ignore unused variables from an object destructuring with a spread. */ ignoreRestSiblings?: boolean; } -/** - * Options for the rule `useExhaustiveDependencies` - */ +export interface NoVoidElementsWithChildrenOptions {} +export interface NoVoidTypeReturnOptions {} export interface UseExhaustiveDependenciesOptions { /** * List of hooks of which the dependencies should be validated. @@ -3066,31 +7572,32 @@ export interface UseExhaustiveDependenciesOptions { */ reportUnnecessaryDependencies?: boolean; } -/** - * 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 {} +export interface UseHookAtTopLevelOptions {} export interface UseImportExtensionsOptions { /** * If `true`, the suggested extension is always `.js` regardless of what extension the source file has in your project. */ forceJsExtensions?: boolean; } +export interface UseIsNanOptions {} export interface UseJsxKeyInIterableOptions { /** * Set to `true` to check shorthand fragments (`<>`) */ checkShorthandFragments?: boolean; } -/** - * Rule's options - */ +export interface UseValidForDirectionOptions {} +export interface UseValidTypeofOptions {} +export interface UseYieldOptions {} +export interface NoAwaitInLoopOptions {} export interface NoBitwiseOperatorsOptions { /** * Allows a list of bitwise operators to be used as exceptions. */ allow: string[]; } +export interface NoConstantBinaryExpressionOptions {} +export interface NoDestructuredPropsOptions {} export interface NoExcessiveLinesPerFunctionOptions { /** * The maximum number of lines allowed in a function body. @@ -3105,34 +7612,77 @@ export interface NoExcessiveLinesPerFunctionOptions { */ skipIifes?: boolean; } +export interface NoFloatingPromisesOptions {} +export interface NoGlobalDirnameFilenameOptions {} +export interface NoImplicitCoercionOptions {} +export interface NoImportCyclesOptions {} +export interface NoImportantStylesOptions {} +export interface NoMagicNumbersOptions {} +export interface NoNestedComponentDefinitionsOptions {} +export interface NoNoninteractiveElementInteractionsOptions {} +export interface NoProcessGlobalOptions {} +export interface NoReactPropAssignOptions {} export interface NoRestrictedElementsOptions { /** * Elements to restrict. Each key is the element name, and the value is the message to show when the element is used. */ elements: CustomRestrictedElements; } -export interface NoSecretsOptions { - /** - * Set entropy threshold (default is 41). - */ - entropyThreshold?: number; -} +export interface NoSecretsOptions {} +export interface NoShadowOptions {} +export interface NoTsIgnoreOptions {} +export interface NoUnassignedVariablesOptions {} +export interface NoUnknownAtRuleOptions {} +export interface NoUnresolvedImportsOptions {} +export interface NoUnwantedPolyfillioOptions {} +export interface NoUselessBackrefInRegexOptions {} +export interface NoUselessEscapeInStringOptions {} +export interface NoUselessUndefinedOptions {} +export interface UseAdjacentGetterSetterOptions {} export interface UseConsistentObjectDefinitionOptions { /** * The preferred syntax to enforce. */ syntax?: ObjectPropertySyntax; } +export interface UseConsistentResponseOptions {} +export interface UseExhaustiveSwitchCasesOptions {} +export interface UseExplicitTypeOptions {} +export interface UseExportsLastOptions {} +export interface UseForComponentOptions {} +export interface UseGoogleFontPreconnectOptions {} +export interface UseIndexOfOptions {} +export interface UseIterableCallbackReturnOptions {} +export interface UseJsonImportAttributeOptions {} +export interface UseNamedOperationOptions {} /** - * Rule's options + * Rule's options. */ -export interface ReadonlyClassPropertiesOptions { +export interface UseNamingConventionOptions { + /** + * Custom conventions. + */ + conventions: Convention[]; + /** + * 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; +} +export interface UseNumericSeparatorsOptions {} +export interface UseObjectSpreadOptions {} +export interface UseParseIntRadixOptions {} +export interface UseReadonlyClassPropertiesOptions { /** * When `true`, the keywords `public`, `protected`, and `private` are analyzed by the rule. */ checkAllProperties: boolean; } -export interface UtilityClassSortingOptions { +export interface UseSingleJsDocAsteriskOptions {} +export interface UseSortedClassesOptions { /** * Additional attributes that will be sorted. */ @@ -3142,6 +7692,17 @@ export interface UtilityClassSortingOptions { */ functions?: string[]; } +export interface UseSymbolDescriptionOptions {} +export interface UseUnifiedTypeSignatureOptions {} +export interface UseUniqueElementIdsOptions {} +export interface NoAccumulatingSpreadOptions {} +export interface NoBarrelFileOptions {} +export interface NoDeleteOptions {} +export interface NoDynamicNamespaceImportAccessOptions {} +export interface NoImgElementOptions {} +export interface NoNamespaceImportOptions {} +export interface NoReExportAllOptions {} +export interface UseTopLevelRegexOptions {} export interface NoBlankTargetOptions { /** * List of domains where `target="_blank"` is allowed without `rel="noopener"`. @@ -3152,28 +7713,37 @@ export interface NoBlankTargetOptions { */ allowNoReferrer?: boolean; } -/** - * Options for the rule `NoParameterAssign` - */ +export interface NoDangerouslySetInnerHtmlOptions {} +export interface NoDangerouslySetInnerHtmlWithChildrenOptions {} +export interface NoGlobalEvalOptions {} +export interface NoCommonJsOptions {} +export interface NoDefaultExportOptions {} +export interface NoDescendingSpecificityOptions {} +export interface NoDoneCallbackOptions {} +export interface NoEnumOptions {} +export interface NoExportedImportsOptions {} +export interface NoHeadElementOptions {} +export interface NoImplicitBooleanOptions {} +export interface NoInferrableTypesOptions {} +export interface NoNamespaceOptions {} +export interface NoNegationElseOptions {} +export interface NoNestedTernaryOptions {} +export interface NoNonNullAssertionOptions {} export interface NoParameterAssignOptions { /** * Whether to report an error when a dependency is listed in the dependencies array but isn't used. Defaults to `allow`. */ propertyAssignment?: PropertyAssignmentMode; } -/** - * Options for the rule `noRestrictedGlobals`. - */ -export interface RestrictedGlobalsOptions { +export interface NoParameterPropertiesOptions {} +export interface NoProcessEnvOptions {} +export interface NoRestrictedGlobalsOptions { /** * A list of names that should trigger the rule */ deniedGlobals: Record; } -/** - * Options for the rule `noRestrictedImports`. - */ -export interface RestrictedImportsOptions { +export interface NoRestrictedImportsOptions { /** * A list of import paths that should trigger the rule. */ @@ -3182,6 +7752,18 @@ export interface RestrictedImportsOptions { export interface NoRestrictedTypesOptions { types?: Record; } +export interface NoShoutyConstantsOptions {} +export interface NoSubstrOptions {} +export interface NoUnusedTemplateLiteralOptions {} +export interface NoUselessElseOptions {} +export interface NoValueAtRuleOptions {} +export interface NoYodaExpressionOptions {} +export interface UseArrayLiteralsOptions {} +export interface UseAsConstAssertionOptions {} +export interface UseAtIndexOptions {} +export interface UseBlockStatementsOptions {} +export interface UseCollapsedElseIfOptions {} +export interface UseCollapsedIfOptions {} export interface UseComponentExportOnlyModulesOptions { /** * Allows the export of constants. This option is for environments that support it, such as [Vite](https://vitejs.dev/) @@ -3192,16 +7774,26 @@ export interface UseComponentExportOnlyModulesOptions { */ allowExportNames: string[]; } -export interface ConsistentArrayTypeOptions { +export interface UseConsistentArrayTypeOptions { syntax?: ConsistentArrayType; } -export interface ConsistentMemberAccessibilityOptions { +export interface UseConsistentBuiltinInstantiationOptions {} +export interface UseConsistentCurlyBracesOptions {} +export interface UseConsistentMemberAccessibilityOptions { + /** + * The kind of accessibility you want to enforce. Default to "noPublic" + */ accessibility?: Accessibility; } -/** - * Rule's options. - */ -export interface FilenamingConventionOptions { +export interface UseConstOptions {} +export interface UseDefaultParameterLastOptions {} +export interface UseDefaultSwitchClauseOptions {} +export interface UseDeprecatedReasonOptions {} +export interface UseEnumInitializersOptions {} +export interface UseExplicitLengthCheckOptions {} +export interface UseExponentiationOperatorOptions {} +export interface UseExportTypeOptions {} +export interface UseFilenamingConventionOptions { /** * Allowed cases for file names. */ @@ -3219,53 +7811,55 @@ export interface FilenamingConventionOptions { */ strictCase: boolean; } -/** - * Rule's options. - */ -export interface ImportTypeOptions { - style: Style2; -} -/** - * Rule's options. - */ -export interface NamingConventionOptions { +export interface UseForOfOptions {} +export interface UseFragmentSyntaxOptions {} +export interface UseImportTypeOptions { /** - * Custom conventions. - */ - conventions: Convention[]; - /** - * 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]. + * The style to apply when import types. Default to "auto" */ - strictCase: boolean; + style?: Style2; } -/** - * Options for the `useSelfClosingElements` rule. - */ +export interface UseLiteralEnumMembersOptions {} +export interface UseNodeAssertStrictOptions {} +export interface UseNodejsImportProtocolOptions {} +export interface UseNumberNamespaceOptions {} export interface UseSelfClosingElementsOptions { ignoreHtmlElements?: boolean; } -/** - * Options for the rule `noConfusingLabels` - */ +export interface UseShorthandAssignOptions {} +export interface UseShorthandFunctionTypeOptions {} +export interface UseSingleVarDeclaratorOptions {} +export interface UseTemplateOptions {} +export interface UseThrowNewErrorOptions {} +export interface UseThrowOnlyErrorOptions {} +export interface UseTrimStartEndOptions {} +export interface NoAlertOptions {} +export interface NoApproximativeNumericConstantOptions {} +export interface NoArrayIndexKeyOptions {} +export interface NoAssignInExpressionsOptions {} +export interface NoAsyncPromiseExecutorOptions {} +export interface NoCatchAssignOptions {} +export interface NoClassAssignOptions {} +export interface NoCommentTextOptions {} +export interface NoCompareNegZeroOptions {} export interface NoConfusingLabelsOptions { /** * A list of (non-confusing) labels that should be allowed */ allowedLabels: string[]; } +export interface NoConfusingVoidTypeOptions {} export interface NoConsoleOptions { /** * Allowed calls on the console object. */ allow: string[]; } -/** - * Rule's options - */ +export interface NoConstEnumOptions {} +export interface NoControlCharactersInRegexOptions {} +export interface NoDebuggerOptions {} +export interface NoDocumentCookieOptions {} +export interface NoDocumentImportInPageOptions {} export interface NoDoubleEqualsOptions { /** * If `true`, an exception is made when comparing with `null`, as it's often relied on to check both for `null` or `undefined`. @@ -3274,6 +7868,70 @@ If `false`, no such exception will be made. */ ignoreNull: boolean; } +export interface NoDuplicateAtImportRulesOptions {} +export interface NoDuplicateCaseOptions {} +export interface NoDuplicateClassMembersOptions {} +export interface NoDuplicateCustomPropertiesOptions {} +export interface NoDuplicateElseIfOptions {} +export interface NoDuplicateFieldsOptions {} +export interface NoDuplicateFontNamesOptions {} +export interface NoDuplicateJsxPropsOptions {} +export interface NoDuplicateObjectKeysOptions {} +export interface NoDuplicateParametersOptions {} +export interface NoDuplicatePropertiesOptions {} +export interface NoDuplicateSelectorsKeyframeBlockOptions {} +export interface NoDuplicateTestHooksOptions {} +export interface NoEmptyBlockOptions {} +export interface NoEmptyBlockStatementsOptions {} +export interface NoEmptyInterfaceOptions {} +export interface NoEvolvingTypesOptions {} +export interface NoExplicitAnyOptions {} +export interface NoExportsInTestOptions {} +export interface NoExtraNonNullAssertionOptions {} +export interface NoFallthroughSwitchClauseOptions {} +export interface NoFocusedTestsOptions {} +export interface NoFunctionAssignOptions {} +export interface NoGlobalAssignOptions {} +export interface NoGlobalIsFiniteOptions {} +export interface NoGlobalIsNanOptions {} +export interface NoHeadImportInDocumentOptions {} +export interface NoImplicitAnyLetOptions {} +export interface NoImportAssignOptions {} +export interface NoImportantInKeyframeOptions {} +export interface NoIrregularWhitespaceOptions {} +export interface NoLabelVarOptions {} +export interface NoMisleadingCharacterClassOptions {} +export interface NoMisleadingInstantiatorOptions {} +export interface NoMisplacedAssertionOptions {} +export interface NoMisrefactoredShorthandAssignOptions {} +export interface NoOctalEscapeOptions {} +export interface NoPrototypeBuiltinsOptions {} +export interface NoReactSpecificPropsOptions {} +export interface NoRedeclareOptions {} +export interface NoRedundantUseStrictOptions {} +export interface NoSelfCompareOptions {} +export interface NoShadowRestrictedNamesOptions {} +export interface NoShorthandPropertyOverridesOptions {} +export interface NoSkippedTestsOptions {} +export interface NoSparseArrayOptions {} +export interface NoSuspiciousSemicolonInJsxOptions {} +export interface NoTemplateCurlyInStringOptions {} +export interface NoThenPropertyOptions {} +export interface NoUnsafeDeclarationMergingOptions {} +export interface NoUnsafeNegationOptions {} +export interface NoVarOptions {} +export interface NoWithOptions {} +export interface UseAdjacentOverloadSignaturesOptions {} +export interface UseAwaitOptions {} +export interface UseDefaultSwitchClauseLastOptions {} +export interface UseErrorMessageOptions {} +export interface UseGetterReturnOptions {} +export interface UseGoogleFontDisplayOptions {} +export interface UseGuardForInOptions {} +export interface UseIsArrayOptions {} +export interface UseNamespaceKeywordOptions {} +export interface UseNumberToFixedDigitsArgumentOptions {} +export interface UseStrictModeOptions {} export type ImportGroup = null | GroupMatcher | GroupMatcher[]; export type Visibility = "public" | "package" | "private"; export type DependencyAvailability = boolean | string[]; @@ -3305,6 +7963,20 @@ For example, for React's `useRef()` hook the value would be `true`, while for `u } export type CustomRestrictedElements = Record; export type ObjectPropertySyntax = "explicit" | "shorthand"; +export interface Convention { + /** + * String cases to enforce + */ + formats: Formats; + /** + * Regular expression to enforce + */ + match?: Regex; + /** + * Declarations concerned by this convention + */ + selector: Selector; +} /** * Specifies whether property assignments on function parameters are allowed or denied. */ @@ -3319,22 +7991,23 @@ export type Regex = string; * Rule's options. */ export type Style2 = "auto" | "inlineType" | "separatedType"; -export interface Convention { +export type GroupMatcher = ImportMatcher | SourceMatcher; +export type StableHookResult = boolean | number[]; +export type Formats = Format[]; +export interface Selector { /** - * String cases to enforce + * Declaration kind */ - formats: Formats; + kind: Kind; /** - * Regular expression to enforce + * Modifiers used on the declaration */ - match?: Regex; + modifiers: Modifiers; /** - * Declarations concerned by this convention + * Scope of the declaration */ - selector: Selector; + scope: Scope; } -export type GroupMatcher = ImportMatcher | SourceMatcher; -export type StableHookResult = boolean | number[]; export interface CustomRestrictedImportOptions { /** * Names of the exported members that allowed to be not be used. @@ -3362,21 +8035,6 @@ export type FilenameCase = | "kebab-case" | "PascalCase" | "snake_case"; -export type Formats = Format[]; -export interface Selector { - /** - * Declaration kind - */ - kind: Kind; - /** - * Modifiers used on the declaration - */ - modifiers: Modifiers; - /** - * Scope of the declaration - */ - scope: Scope; -} export interface ImportMatcher { source?: SourcesMatcher; type?: boolean; diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json index 80e8154a7e58..bc63958645c7 100644 --- a/packages/@biomejs/biome/configuration_schema.json +++ b/packages/@biomejs/biome/configuration_schema.json @@ -108,49 +108,51 @@ "noAccessKey": { "description": "Enforce that the accessKey attribute is not used on any HTML element.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoAccessKeyConfiguration" }, { "type": "null" } ] }, "noAriaHiddenOnFocusable": { "description": "Enforce that aria-hidden=\"true\" is not set on focusable elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoAriaHiddenOnFocusableConfiguration" }, { "type": "null" } ] }, "noAriaUnsupportedElements": { "description": "Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoAriaUnsupportedElementsConfiguration" }, { "type": "null" } ] }, "noAutofocus": { "description": "Enforce that autoFocus prop is not used on elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoAutofocusConfiguration" }, { "type": "null" } ] }, "noDistractingElements": { "description": "Enforces that no distracting elements are used.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoDistractingElementsConfiguration" }, { "type": "null" } ] }, "noHeaderScope": { "description": "The scope prop should be used only on \\ elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoHeaderScopeConfiguration" }, { "type": "null" } ] }, "noInteractiveElementToNoninteractiveRole": { "description": "Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoInteractiveElementToNoninteractiveRoleConfiguration" + }, { "type": "null" } ] }, @@ -164,49 +166,53 @@ "noNoninteractiveElementToInteractiveRole": { "description": "Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoNoninteractiveElementToInteractiveRoleConfiguration" + }, { "type": "null" } ] }, "noNoninteractiveTabindex": { "description": "Enforce that tabIndex is not assigned to non-interactive HTML elements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoNoninteractiveTabindexConfiguration" }, { "type": "null" } ] }, "noPositiveTabindex": { "description": "Prevent the usage of positive integers on tabIndex property", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoPositiveTabindexConfiguration" }, { "type": "null" } ] }, "noRedundantAlt": { "description": "Enforce img alt prop does not contain the word \"image\", \"picture\", or \"photo\".", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoRedundantAltConfiguration" }, { "type": "null" } ] }, "noRedundantRoles": { "description": "Enforce explicit role property is not the same as implicit/default role property on an element.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoRedundantRolesConfiguration" }, { "type": "null" } ] }, "noStaticElementInteractions": { "description": "Enforce that static, visible elements (such as \\
) that have click handlers use the valid role attribute.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoStaticElementInteractionsConfiguration" + }, { "type": "null" } ] }, "noSvgWithoutTitle": { "description": "Enforces the usage of the title element for the svg element.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoSvgWithoutTitleConfiguration" }, { "type": "null" } ] }, @@ -217,133 +223,137 @@ "useAltText": { "description": "Enforce that all elements that require alternative text have meaningful information to relay back to the end user.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseAltTextConfiguration" }, { "type": "null" } ] }, "useAnchorContent": { "description": "Enforce that anchors have content and that the content is accessible to screen readers.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseAnchorContentConfiguration" }, { "type": "null" } ] }, "useAriaActivedescendantWithTabindex": { "description": "Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/UseAriaActivedescendantWithTabindexConfiguration" + }, { "type": "null" } ] }, "useAriaPropsForRole": { "description": "Enforce that elements with ARIA roles must have all required ARIA attributes for that role.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseAriaPropsForRoleConfiguration" }, { "type": "null" } ] }, "useAriaPropsSupportedByRole": { "description": "Enforce that ARIA properties are valid for the roles that are supported by the element.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/UseAriaPropsSupportedByRoleConfiguration" + }, { "type": "null" } ] }, "useButtonType": { "description": "Enforces the usage of the attribute type for the element button", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseButtonTypeConfiguration" }, { "type": "null" } ] }, "useFocusableInteractive": { "description": "Elements with an interactive role and interaction handlers must be focusable.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseFocusableInteractiveConfiguration" }, { "type": "null" } ] }, "useGenericFontNames": { "description": "Disallow a missing generic family keyword within font families.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseGenericFontNamesConfiguration" }, { "type": "null" } ] }, "useHeadingContent": { "description": "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.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseHeadingContentConfiguration" }, { "type": "null" } ] }, "useHtmlLang": { "description": "Enforce that html element has lang attribute.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseHtmlLangConfiguration" }, { "type": "null" } ] }, "useIframeTitle": { "description": "Enforces the usage of the attribute title for the element iframe.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseIframeTitleConfiguration" }, { "type": "null" } ] }, "useKeyWithClickEvents": { "description": "Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseKeyWithClickEventsConfiguration" }, { "type": "null" } ] }, "useKeyWithMouseEvents": { "description": "Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseKeyWithMouseEventsConfiguration" }, { "type": "null" } ] }, "useMediaCaption": { "description": "Enforces that audio and video elements must have a track for captions.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseMediaCaptionConfiguration" }, { "type": "null" } ] }, "useSemanticElements": { "description": "It detects the use of role attributes in JSX elements and suggests using semantic elements instead.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseSemanticElementsConfiguration" }, { "type": "null" } ] }, "useValidAnchor": { "description": "Enforce that all anchors are valid, and they are navigable elements.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseValidAnchorConfiguration" }, { "type": "null" } ] }, "useValidAriaProps": { "description": "Ensures that ARIA properties aria-* are all valid.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseValidAriaPropsConfiguration" }, { "type": "null" } ] }, "useValidAriaRole": { "description": "Elements with ARIA roles must use a valid, non-abstract ARIA role.", "anyOf": [ - { "$ref": "#/definitions/ValidAriaRoleConfiguration" }, + { "$ref": "#/definitions/UseValidAriaRoleConfiguration" }, { "type": "null" } ] }, "useValidAriaValues": { "description": "Enforce that ARIA state and property values are valid.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseValidAriaValuesConfiguration" }, { "type": "null" } ] }, @@ -357,7 +367,7 @@ "useValidLang": { "description": "Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseValidLangConfiguration" }, { "type": "null" } ] } @@ -415,63 +425,67 @@ "noAdjacentSpacesInRegex": { "description": "Disallow unclear usage of consecutive space characters in regular expression literals", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoAdjacentSpacesInRegexConfiguration" }, { "type": "null" } ] }, "noArguments": { "description": "Disallow the use of arguments.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoArgumentsConfiguration" }, { "type": "null" } ] }, "noBannedTypes": { "description": "Disallow primitive type aliases and misleading types.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoBannedTypesConfiguration" }, { "type": "null" } ] }, "noCommaOperator": { "description": "Disallow comma operator.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoCommaOperatorConfiguration" }, { "type": "null" } ] }, "noEmptyTypeParameters": { "description": "Disallow empty type parameters in type aliases and interfaces.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoEmptyTypeParametersConfiguration" }, { "type": "null" } ] }, "noExcessiveCognitiveComplexity": { "description": "Disallow functions that exceed a given Cognitive Complexity score.", "anyOf": [ - { "$ref": "#/definitions/ComplexityConfiguration" }, + { + "$ref": "#/definitions/NoExcessiveCognitiveComplexityConfiguration" + }, { "type": "null" } ] }, "noExcessiveNestedTestSuites": { "description": "This rule enforces a maximum depth to nested describe() in test files.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoExcessiveNestedTestSuitesConfiguration" + }, { "type": "null" } ] }, "noExtraBooleanCast": { "description": "Disallow unnecessary boolean casts", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoExtraBooleanCastConfiguration" }, { "type": "null" } ] }, "noFlatMapIdentity": { "description": "Disallow to use unnecessary callback on flatMap.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoFlatMapIdentityConfiguration" }, { "type": "null" } ] }, @@ -485,133 +499,137 @@ "noStaticOnlyClass": { "description": "This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoStaticOnlyClassConfiguration" }, { "type": "null" } ] }, "noThisInStatic": { "description": "Disallow this and super in static contexts.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoThisInStaticConfiguration" }, { "type": "null" } ] }, "noUselessCatch": { "description": "Disallow unnecessary catch clauses.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessCatchConfiguration" }, { "type": "null" } ] }, "noUselessConstructor": { "description": "Disallow unnecessary constructors.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessConstructorConfiguration" }, { "type": "null" } ] }, "noUselessContinue": { "description": "Avoid using unnecessary continue.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessContinueConfiguration" }, { "type": "null" } ] }, "noUselessEmptyExport": { "description": "Disallow empty exports that don't change anything in a module file.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessEmptyExportConfiguration" }, { "type": "null" } ] }, "noUselessEscapeInRegex": { "description": "Disallow unnecessary escape sequence in regular expression literals.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessEscapeInRegexConfiguration" }, { "type": "null" } ] }, "noUselessFragments": { "description": "Disallow unnecessary fragments", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessFragmentsConfiguration" }, { "type": "null" } ] }, "noUselessLabel": { "description": "Disallow unnecessary labels.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessLabelConfiguration" }, { "type": "null" } ] }, "noUselessLoneBlockStatements": { "description": "Disallow unnecessary nested block statements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoUselessLoneBlockStatementsConfiguration" + }, { "type": "null" } ] }, "noUselessRename": { "description": "Disallow renaming import, export, and destructured assignments to the same name.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessRenameConfiguration" }, { "type": "null" } ] }, "noUselessStringConcat": { "description": "Disallow unnecessary concatenation of string or template literals.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessStringConcatConfiguration" }, { "type": "null" } ] }, "noUselessStringRaw": { "description": "Disallow unnecessary String.raw function in template string literals without any escape sequence.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUselessStringRawConfiguration" }, { "type": "null" } ] }, "noUselessSwitchCase": { "description": "Disallow useless case in switch statements.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessSwitchCaseConfiguration" }, { "type": "null" } ] }, "noUselessTernary": { "description": "Disallow ternary operators when simpler alternatives exist.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessTernaryConfiguration" }, { "type": "null" } ] }, "noUselessThisAlias": { "description": "Disallow useless this aliasing.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessThisAliasConfiguration" }, { "type": "null" } ] }, "noUselessTypeConstraint": { "description": "Disallow using any or unknown as type constraint.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUselessTypeConstraintConfiguration" }, { "type": "null" } ] }, "noUselessUndefinedInitialization": { "description": "Disallow initializing variables to undefined.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoUselessUndefinedInitializationConfiguration" + }, { "type": "null" } ] }, "noVoid": { "description": "Disallow the use of void operators, which is not a familiar operator.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoVoidConfiguration" }, { "type": "null" } ] }, @@ -622,96 +640,78 @@ "useArrowFunction": { "description": "Use arrow functions over function expressions.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseArrowFunctionConfiguration" }, { "type": "null" } ] }, "useDateNow": { "description": "Use Date.now() to get the number of milliseconds since the Unix Epoch.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseDateNowConfiguration" }, { "type": "null" } ] }, "useFlatMap": { "description": "Promotes the use of .flatMap() when map().flat() are used together.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseFlatMapConfiguration" }, { "type": "null" } ] }, "useLiteralKeys": { "description": "Enforce the usage of a literal access to properties over computed property access.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseLiteralKeysConfiguration" }, { "type": "null" } ] }, "useNumericLiterals": { "description": "Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseNumericLiteralsConfiguration" }, { "type": "null" } ] }, "useOptionalChain": { "description": "Enforce using concise optional chain instead of chained logical expressions.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseOptionalChainConfiguration" }, { "type": "null" } ] }, "useRegexLiterals": { "description": "Enforce the use of the regular expression literals instead of the RegExp constructor if possible.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseRegexLiteralsConfiguration" }, { "type": "null" } ] }, "useSimpleNumberKeys": { "description": "Disallow number literal object member names which are not base 10 or use underscore as separator.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseSimpleNumberKeysConfiguration" }, { "type": "null" } ] }, "useSimplifiedLogicExpression": { "description": "Discard redundant terms from logical expressions.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/UseSimplifiedLogicExpressionConfiguration" + }, { "type": "null" } ] }, "useWhile": { "description": "Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseWhileConfiguration" }, { "type": "null" } ] } }, "additionalProperties": false }, - "ComplexityConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithComplexityOptions" } - ] - }, - "ComplexityOptions": { - "description": "Options for the rule `noExcessiveCognitiveComplexity`.", - "type": "object", - "properties": { - "maxAllowedComplexity": { - "description": "The maximum complexity score that we allow. Anything higher is considered excessive.", - "default": 15, - "type": "integer", - "format": "uint8", - "minimum": 1.0 - } - }, - "additionalProperties": false - }, "ConsistentArrayType": { "oneOf": [ { @@ -726,38 +726,6 @@ } ] }, - "ConsistentArrayTypeConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithConsistentArrayTypeOptions" } - ] - }, - "ConsistentArrayTypeOptions": { - "type": "object", - "properties": { - "syntax": { - "default": "shorthand", - "allOf": [{ "$ref": "#/definitions/ConsistentArrayType" }] - } - }, - "additionalProperties": false - }, - "ConsistentMemberAccessibilityConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithConsistentMemberAccessibilityOptions" } - ] - }, - "ConsistentMemberAccessibilityOptions": { - "type": "object", - "properties": { - "accessibility": { - "default": "noPublic", - "allOf": [{ "$ref": "#/definitions/Accessibility" }] - } - }, - "additionalProperties": false - }, "Convention": { "type": "object", "properties": { @@ -783,133 +751,143 @@ "noChildrenProp": { "description": "Prevent passing of children as props.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoChildrenPropConfiguration" }, { "type": "null" } ] }, "noConstAssign": { "description": "Prevents from having const variables being re-assigned.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoConstAssignConfiguration" }, { "type": "null" } ] }, "noConstantCondition": { "description": "Disallow constant expressions in conditions", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoConstantConditionConfiguration" }, { "type": "null" } ] }, "noConstantMathMinMaxClamp": { "description": "Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoConstantMathMinMaxClampConfiguration" }, { "type": "null" } ] }, "noConstructorReturn": { "description": "Disallow returning a value from a constructor.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoConstructorReturnConfiguration" }, { "type": "null" } ] }, "noEmptyCharacterClassInRegex": { "description": "Disallow empty character classes in regular expression literals.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoEmptyCharacterClassInRegexConfiguration" + }, { "type": "null" } ] }, "noEmptyPattern": { "description": "Disallows empty destructuring patterns.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoEmptyPatternConfiguration" }, { "type": "null" } ] }, "noGlobalObjectCalls": { "description": "Disallow calling global object properties as functions", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoGlobalObjectCallsConfiguration" }, { "type": "null" } ] }, "noInnerDeclarations": { "description": "Disallow function and var declarations that are accessible outside their block.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoInnerDeclarationsConfiguration" }, { "type": "null" } ] }, "noInvalidBuiltinInstantiation": { "description": "Ensure that builtins are correctly instantiated.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoInvalidBuiltinInstantiationConfiguration" + }, { "type": "null" } ] }, "noInvalidConstructorSuper": { "description": "Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoInvalidConstructorSuperConfiguration" }, { "type": "null" } ] }, "noInvalidDirectionInLinearGradient": { "description": "Disallow non-standard direction values for linear gradient functions.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoInvalidDirectionInLinearGradientConfiguration" + }, { "type": "null" } ] }, "noInvalidGridAreas": { "description": "Disallows invalid named grid areas in CSS Grid Layouts.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoInvalidGridAreasConfiguration" }, { "type": "null" } ] }, "noInvalidPositionAtImportRule": { "description": "Disallow the use of @import at-rules in invalid positions.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoInvalidPositionAtImportRuleConfiguration" + }, { "type": "null" } ] }, "noInvalidUseBeforeDeclaration": { "description": "Disallow the use of variables and function parameters before their declaration", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { + "$ref": "#/definitions/NoInvalidUseBeforeDeclarationConfiguration" + }, { "type": "null" } ] }, "noMissingVarFunction": { "description": "Disallow missing var function for css variables.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoMissingVarFunctionConfiguration" }, { "type": "null" } ] }, "noNodejsModules": { "description": "Forbid the use of Node.js builtin modules.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoNodejsModulesConfiguration" }, { "type": "null" } ] }, "noNonoctalDecimalEscape": { "description": "Disallow \\8 and \\9 escape sequences in string literals.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoNonoctalDecimalEscapeConfiguration" }, { "type": "null" } ] }, "noPrecisionLoss": { "description": "Disallow literal numbers that lose precision", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoPrecisionLossConfiguration" }, { "type": "null" } ] }, @@ -923,35 +901,35 @@ "noRenderReturnValue": { "description": "Prevent the usage of the return value of React.render.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoRenderReturnValueConfiguration" }, { "type": "null" } ] }, "noSelfAssign": { "description": "Disallow assignments where both sides are exactly the same.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoSelfAssignConfiguration" }, { "type": "null" } ] }, "noSetterReturn": { "description": "Disallow returning a value from a setter", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoSetterReturnConfiguration" }, { "type": "null" } ] }, "noStringCaseMismatch": { "description": "Disallow comparison of expressions modifying the string case with non-compliant value.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoStringCaseMismatchConfiguration" }, { "type": "null" } ] }, "noSwitchDeclarations": { "description": "Disallow lexical declarations in switch clauses.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoSwitchDeclarationsConfiguration" }, { "type": "null" } ] }, @@ -965,119 +943,121 @@ "noUndeclaredVariables": { "description": "Prevents the usage of variables that haven't been declared inside the document.", "anyOf": [ - { "$ref": "#/definitions/UndeclaredVariablesConfiguration" }, + { "$ref": "#/definitions/NoUndeclaredVariablesConfiguration" }, { "type": "null" } ] }, "noUnknownFunction": { "description": "Disallow unknown CSS value functions.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownFunctionConfiguration" }, { "type": "null" } ] }, "noUnknownMediaFeatureName": { "description": "Disallow unknown media feature names.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownMediaFeatureNameConfiguration" }, { "type": "null" } ] }, "noUnknownProperty": { "description": "Disallow unknown properties.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownPropertyConfiguration" }, { "type": "null" } ] }, "noUnknownPseudoClass": { "description": "Disallow unknown pseudo-class selectors.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownPseudoClassConfiguration" }, { "type": "null" } ] }, "noUnknownPseudoElement": { "description": "Disallow unknown pseudo-element selectors.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownPseudoElementConfiguration" }, { "type": "null" } ] }, "noUnknownTypeSelector": { "description": "Disallow unknown type selectors.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownTypeSelectorConfiguration" }, { "type": "null" } ] }, "noUnknownUnit": { "description": "Disallow unknown CSS units.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnknownUnitConfiguration" }, { "type": "null" } ] }, "noUnmatchableAnbSelector": { "description": "Disallow unmatchable An+B selectors.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnmatchableAnbSelectorConfiguration" }, { "type": "null" } ] }, "noUnreachable": { "description": "Disallow unreachable code", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnreachableConfiguration" }, { "type": "null" } ] }, "noUnreachableSuper": { "description": "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", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnreachableSuperConfiguration" }, { "type": "null" } ] }, "noUnsafeFinally": { "description": "Disallow control flow statements in finally blocks.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnsafeFinallyConfiguration" }, { "type": "null" } ] }, "noUnsafeOptionalChaining": { "description": "Disallow the use of optional chaining in contexts where the undefined value is not allowed.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoUnsafeOptionalChainingConfiguration" }, { "type": "null" } ] }, "noUnusedFunctionParameters": { "description": "Disallow unused function parameters.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUnusedFunctionParametersConfiguration" }, { "type": "null" } ] }, "noUnusedImports": { "description": "Disallow unused imports.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUnusedImportsConfiguration" }, { "type": "null" } ] }, "noUnusedLabels": { "description": "Disallow unused labels.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoUnusedLabelsConfiguration" }, { "type": "null" } ] }, "noUnusedPrivateClassMembers": { "description": "Disallow unused private class members", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { + "$ref": "#/definitions/NoUnusedPrivateClassMembersConfiguration" + }, { "type": "null" } ] }, @@ -1091,14 +1071,14 @@ "noVoidElementsWithChildren": { "description": "This rules prevents void elements (AKA self-closing elements) from having children.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/NoVoidElementsWithChildrenConfiguration" }, { "type": "null" } ] }, "noVoidTypeReturn": { "description": "Disallow returning a value from a function with the return type 'void'", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/NoVoidTypeReturnConfiguration" }, { "type": "null" } ] }, @@ -1116,7 +1096,7 @@ "useHookAtTopLevel": { "description": "Enforce that all React hooks are being called from the Top Level component functions.", "anyOf": [ - { "$ref": "#/definitions/DeprecatedHooksConfiguration" }, + { "$ref": "#/definitions/UseHookAtTopLevelConfiguration" }, { "type": "null" } ] }, @@ -1130,7 +1110,7 @@ "useIsNan": { "description": "Require calls to isNaN() when checking for NaN.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseIsNanConfiguration" }, { "type": "null" } ] }, @@ -1144,21 +1124,21 @@ "useValidForDirection": { "description": "Enforce \"for\" loop update clause moving the counter in the right direction.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseValidForDirectionConfiguration" }, { "type": "null" } ] }, "useValidTypeof": { "description": "This rule checks that the result of a typeof expression is compared to a valid value.", "anyOf": [ - { "$ref": "#/definitions/RuleFixConfiguration" }, + { "$ref": "#/definitions/UseValidTypeofConfiguration" }, { "type": "null" } ] }, "useYield": { "description": "Require generator functions to contain yield.", "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, + { "$ref": "#/definitions/UseYieldConfiguration" }, { "type": "null" } ] } @@ -1345,17 +1325,6 @@ } ] }, - "DeprecatedHooksConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/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", - "additionalProperties": false - }, "Expand": { "oneOf": [ { @@ -1412,35 +1381,6 @@ "items": { "$ref": "#/definitions/FilenameCase" }, "uniqueItems": true }, - "FilenamingConventionConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithFilenamingConventionOptions" } - ] - }, - "FilenamingConventionOptions": { - "description": "Rule's options.", - "type": "object", - "properties": { - "filenameCases": { - "description": "Allowed cases for file names.", - "allOf": [{ "$ref": "#/definitions/FilenameCases" }] - }, - "match": { - "description": "Regular expression to enforce", - "anyOf": [{ "$ref": "#/definitions/Regex" }, { "type": "null" }] - }, - "requireAscii": { - "description": "If `false`, then non-ASCII characters are allowed.", - "type": "boolean" - }, - "strictCase": { - "description": "If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case].", - "type": "boolean" - } - }, - "additionalProperties": false - }, "FilesConfiguration": { "description": "The configuration of the filesystem", "type": "object", @@ -1913,19 +1853,6 @@ "description": "Glob to match against import sources.", "allOf": [{ "$ref": "#/definitions/Glob" }] }, - "ImportTypeConfiguration": { - "anyOf": [ - { "$ref": "#/definitions/RulePlainConfiguration" }, - { "$ref": "#/definitions/RuleWithImportTypeOptions" } - ] - }, - "ImportTypeOptions": { - "description": "Rule's options.", - "type": "object", - "required": ["style"], - "properties": { "style": { "$ref": "#/definitions/Style2" } }, - "additionalProperties": false - }, "IndentScriptAndStyle": { "description": "Whether to indent the content of `