diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9c30fb03f..cde026ee8cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -128,13 +128,17 @@ if no error diagnostics are emitted. - [`noDuplicateParameters`](https://docs.rome.tools/lint/rules/noduplicateparameters/): enhanced rule to manage constructor parameters. -#### BREAKING CHANGES +#### Removed rules -- Remove `lint/complexity/noExtraSemicolon` ([#4553](https://github.com/rome/tools/issues/4553)) +- Remove `complexity/noExtraSemicolon` ([#4553](https://github.com/rome/tools/issues/4553)) The _Rome_ formatter takes care of removing extra semicolons. Thus, there is no need for this rule. +- Remove `useCamelCase` + + Use [`useNamingConvention`](https://docs.rome.tools/lint/rules/useCamelCase/) instead. + #### New rules - Add [`noFallthroughSwitchClause`](https://docs.rome.tools/lint/rules/noFallthroughSwitchClause/) @@ -176,6 +180,25 @@ if no error diagnostics are emitted. This rule proposes using `Array.isArray()` instead of `instanceof Array`. +#### Promoted rules + +New rules are promoted, please check [#4750](https://github.com/rome/tools/discussions/4750) for more details: + +- [`a11y/useHeadingContent`](https://docs.rome.tools/lint/rules/useHeadingContent/) +- [`complexity/noForEach`](https://docs.rome.tools/lint/rules/noForEach/) +- [`complexity/useLiteralKeys`](https://docs.rome.tools/lint/rules/useLiteralKeys/) +- [`complexity/useSimpleNumberKeys`](https://docs.rome.tools/lint/rules/useSimpleNumberKeys/) +- [`correctness/useIsNan`](https://docs.rome.tools/lint/rules/useIsNan/) +- [`suspicious/noConsoleLog`](https://docs.rome.tools/lint/rules/noConsoleLog/) +- [`suspicious/noDuplicateJsxProps`](https://docs.rome.tools/lint/rules/noDuplicateJsxProps/) + +The following rules are now recommended: + +- [`noUselessFragments`](https://docs.rome.tools/lint/rules/noUselessFragments/) +- [`noRedundantUseStrict`](https://docs.rome.tools/lint/rules/noRedundantUseStrict/) +- [`useExponentiationOperator`](https://docs.rome.tools/lint/rules/useExponentiationOperator/) + + #### Other changes - Add new TypeScript globals (`AsyncDisposable`, `Awaited`, `DecoratorContext`, and others) [4643](https://github.com/rome/tools/issues/4643). diff --git a/crates/rome_cli/tests/commands/lint.rs b/crates/rome_cli/tests/commands/lint.rs index 34ae0be75b6..2ce77fd06c0 100644 --- a/crates/rome_cli/tests/commands/lint.rs +++ b/crates/rome_cli/tests/commands/lint.rs @@ -2168,16 +2168,7 @@ fn should_not_enable_nursery_rules() { fs.insert(configuration_path.into(), configuration.as_bytes()); let file_path = Path::new("fix.ts"); - fs.insert( - file_path.into(), - r#"const bannedType: Boolean = true; - -if (true) { - const obj = {}; - obj["useLiteralKey"]; -} - "#, - ); + fs.insert(file_path.into(), r#"const bannedType: Boolean = true;"#); let result = run_cli( DynRef::Borrowed(&mut fs), diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap b/crates/rome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap index 3c1e1330767..a375436280d 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap @@ -47,6 +47,38 @@ check ━━━━━━━━━━━━━━━━━━━━━━━━ # Emitted Messages +```block +fix.ts:5:6 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × The computed expression can be simplified without the use of a string literal. + + 3 │ if (true) { + 4 │ const obj = {}; + > 5 │ obj["useLiteralKey"]; + │ ^^^^^^^^^^^^^^^ + 6 │ } + 7 │ + + i Suggested fix: Use a literal key instead. + + 3 3 │ if (true) { + 4 4 │ const obj = {}; + 5 │ - → obj["useLiteralKey"]; + 5 │ + → obj.useLiteralKey; + 6 6 │ } + 7 7 │ + + +``` + +```block +fix.ts lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Fixes applied to the file, but there are still diagnostics to address. + + +``` + ```block fix.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/crates/rome_cli/tests/snapshots/main_commands_lint/should_not_enable_nursery_rules.snap b/crates/rome_cli/tests/snapshots/main_commands_lint/should_not_enable_nursery_rules.snap index 3498fb5809f..78eda795698 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lint/should_not_enable_nursery_rules.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lint/should_not_enable_nursery_rules.snap @@ -26,12 +26,6 @@ expression: content ```ts const bannedType: Boolean = true; - -if (true) { - const obj = {}; - obj["useLiteralKey"]; -} - ``` # Emitted Messages diff --git a/crates/rome_cli/tests/snapshots/main_configuration/incorrect_rule_name.snap b/crates/rome_cli/tests/snapshots/main_configuration/incorrect_rule_name.snap index b14b61423a1..57f9c63280a 100644 --- a/crates/rome_cli/tests/snapshots/main_configuration/incorrect_rule_name.snap +++ b/crates/rome_cli/tests/snapshots/main_configuration/incorrect_rule_name.snap @@ -72,6 +72,7 @@ rome.json:6:13 deserialize ━━━━━━━━━━━━━━━━━ - noUnusedVariables - noVoidElementsWithChildren - noVoidTypeReturn + - useIsNan - useValidForDirection - useYield diff --git a/crates/rome_diagnostics_categories/src/categories.rs b/crates/rome_diagnostics_categories/src/categories.rs index 664c37dcce8..934cf261daa 100644 --- a/crates/rome_diagnostics_categories/src/categories.rs +++ b/crates/rome_diagnostics_categories/src/categories.rs @@ -23,6 +23,7 @@ define_categories! { "lint/a11y/useAnchorContent": "https://docs.rome.tools/lint/rules/useAnchorContent", "lint/a11y/useAriaPropsForRole": "https://docs.rome.tools/lint/rules/useAriaPropsForRole", "lint/a11y/useButtonType": "https://docs.rome.tools/lint/rules/useButtonType", + "lint/a11y/useHeadingContent": "https://docs.rome.tools/lint/rules/useHeadingContent", "lint/a11y/useHtmlLang": "https://docs.rome.tools/lint/rules/useHtmlLang", "lint/a11y/useIframeTitle": "https://docs.rome.tools/lint/rules/useIframeTitle", "lint/a11y/useKeyWithClickEvents": "https://docs.rome.tools/lint/rules/useKeyWithClickEvents", @@ -34,6 +35,7 @@ define_categories! { // complexity "lint/complexity/noExtraBooleanCast": "https://docs.rome.tools/lint/rules/noExtraBooleanCast", + "lint/complexity/noForEach": "https://docs.rome.tools/lint/rules/noForEach", "lint/complexity/noMultipleSpacesInRegularExpressionLiterals": "https://docs.rome.tools/lint/rules/noMultipleSpacesInRegularExpressionLiterals", "lint/complexity/noUselessCatch": "https://docs.rome.tools/lint/rules/noUselessCatch", "lint/complexity/noUselessConstructor": "https://docs.rome.tools/lint/rules/noUselessConstructor", @@ -44,7 +46,9 @@ define_categories! { "lint/complexity/noUselessTypeConstraint": "https://docs.rome.tools/lint/rules/noUselessTypeConstraint", "lint/complexity/noWith": "https://docs.rome.tools/lint/rules/noWith", "lint/complexity/useFlatMap": "https://docs.rome.tools/lint/rules/useFlatMap", + "lint/complexity/useLiteralKeys": "https://docs.rome.tools/lint/rules/useLiteralKeys", "lint/complexity/useOptionalChain": "https://docs.rome.tools/lint/rules/useOptionalChain", + "lint/complexity/useSimpleNumberKeys": "https://docs.rome.tools/lint/rules/useSimpleNumberKeys", "lint/complexity/useSimplifiedLogicExpression": "https://docs.rome.tools/lint/rules/useSimplifiedLogicExpression", // correctness @@ -55,6 +59,7 @@ define_categories! { "lint/correctness/noGlobalObjectCalls": "https://docs.rome.tools/lint/rules/noGlobalObjectCalls", "lint/correctness/noInnerDeclarations": "https://docs.rome.tools/lint/rules/noInnerDeclarations", "lint/correctness/noInvalidConstructorSuper": "https://docs.rome.tools/lint/rules/noInvalidConstructorSuper", + "lint/correctness/useIsNan": "https://docs.rome.tools/lint/rules/useIsNan", "lint/correctness/noNewSymbol": "https://docs.rome.tools/lint/rules/noNewSymbol", "lint/correctness/noPrecisionLoss": "https://docs.rome.tools/lint/rules/noPrecisionLoss", "lint/correctness/noRenderReturnValue": "https://docs.rome.tools/lint/rules/noRenderReturnValue", @@ -79,14 +84,11 @@ define_categories! { "lint/nursery/noAriaUnsupportedElements": "https://docs.rome.tools/lint/rules/noAriaUnsupportedElements", "lint/nursery/noBannedTypes":"https://docs.rome.tools/lint/rules/noBannedTypes", "lint/nursery/noConfusingArrow": "https://docs.rome.tools/lint/rules/noConfusingArrow", - "lint/nursery/noConsoleLog": "https://docs.rome.tools/lint/rules/noConsoleLog", "lint/nursery/noConstantCondition": "https://docs.rome.tools/lint/rules/noConstantCondition", "lint/nursery/noControlCharactersInRegex": "https://docs.rome.tools/lint/rules/noControlCharactersInRegex", "lint/nursery/noDuplicateJsonKeys": "https://docs.rome.tools/lint/rules/noDuplicateJsonKeys", - "lint/nursery/noDuplicateJsxProps": "https://docs.rome.tools/lint/rules/noDuplicateJsxProps", "lint/nursery/noExcessiveComplexity": "https://docs.rome.tools/lint/rules/noExcessiveComplexity", "lint/nursery/noFallthroughSwitchClause": "https://docs.rome.tools/lint/rules/noFallthroughSwitchClause", - "lint/nursery/noForEach": "https://docs.rome.tools/lint/rules/noForEach", "lint/nursery/noGlobalIsFinite": "https://docs.rome.tools/lint/rules/noGlobalIsFinite", "lint/nursery/noGlobalIsNan": "https://docs.rome.tools/lint/rules/noGlobalIsNan", "lint/nursery/noNoninteractiveTabindex": "https://docs.rome.tools/lint/rules/noNoninteractiveTabindex", @@ -99,18 +101,13 @@ define_categories! { "lint/nursery/noVoid": "https://docs.rome.tools/lint/rules/noVoid", "lint/nursery/useAriaPropTypes": "https://docs.rome.tools/lint/rules/useAriaPropTypes", "lint/nursery/useArrowFunction": "https://docs.rome.tools/lint/rules/useArrowFunction", - "lint/nursery/useCamelCase": "https://docs.rome.tools/lint/rules/useCamelCase", "lint/nursery/useExhaustiveDependencies": "https://docs.rome.tools/lint/rules/useExhaustiveDependencies", "lint/nursery/useGroupedTypeImport": "https://docs.rome.tools/lint/rules/useGroupedTypeImport", - "lint/nursery/useHeadingContent": "https://docs.rome.tools/lint/rules/useHeadingContent", "lint/nursery/useHookAtTopLevel": "https://docs.rome.tools/lint/rules/useHookAtTopLevel", "lint/nursery/useImportRestrictions": "https://docs.rome.tools/lint/rules/useImportRestrictions", "lint/nursery/useIsArray": "https://docs.rome.tools/lint/rules/useIsArray", - "lint/nursery/useIsNan": "https://docs.rome.tools/lint/rules/useIsNan", "lint/nursery/useLiteralEnumMembers": "https://docs.rome.tools/lint/rules/useLiteralEnumMembers", - "lint/nursery/useLiteralKeys": "https://docs.rome.tools/lint/rules/useLiteralKeys", "lint/nursery/useNamingConvention": "https://docs.rome.tools/lint/rules/useNamingConvention", - "lint/nursery/useSimpleNumberKeys": "https://docs.rome.tools/lint/rules/useSimpleNumberKeys", // nursery end // performance @@ -157,11 +154,13 @@ define_categories! { "lint/suspicious/noCommentText": "https://docs.rome.tools/lint/rules/noCommentText", "lint/suspicious/noCompareNegZero": "https://docs.rome.tools/lint/rules/noCompareNegZero", "lint/suspicious/noConfusingLabels": "https://docs.rome.tools/lint/rules/noConfusingLabels", + "lint/suspicious/noConsoleLog": "https://docs.rome.tools/lint/rules/noConsoleLog", "lint/suspicious/noConstEnum": "https://docs.rome.tools/lint/rules/noConstEnum", "lint/suspicious/noDebugger": "https://docs.rome.tools/lint/rules/noDebugger", "lint/suspicious/noDoubleEquals": "https://docs.rome.tools/lint/rules/noDoubleEquals", "lint/suspicious/noDuplicateCase": "https://docs.rome.tools/lint/rules/noDuplicateCase", "lint/suspicious/noDuplicateClassMembers": "https://docs.rome.tools/lint/rules/noDuplicateClassMembers", + "lint/suspicious/noDuplicateJsxProps": "https://docs.rome.tools/lint/rules/noDuplicateJsxProps", "lint/suspicious/noDuplicateObjectKeys":"https://docs.rome.tools/lint/rules/noDuplicateObjectKeys", "lint/suspicious/noDuplicateParameters": "https://docs.rome.tools/lint/rules/noDuplicateParameters", "lint/suspicious/noEmptyInterface": "https://docs.rome.tools/lint/rules/noEmptyInterface", diff --git a/crates/rome_js_analyze/src/analyzers/a11y.rs b/crates/rome_js_analyze/src/analyzers/a11y.rs index 3dc7e934210..8ef52b17545 100644 --- a/crates/rome_js_analyze/src/analyzers/a11y.rs +++ b/crates/rome_js_analyze/src/analyzers/a11y.rs @@ -11,6 +11,7 @@ pub(crate) mod no_redundant_alt; pub(crate) mod no_svg_without_title; pub(crate) mod use_alt_text; pub(crate) mod use_anchor_content; +pub(crate) mod use_heading_content; pub(crate) mod use_html_lang; pub(crate) mod use_iframe_title; pub(crate) mod use_key_with_click_events; @@ -31,6 +32,7 @@ declare_group! { self :: no_svg_without_title :: NoSvgWithoutTitle , self :: use_alt_text :: UseAltText , self :: use_anchor_content :: UseAnchorContent , + self :: use_heading_content :: UseHeadingContent , self :: use_html_lang :: UseHtmlLang , self :: use_iframe_title :: UseIframeTitle , self :: use_key_with_click_events :: UseKeyWithClickEvents , diff --git a/crates/rome_js_analyze/src/analyzers/nursery/use_heading_content.rs b/crates/rome_js_analyze/src/analyzers/a11y/use_heading_content.rs similarity index 100% rename from crates/rome_js_analyze/src/analyzers/nursery/use_heading_content.rs rename to crates/rome_js_analyze/src/analyzers/a11y/use_heading_content.rs diff --git a/crates/rome_js_analyze/src/analyzers/complexity.rs b/crates/rome_js_analyze/src/analyzers/complexity.rs index ecf77563096..6d5ff8e62a0 100644 --- a/crates/rome_js_analyze/src/analyzers/complexity.rs +++ b/crates/rome_js_analyze/src/analyzers/complexity.rs @@ -3,6 +3,7 @@ use rome_analyze::declare_group; pub(crate) mod no_extra_boolean_cast; +pub(crate) mod no_for_each; pub(crate) mod no_multiple_spaces_in_regular_expression_literals; pub(crate) mod no_useless_catch; pub(crate) mod no_useless_constructor; @@ -12,7 +13,9 @@ pub(crate) mod no_useless_switch_case; pub(crate) mod no_useless_type_constraint; pub(crate) mod no_with; pub(crate) mod use_flat_map; +pub(crate) mod use_literal_keys; pub(crate) mod use_optional_chain; +pub(crate) mod use_simple_number_keys; pub(crate) mod use_simplified_logic_expression; declare_group! { @@ -20,6 +23,7 @@ declare_group! { name : "complexity" , rules : [ self :: no_extra_boolean_cast :: NoExtraBooleanCast , + self :: no_for_each :: NoForEach , self :: no_multiple_spaces_in_regular_expression_literals :: NoMultipleSpacesInRegularExpressionLiterals , self :: no_useless_catch :: NoUselessCatch , self :: no_useless_constructor :: NoUselessConstructor , @@ -29,7 +33,9 @@ declare_group! { self :: no_useless_type_constraint :: NoUselessTypeConstraint , self :: no_with :: NoWith , self :: use_flat_map :: UseFlatMap , + self :: use_literal_keys :: UseLiteralKeys , self :: use_optional_chain :: UseOptionalChain , + self :: use_simple_number_keys :: UseSimpleNumberKeys , self :: use_simplified_logic_expression :: UseSimplifiedLogicExpression , ] } diff --git a/crates/rome_js_analyze/src/analyzers/nursery/no_for_each.rs b/crates/rome_js_analyze/src/analyzers/complexity/no_for_each.rs similarity index 100% rename from crates/rome_js_analyze/src/analyzers/nursery/no_for_each.rs rename to crates/rome_js_analyze/src/analyzers/complexity/no_for_each.rs diff --git a/crates/rome_js_analyze/src/analyzers/nursery/use_literal_keys.rs b/crates/rome_js_analyze/src/analyzers/complexity/use_literal_keys.rs similarity index 100% rename from crates/rome_js_analyze/src/analyzers/nursery/use_literal_keys.rs rename to crates/rome_js_analyze/src/analyzers/complexity/use_literal_keys.rs diff --git a/crates/rome_js_analyze/src/analyzers/nursery/use_simple_number_keys.rs b/crates/rome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs similarity index 100% rename from crates/rome_js_analyze/src/analyzers/nursery/use_simple_number_keys.rs rename to crates/rome_js_analyze/src/analyzers/complexity/use_simple_number_keys.rs diff --git a/crates/rome_js_analyze/src/analyzers/nursery.rs b/crates/rome_js_analyze/src/analyzers/nursery.rs index 655790c4cd0..5733a2e0d42 100644 --- a/crates/rome_js_analyze/src/analyzers/nursery.rs +++ b/crates/rome_js_analyze/src/analyzers/nursery.rs @@ -4,10 +4,8 @@ use rome_analyze::declare_group; pub(crate) mod no_confusing_arrow; pub(crate) mod no_control_characters_in_regex; -pub(crate) mod no_duplicate_jsx_props; pub(crate) mod no_excessive_complexity; pub(crate) mod no_fallthrough_switch_clause; -pub(crate) mod no_for_each; pub(crate) mod no_nonoctal_decimal_escape; pub(crate) mod no_self_assign; pub(crate) mod no_static_only_class; @@ -15,11 +13,8 @@ pub(crate) mod no_useless_empty_export; pub(crate) mod no_void; pub(crate) mod use_arrow_function; pub(crate) mod use_grouped_type_import; -pub(crate) mod use_heading_content; pub(crate) mod use_import_restrictions; pub(crate) mod use_literal_enum_members; -pub(crate) mod use_literal_keys; -pub(crate) mod use_simple_number_keys; declare_group! { pub (crate) Nursery { @@ -27,10 +22,8 @@ declare_group! { rules : [ self :: no_confusing_arrow :: NoConfusingArrow , self :: no_control_characters_in_regex :: NoControlCharactersInRegex , - self :: no_duplicate_jsx_props :: NoDuplicateJsxProps , self :: no_excessive_complexity :: NoExcessiveComplexity , self :: no_fallthrough_switch_clause :: NoFallthroughSwitchClause , - self :: no_for_each :: NoForEach , self :: no_nonoctal_decimal_escape :: NoNonoctalDecimalEscape , self :: no_self_assign :: NoSelfAssign , self :: no_static_only_class :: NoStaticOnlyClass , @@ -38,11 +31,8 @@ declare_group! { self :: no_void :: NoVoid , self :: use_arrow_function :: UseArrowFunction , self :: use_grouped_type_import :: UseGroupedTypeImport , - self :: use_heading_content :: UseHeadingContent , self :: use_import_restrictions :: UseImportRestrictions , self :: use_literal_enum_members :: UseLiteralEnumMembers , - self :: use_literal_keys :: UseLiteralKeys , - self :: use_simple_number_keys :: UseSimpleNumberKeys , ] } } diff --git a/crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs b/crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs index a261868ceb9..a3c3048507c 100644 --- a/crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs +++ b/crates/rome_js_analyze/src/analyzers/style/use_exponentiation_operator.rs @@ -54,7 +54,7 @@ declare_rule! { pub(crate) UseExponentiationOperator { version: "11.0.0", name: "useExponentiationOperator", - recommended: false, + recommended: true, } } diff --git a/crates/rome_js_analyze/src/analyzers/suspicious.rs b/crates/rome_js_analyze/src/analyzers/suspicious.rs index 9db25e9152d..a29c9e51535 100644 --- a/crates/rome_js_analyze/src/analyzers/suspicious.rs +++ b/crates/rome_js_analyze/src/analyzers/suspicious.rs @@ -12,6 +12,7 @@ pub(crate) mod no_debugger; pub(crate) mod no_double_equals; pub(crate) mod no_duplicate_case; pub(crate) mod no_duplicate_class_members; +pub(crate) mod no_duplicate_jsx_props; pub(crate) mod no_duplicate_object_keys; pub(crate) mod no_empty_interface; pub(crate) mod no_explicit_any; @@ -40,6 +41,7 @@ declare_group! { self :: no_double_equals :: NoDoubleEquals , self :: no_duplicate_case :: NoDuplicateCase , self :: no_duplicate_class_members :: NoDuplicateClassMembers , + self :: no_duplicate_jsx_props :: NoDuplicateJsxProps , self :: no_duplicate_object_keys :: NoDuplicateObjectKeys , self :: no_empty_interface :: NoEmptyInterface , self :: no_explicit_any :: NoExplicitAny , diff --git a/crates/rome_js_analyze/src/analyzers/nursery/no_duplicate_jsx_props.rs b/crates/rome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs similarity index 100% rename from crates/rome_js_analyze/src/analyzers/nursery/no_duplicate_jsx_props.rs rename to crates/rome_js_analyze/src/analyzers/suspicious/no_duplicate_jsx_props.rs diff --git a/crates/rome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs b/crates/rome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs index 9bb1432d2b2..d0d7a993aee 100644 --- a/crates/rome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs +++ b/crates/rome_js_analyze/src/analyzers/suspicious/no_redundant_use_strict.rs @@ -68,7 +68,7 @@ declare_rule! { pub(crate) NoRedundantUseStrict { version: "11.0.0", name: "noRedundantUseStrict", - recommended: false, + recommended: true, } } diff --git a/crates/rome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs b/crates/rome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs index 654d1e3dfab..58dec8bdb46 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/complexity/no_useless_fragments.rs @@ -44,7 +44,7 @@ declare_rule! { pub(crate) NoUselessFragments { version: "0.10.0", name: "noUselessFragments", - recommended: false, + recommended: true, } } diff --git a/crates/rome_js_analyze/src/semantic_analyzers/correctness.rs b/crates/rome_js_analyze/src/semantic_analyzers/correctness.rs index c3100da2525..8ec1922236e 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/correctness.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/correctness.rs @@ -10,6 +10,7 @@ pub(crate) mod no_render_return_value; pub(crate) mod no_undeclared_variables; pub(crate) mod no_unused_variables; pub(crate) mod no_void_elements_with_children; +pub(crate) mod use_is_nan; declare_group! { pub (crate) Correctness { @@ -23,6 +24,7 @@ declare_group! { self :: no_undeclared_variables :: NoUndeclaredVariables , self :: no_unused_variables :: NoUnusedVariables , self :: no_void_elements_with_children :: NoVoidElementsWithChildren , + self :: use_is_nan :: UseIsNan , ] } } diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_is_nan.rs b/crates/rome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs similarity index 100% rename from crates/rome_js_analyze/src/semantic_analyzers/nursery/use_is_nan.rs rename to crates/rome_js_analyze/src/semantic_analyzers/correctness/use_is_nan.rs diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery.rs b/crates/rome_js_analyze/src/semantic_analyzers/nursery.rs index b801c26369b..94627848a22 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/nursery.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/nursery.rs @@ -4,16 +4,13 @@ use rome_analyze::declare_group; pub(crate) mod no_accumulating_spread; pub(crate) mod no_banned_types; -pub(crate) mod no_console_log; pub(crate) mod no_constant_condition; pub(crate) mod no_global_is_finite; pub(crate) mod no_global_is_nan; pub(crate) mod no_unsafe_declaration_merging; -pub(crate) mod use_camel_case; pub(crate) mod use_exhaustive_dependencies; pub(crate) mod use_hook_at_top_level; pub(crate) mod use_is_array; -pub(crate) mod use_is_nan; pub(crate) mod use_naming_convention; declare_group! { @@ -22,16 +19,13 @@ declare_group! { rules : [ self :: no_accumulating_spread :: NoAccumulatingSpread , self :: no_banned_types :: NoBannedTypes , - self :: no_console_log :: NoConsoleLog , self :: no_constant_condition :: NoConstantCondition , self :: no_global_is_finite :: NoGlobalIsFinite , self :: no_global_is_nan :: NoGlobalIsNan , self :: no_unsafe_declaration_merging :: NoUnsafeDeclarationMerging , - self :: use_camel_case :: UseCamelCase , self :: use_exhaustive_dependencies :: UseExhaustiveDependencies , self :: use_hook_at_top_level :: UseHookAtTopLevel , self :: use_is_array :: UseIsArray , - self :: use_is_nan :: UseIsNan , self :: use_naming_convention :: UseNamingConvention , ] } diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_camel_case.rs b/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_camel_case.rs deleted file mode 100644 index 81ca9f0eaa5..00000000000 --- a/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_camel_case.rs +++ /dev/null @@ -1,217 +0,0 @@ -use crate::{ - semantic_services::Semantic, - utils::{rename::RenameSymbolExtensions, ToCamelCase}, - JsRuleAction, -}; -use rome_analyze::{context::RuleContext, declare_rule, ActionCategory, Rule, RuleDiagnostic}; -use rome_console::markup; -use rome_diagnostics::Applicability; -use rome_js_semantic::{CanBeImportedExported, ReferencesExtensions, SemanticModel}; -use rome_js_syntax::{ - JsFormalParameter, JsFunctionDeclaration, JsFunctionExportDefaultDeclaration, - JsGetterClassMember, JsIdentifierBinding, JsLiteralMemberName, JsMethodClassMember, - JsPrivateClassMemberName, JsPropertyClassMember, JsSetterClassMember, JsSyntaxKind, - JsVariableDeclaration, JsVariableDeclarator, JsVariableDeclaratorList, JsxReferenceIdentifier, -}; -use rome_rowan::{declare_node_union, AstNode, BatchMutationExt, SyntaxNodeOptionExt}; -use std::{borrow::Cow, iter::once}; - -declare_rule! { - /// Enforce camel case naming convention. - /// - /// ## Examples - /// - /// ### Invalid - /// - /// ```js,expect_diagnostic - /// let snake_case; - /// ``` - /// - /// ```js,expect_diagnostic - /// let PascalCase; - /// ``` - /// - /// ## Valid - /// - /// ```js - /// let camelCase; - /// ``` - pub(crate) UseCamelCase { - version: "0.8.0", - name: "useCamelCase", - recommended: false, - } -} - -pub struct State { - new_name: String, -} - -fn check_is_camel(name: &str) -> Option { - if name.starts_with('_') { - return None; - } - - match name.to_camel_case() { - Cow::Borrowed(_) => None, - Cow::Owned(new_name) => Some(State { new_name }), - } -} - -// It is OK to be non camel case when: -// 1. it's a const variable (eg: const THIS_IS_OK); -// 2. it's a function used in a new expression (eg: new PascalCase()); -// 3. it's a exported function. -fn is_non_camel_ok(binding: &JsIdentifierBinding, model: &SemanticModel) -> Option { - use JsSyntaxKind::*; - match binding.syntax().parent()?.kind() { - JS_VARIABLE_DECLARATOR => { - let declarator = binding.parent::()?; - let is_ok = match declarator.syntax().parent().kind() { - Some(JS_VARIABLE_DECLARATOR_LIST) => declarator - .parent::()? - .parent::()? - .is_const(), - _ => false, - }; - Some(is_ok) - } - JS_FUNCTION_DECLARATION | JS_FUNCTION_EXPORT_DEFAULT_DECLARATION => { - if binding.is_exported(model) { - return Some(true); - } - - for reference in binding.all_reads(model) { - let greatparent = reference.syntax().grand_parent()?; - if let JS_NEW_EXPRESSION = greatparent.kind() { - return Some(true); - } - } - - Some(false) - } - _ => Some(false), - } -} - -impl Rule for UseCamelCase { - type Query = Semantic; - type State = State; - type Signals = Option; - type Options = (); - - fn run(ctx: &RuleContext) -> Option { - let name = ctx.query(); - let model = ctx.model(); - - match name { - AnyJsCamelCaseName::JsIdentifierBinding(binding) => { - let is_non_camel_ok = is_non_camel_ok(binding, model); - match is_non_camel_ok { - Some(false) | None => { - let is_variable = binding.parent::().is_some(); - let is_parameter = binding.parent::().is_some(); - let is_function = binding.parent::().is_some(); - let is_exported_function = binding - .parent::() - .is_some(); - - if is_variable || is_parameter || is_function || is_exported_function { - let name = binding.name_token().ok()?; - let is_camel_case = check_is_camel(name.text_trimmed()); - if is_camel_case.is_some() { - let binding = model.as_binding(binding); - let is_jsx_component = binding.all_reads().any(|reference| { - JsxReferenceIdentifier::can_cast(reference.syntax().kind()) - }); - if !is_jsx_component { - return is_camel_case; - } - } - } - - None - } - _ => None, - } - } - AnyJsCamelCaseName::JsLiteralMemberName(name) => { - let is_method_class = name.parent::().is_some(); - let is_getter = name.parent::().is_some(); - let is_setter = name.parent::().is_some(); - let is_property = name.parent::().is_some(); - if is_method_class || is_getter || is_setter || is_property { - let name = name.text(); - check_is_camel(&name) - } else { - None - } - } - AnyJsCamelCaseName::JsPrivateClassMemberName(name) => { - let is_property = name.parent::().is_some(); - if is_property { - let name = name.text(); - check_is_camel(&name[1..]) - } else { - None - } - } - } - } - - fn diagnostic(ctx: &RuleContext, _: &Self::State) -> Option { - let binding = ctx.query(); - - let symbol_type = match binding.syntax().parent().unwrap().kind() { - JsSyntaxKind::JS_FORMAL_PARAMETER => "parameters", - JsSyntaxKind::JS_FUNCTION_DECLARATION => "functions", - JsSyntaxKind::JS_GETTER_CLASS_MEMBER - | JsSyntaxKind::JS_SETTER_CLASS_MEMBER - | JsSyntaxKind::JS_METHOD_CLASS_MEMBER => "methods", - JsSyntaxKind::JS_PROPERTY_CLASS_MEMBER | JsSyntaxKind::JS_PRIVATE_CLASS_MEMBER_NAME => { - "properties" - } - _ => "variables", - }; - - let diag = RuleDiagnostic::new( - rule_category!(), - binding.syntax().text_trimmed_range(), - markup! { - "Prefer " {symbol_type} " names in camel case." - }, - ); - - Some(diag) - } - - fn action(ctx: &RuleContext, State { new_name }: &Self::State) -> Option { - let model = ctx.model(); - let mut batch = ctx.root().begin(); - - let candidates = (2..).map(|i| format!("{}{}", new_name, i).into()); - let candidates = once(Cow::from(new_name)).chain(candidates); - - match ctx.query() { - AnyJsCamelCaseName::JsIdentifierBinding(binding) => { - let renamed = - batch.rename_node_declaration_with_retry(model, binding.clone(), candidates); - if renamed { - Some(JsRuleAction { - category: ActionCategory::QuickFix, - applicability: Applicability::Always, - message: markup! { "Rename this symbol to camel case" }.to_owned(), - mutation: batch, - }) - } else { - None - } - } - _ => None, - } - } -} - -declare_node_union! { - pub(crate) AnyJsCamelCaseName = JsIdentifierBinding | JsLiteralMemberName | JsPrivateClassMemberName -} diff --git a/crates/rome_js_analyze/src/semantic_analyzers/suspicious.rs b/crates/rome_js_analyze/src/semantic_analyzers/suspicious.rs index cd3c8b59196..6591a0de7da 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/suspicious.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/suspicious.rs @@ -5,6 +5,7 @@ use rome_analyze::declare_group; pub(crate) mod no_array_index_key; pub(crate) mod no_catch_assign; pub(crate) mod no_class_assign; +pub(crate) mod no_console_log; pub(crate) mod no_duplicate_parameters; pub(crate) mod no_function_assign; pub(crate) mod no_import_assign; @@ -18,6 +19,7 @@ declare_group! { self :: no_array_index_key :: NoArrayIndexKey , self :: no_catch_assign :: NoCatchAssign , self :: no_class_assign :: NoClassAssign , + self :: no_console_log :: NoConsoleLog , self :: no_duplicate_parameters :: NoDuplicateParameters , self :: no_function_assign :: NoFunctionAssign , self :: no_import_assign :: NoImportAssign , diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery/no_console_log.rs b/crates/rome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs similarity index 100% rename from crates/rome_js_analyze/src/semantic_analyzers/nursery/no_console_log.rs rename to crates/rome_js_analyze/src/semantic_analyzers/suspicious/no_console_log.rs diff --git a/crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/invalid.jsx b/crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/invalid.jsx similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/invalid.jsx rename to crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/invalid.jsx diff --git a/crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/invalid.jsx.snap b/crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/invalid.jsx.snap similarity index 88% rename from crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/invalid.jsx.snap rename to crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/invalid.jsx.snap index 621a4ba1844..73a54b16228 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/invalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/invalid.jsx.snap @@ -27,7 +27,7 @@ expression: invalid.jsx # Diagnostics ``` -invalid.jsx:2:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:2:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -43,7 +43,7 @@ invalid.jsx:2:2 lint/nursery/useHeadingContent ━━━━━━━━━━━ ``` ``` -invalid.jsx:3:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:3:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -63,7 +63,7 @@ invalid.jsx:3:2 lint/nursery/useHeadingContent ━━━━━━━━━━━ ``` ``` -invalid.jsx:6:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:6:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -80,7 +80,7 @@ invalid.jsx:6:2 lint/nursery/useHeadingContent ━━━━━━━━━━━ ``` ``` -invalid.jsx:7:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:7:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -100,7 +100,7 @@ invalid.jsx:7:2 lint/nursery/useHeadingContent ━━━━━━━━━━━ ``` ``` -invalid.jsx:10:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:10:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -117,7 +117,7 @@ invalid.jsx:10:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:11:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:11:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -134,7 +134,7 @@ invalid.jsx:11:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:12:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:12:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -151,7 +151,7 @@ invalid.jsx:12:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:13:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:13:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -168,7 +168,7 @@ invalid.jsx:13:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:14:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:14:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -185,7 +185,7 @@ invalid.jsx:14:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:15:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:15:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -202,7 +202,7 @@ invalid.jsx:15:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:16:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:16:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. @@ -219,7 +219,7 @@ invalid.jsx:16:2 lint/nursery/useHeadingContent ━━━━━━━━━━ ``` ``` -invalid.jsx:17:2 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:17:2 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Provide screen reader accessible content when using heading elements. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/valid.jsx b/crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/valid.jsx similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/valid.jsx rename to crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/valid.jsx diff --git a/crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/valid.jsx.snap b/crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/valid.jsx.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useHeadingContent/valid.jsx.snap rename to crates/rome_js_analyze/tests/specs/a11y/useHeadingContent/valid.jsx.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/noForEach/invalid.js b/crates/rome_js_analyze/tests/specs/complexity/noForEach/invalid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noForEach/invalid.js rename to crates/rome_js_analyze/tests/specs/complexity/noForEach/invalid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/noForEach/invalid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/noForEach/invalid.js.snap similarity index 81% rename from crates/rome_js_analyze/tests/specs/nursery/noForEach/invalid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/noForEach/invalid.js.snap index 7e68672d0ab..ad9e216c579 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noForEach/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/complexity/noForEach/invalid.js.snap @@ -24,7 +24,7 @@ els['forEach']((el) => { # Diagnostics ``` -invalid.js:1:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:1:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Prefer for...of instead of Array.forEach @@ -40,7 +40,7 @@ invalid.js:1:1 lint/nursery/noForEach ━━━━━━━━━━━━━━ ``` ``` -invalid.js:5:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:5:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Prefer for...of instead of Array.forEach @@ -58,7 +58,7 @@ invalid.js:5:1 lint/nursery/noForEach ━━━━━━━━━━━━━━ ``` ``` -invalid.js:9:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:9:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Prefer for...of instead of Array.forEach @@ -76,7 +76,7 @@ invalid.js:9:1 lint/nursery/noForEach ━━━━━━━━━━━━━━ ``` ``` -invalid.js:13:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:13:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Prefer for...of instead of Array.forEach diff --git a/crates/rome_js_analyze/tests/specs/nursery/noForEach/valid.js b/crates/rome_js_analyze/tests/specs/complexity/noForEach/valid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noForEach/valid.js rename to crates/rome_js_analyze/tests/specs/complexity/noForEach/valid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/noForEach/valid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/noForEach/valid.js.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noForEach/valid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/noForEach/valid.js.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.js b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.js rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.js.snap similarity index 80% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.js.snap index 51d74210997..7d6bc77494c 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.js.snap @@ -1,6 +1,5 @@ --- source: crates/rome_js_analyze/tests/spec_tests.rs -assertion_line: 103 expression: invalid.js --- # Input @@ -44,7 +43,7 @@ a = { # Diagnostics ``` -invalid.js:1:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:1:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -64,7 +63,7 @@ invalid.js:1:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:2:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:2:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -86,7 +85,7 @@ invalid.js:2:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:3:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:3:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -110,7 +109,7 @@ invalid.js:3:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:3:14 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:3:14 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -134,7 +133,7 @@ invalid.js:3:14 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:4:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:4:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -158,7 +157,7 @@ invalid.js:4:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:5:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:5:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -182,7 +181,7 @@ invalid.js:5:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:6:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:6:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -206,7 +205,7 @@ invalid.js:6:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:7:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:7:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -230,7 +229,7 @@ invalid.js:7:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:8:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:8:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -254,7 +253,7 @@ invalid.js:8:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:8:14 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:8:14 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -278,7 +277,7 @@ invalid.js:8:14 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:9:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:9:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -302,7 +301,7 @@ invalid.js:9:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.js:10:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:10:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -326,7 +325,7 @@ invalid.js:10:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:12:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:12:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -345,7 +344,7 @@ invalid.js:12:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:15:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:15:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -364,7 +363,7 @@ invalid.js:15:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:18:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:18:2 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -383,7 +382,7 @@ invalid.js:18:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:20:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:20:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -407,7 +406,7 @@ invalid.js:20:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:21:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:21:5 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -431,7 +430,7 @@ invalid.js:21:5 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:22:12 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:22:12 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -450,7 +449,7 @@ invalid.js:22:12 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:23:11 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:23:11 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -469,7 +468,7 @@ invalid.js:23:11 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:24:12 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:24:12 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -488,7 +487,7 @@ invalid.js:24:12 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:25:11 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:25:11 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -507,7 +506,7 @@ invalid.js:25:11 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:26:16 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:26:16 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -526,7 +525,7 @@ invalid.js:26:16 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:27:15 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:27:15 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -545,7 +544,7 @@ invalid.js:27:15 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:28:16 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:28:16 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -564,7 +563,7 @@ invalid.js:28:16 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:29:15 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:29:15 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -583,7 +582,7 @@ invalid.js:29:15 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:31:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:31:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -602,7 +601,7 @@ invalid.js:31:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.js:34:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:34:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.ts b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.ts similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.ts rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.ts diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.ts.snap b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.ts.snap similarity index 76% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.ts.snap rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.ts.snap index 701f3bc7cae..b17ec26f561 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/invalid.ts.snap +++ b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/invalid.ts.snap @@ -44,7 +44,7 @@ export type T = { # Diagnostics ``` -invalid.ts:2:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:2:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -62,7 +62,7 @@ invalid.ts:2:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.ts:4:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:4:2 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -81,7 +81,7 @@ invalid.ts:4:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.ts:6:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:6:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -100,7 +100,7 @@ invalid.ts:6:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.ts:8:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:8:6 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -119,7 +119,7 @@ invalid.ts:8:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━ ``` ``` -invalid.ts:10:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:10:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -138,7 +138,7 @@ invalid.ts:10:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:12:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:12:6 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -157,7 +157,7 @@ invalid.ts:12:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:14:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:14:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -176,7 +176,7 @@ invalid.ts:14:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:16:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:16:2 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -195,7 +195,7 @@ invalid.ts:16:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:20:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:20:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -213,7 +213,7 @@ invalid.ts:20:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:22:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:22:2 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -232,7 +232,7 @@ invalid.ts:22:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:24:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:24:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -251,7 +251,7 @@ invalid.ts:24:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:26:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:26:6 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -270,7 +270,7 @@ invalid.ts:26:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:28:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:28:7 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -289,7 +289,7 @@ invalid.ts:28:7 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:30:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:30:6 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -308,7 +308,7 @@ invalid.ts:30:6 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:32:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:32:3 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. @@ -327,7 +327,7 @@ invalid.ts:32:3 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━ ``` ``` -invalid.ts:34:2 lint/nursery/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.ts:34:2 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The computed expression can be simplified without the use of a string literal. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.js b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.js rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.js.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.js.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.ts b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.ts similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.ts rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.ts diff --git a/crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.ts.snap b/crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.ts.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useLiteralKeys/valid.ts.snap rename to crates/rome_js_analyze/tests/specs/complexity/useLiteralKeys/valid.ts.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/invalid.js b/crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/invalid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/invalid.js rename to crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/invalid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/invalid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/invalid.js.snap similarity index 81% rename from crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/invalid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/invalid.js.snap index 4920a641d3a..59a451a0d5a 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/invalid.js.snap @@ -1,6 +1,5 @@ --- source: crates/rome_js_analyze/tests/spec_tests.rs -assertion_line: 96 expression: invalid.js --- # Input @@ -22,7 +21,7 @@ expression: invalid.js # Diagnostics ``` -invalid.js:1:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:1:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Bigint is not allowed here. @@ -42,7 +41,7 @@ invalid.js:1:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:2:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:2:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Hexadecimal number literal is not allowed here. @@ -64,7 +63,7 @@ invalid.js:2:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:3:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:3:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Octal number literal is not allowed here. @@ -88,7 +87,7 @@ invalid.js:3:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:4:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:4:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Binary number literal in is not allowed here. @@ -112,7 +111,7 @@ invalid.js:4:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:5:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:5:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Octal number literal is not allowed here. @@ -136,7 +135,7 @@ invalid.js:5:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:6:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:6:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Number literal with underscore is not allowed here. @@ -160,7 +159,7 @@ invalid.js:6:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:7:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:7:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Number literal with underscore is not allowed here. @@ -184,7 +183,7 @@ invalid.js:7:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:8:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:8:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Number literal with underscore is not allowed here. @@ -208,7 +207,7 @@ invalid.js:8:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:9:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:9:4 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Hexadecimal number literal is not allowed here. @@ -232,7 +231,7 @@ invalid.js:9:4 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:11:8 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:11:8 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Hexadecimal number literal is not allowed here. @@ -256,7 +255,7 @@ invalid.js:11:8 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━ ``` ``` -invalid.js:12:8 lint/nursery/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:12:8 lint/complexity/useSimpleNumberKeys FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Hexadecimal number literal is not allowed here. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/valid.js b/crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/valid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/valid.js rename to crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/valid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/valid.js.snap b/crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/valid.js.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useSimpleNumberKeys/valid.js.snap rename to crates/rome_js_analyze/tests/specs/complexity/useSimpleNumberKeys/valid.js.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/useIsNan/invalid.js b/crates/rome_js_analyze/tests/specs/correctness/useIsNan/invalid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useIsNan/invalid.js rename to crates/rome_js_analyze/tests/specs/correctness/useIsNan/invalid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useIsNan/invalid.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useIsNan/invalid.js.snap similarity index 77% rename from crates/rome_js_analyze/tests/specs/nursery/useIsNan/invalid.js.snap rename to crates/rome_js_analyze/tests/specs/correctness/useIsNan/invalid.js.snap index 0c8e40a78f4..f06c31a1702 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useIsNan/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useIsNan/invalid.js.snap @@ -71,7 +71,7 @@ switch(Number.NaN) { case Number.NaN: break; } # Diagnostics ``` -invalid.js:1:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:1:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -84,7 +84,7 @@ invalid.js:1:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:2:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:2:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -98,7 +98,7 @@ invalid.js:2:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:3:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:3:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -113,7 +113,7 @@ invalid.js:3:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:4:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:4:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -128,7 +128,7 @@ invalid.js:4:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:5:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:5:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -143,7 +143,7 @@ invalid.js:5:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:6:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:6:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -158,7 +158,7 @@ invalid.js:6:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:7:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:7:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -173,7 +173,7 @@ invalid.js:7:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:8:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:8:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -188,7 +188,7 @@ invalid.js:8:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:9:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:9:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -203,7 +203,7 @@ invalid.js:9:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:10:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:10:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -218,7 +218,7 @@ invalid.js:10:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:11:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:11:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -233,7 +233,7 @@ invalid.js:11:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:12:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:12:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -248,7 +248,7 @@ invalid.js:12:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:13:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:13:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -263,7 +263,7 @@ invalid.js:13:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:14:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:14:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -278,7 +278,7 @@ invalid.js:14:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:15:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:15:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -293,7 +293,7 @@ invalid.js:15:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:16:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:16:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -308,7 +308,7 @@ invalid.js:16:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:17:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:17:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -323,7 +323,7 @@ invalid.js:17:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:18:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:18:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -338,7 +338,7 @@ invalid.js:18:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:19:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:19:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -353,7 +353,7 @@ invalid.js:19:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:20:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:20:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -368,7 +368,7 @@ invalid.js:20:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:21:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:21:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -383,7 +383,7 @@ invalid.js:21:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:22:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:22:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -398,7 +398,7 @@ invalid.js:22:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:23:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:23:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -413,7 +413,7 @@ invalid.js:23:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:24:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:24:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -428,7 +428,7 @@ invalid.js:24:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:25:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:25:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -443,7 +443,7 @@ invalid.js:25:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:26:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:26:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -458,7 +458,7 @@ invalid.js:26:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:27:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:27:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -473,7 +473,7 @@ invalid.js:27:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:28:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:28:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -488,7 +488,7 @@ invalid.js:28:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:29:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:29:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -503,7 +503,7 @@ invalid.js:29:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:30:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:30:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -518,7 +518,7 @@ invalid.js:30:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:31:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:31:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -533,7 +533,7 @@ invalid.js:31:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:32:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:32:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -548,7 +548,7 @@ invalid.js:32:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:33:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:33:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -563,7 +563,7 @@ invalid.js:33:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:34:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:34:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -578,7 +578,7 @@ invalid.js:34:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:36:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:36:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -593,7 +593,7 @@ invalid.js:36:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:37:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:37:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -607,7 +607,7 @@ invalid.js:37:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:38:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:38:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Use the Number.isNaN function to compare with NaN. @@ -622,7 +622,7 @@ invalid.js:38:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:41:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:41:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -636,7 +636,7 @@ invalid.js:41:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:42:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:42:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -651,7 +651,7 @@ invalid.js:42:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:43:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:43:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -666,7 +666,7 @@ invalid.js:43:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:44:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:44:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -681,7 +681,7 @@ invalid.js:44:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:45:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:45:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -696,7 +696,7 @@ invalid.js:45:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:46:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:46:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -711,7 +711,7 @@ invalid.js:46:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:47:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:47:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -726,7 +726,7 @@ invalid.js:47:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:48:37 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:48:37 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -741,7 +741,7 @@ invalid.js:48:37 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:49:30 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:49:30 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -756,7 +756,7 @@ invalid.js:49:30 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:50:37 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:50:37 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -771,7 +771,7 @@ invalid.js:50:37 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:50:71 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:50:71 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -786,7 +786,7 @@ invalid.js:50:71 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:51:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:51:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -801,7 +801,7 @@ invalid.js:51:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:51:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:51:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -816,7 +816,7 @@ invalid.js:51:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:52:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:52:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -831,7 +831,7 @@ invalid.js:52:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:53:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:53:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -846,7 +846,7 @@ invalid.js:53:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:54:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:54:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -861,7 +861,7 @@ invalid.js:54:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:55:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:55:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -876,7 +876,7 @@ invalid.js:55:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:56:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:56:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -891,7 +891,7 @@ invalid.js:56:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:57:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:57:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -906,7 +906,7 @@ invalid.js:57:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:58:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:58:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -921,7 +921,7 @@ invalid.js:58:20 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:59:37 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:59:37 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -936,7 +936,7 @@ invalid.js:59:37 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:60:30 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:60:30 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -951,7 +951,7 @@ invalid.js:60:30 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:61:37 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:61:37 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -966,7 +966,7 @@ invalid.js:61:37 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:61:71 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:61:71 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. @@ -981,7 +981,7 @@ invalid.js:61:71 lint/nursery/useIsNan ━━━━━━━━━━━━━ ``` ``` -invalid.js:62:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:62:8 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch. @@ -995,7 +995,7 @@ invalid.js:62:8 lint/nursery/useIsNan ━━━━━━━━━━━━━━ ``` ``` -invalid.js:62:27 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:62:27 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! 'case NaN' can never match. Use Number.isNaN before the switch. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useIsNan/valid.js b/crates/rome_js_analyze/tests/specs/correctness/useIsNan/valid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useIsNan/valid.js rename to crates/rome_js_analyze/tests/specs/correctness/useIsNan/valid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/useIsNan/valid.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useIsNan/valid.js.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/useIsNan/valid.js.snap rename to crates/rome_js_analyze/tests/specs/correctness/useIsNan/valid.js.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js deleted file mode 100644 index 2f8b2073eaf..00000000000 --- a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js +++ /dev/null @@ -1,47 +0,0 @@ -let snake_case; -snake_case = 1; -let _snake_case; -console.log(_snake_case); - -function snake_function(snake_case, PascalCase) {} - -class PascalCase { - snake_property = 1; - #private_snake_property = 2; - #validPrivateMember = 3; - - snake_function() {} - - get snake_getter() {} - set snake_setter(v) { - console.log(v); - } -} - -console.log({ - snake_function() {}, - get snake_getter() {}, - set snake_setter(v) { - console.log(v); - }, -}); - -let camelCase; -let longCamelCase; - -let UPPER_CASE = 1; -let { UPPER_CASE } = env; -let [ UPPER_CASE ] = env; - -const THIS_IS_OK = 1; -const { THIS_IS_OK } = env; -const [ THIS_IS_OK ] = env; - -function PascalCaseOkBecauseNew() { } -console.log(new PascalCaseOkBecauseNew()); - -function PascalCaseOkBecauseExport() { } -export default PascalCaseOkBecauseExport; - -function PascalCaseNOk() { } -console.log(PascalCaseNOk()); diff --git a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap deleted file mode 100644 index 4e793a2f3f2..00000000000 --- a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap +++ /dev/null @@ -1,274 +0,0 @@ ---- -source: crates/rome_js_analyze/tests/spec_tests.rs -expression: useCamelCase.js ---- -# Input -```js -let snake_case; -snake_case = 1; -let _snake_case; -console.log(_snake_case); - -function snake_function(snake_case, PascalCase) {} - -class PascalCase { - snake_property = 1; - #private_snake_property = 2; - #validPrivateMember = 3; - - snake_function() {} - - get snake_getter() {} - set snake_setter(v) { - console.log(v); - } -} - -console.log({ - snake_function() {}, - get snake_getter() {}, - set snake_setter(v) { - console.log(v); - }, -}); - -let camelCase; -let longCamelCase; - -let UPPER_CASE = 1; -let { UPPER_CASE } = env; -let [ UPPER_CASE ] = env; - -const THIS_IS_OK = 1; -const { THIS_IS_OK } = env; -const [ THIS_IS_OK ] = env; - -function PascalCaseOkBecauseNew() { } -console.log(new PascalCaseOkBecauseNew()); - -function PascalCaseOkBecauseExport() { } -export default PascalCaseOkBecauseExport; - -function PascalCaseNOk() { } -console.log(PascalCaseNOk()); - -``` - -# Diagnostics -``` -useCamelCase.js:1:5 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer variables names in camel case. - - > 1 │ let snake_case; - │ ^^^^^^^^^^ - 2 │ snake_case = 1; - 3 │ let _snake_case; - - i Safe fix: Rename this symbol to camel case - - 1 │ - let·snake_case; - 2 │ - snake_case·=·1; - 1 │ + let·snakeCase; - 2 │ + snakeCase·=·1; - 3 3 │ let _snake_case; - 4 4 │ console.log(_snake_case); - - -``` - -``` -useCamelCase.js:6:10 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer functions names in camel case. - - 4 │ console.log(_snake_case); - 5 │ - > 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^^^^^ - 7 │ - 8 │ class PascalCase { - - i Safe fix: Rename this symbol to camel case - - 4 4 │ console.log(_snake_case); - 5 5 │ - 6 │ - function·snake_function(snake_case,·PascalCase)·{} - 6 │ + function·snakeFunction(snake_case,·PascalCase)·{} - 7 7 │ - 8 8 │ class PascalCase { - - -``` - -``` -useCamelCase.js:6:25 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer parameters names in camel case. - - 4 │ console.log(_snake_case); - 5 │ - > 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^ - 7 │ - 8 │ class PascalCase { - - i Safe fix: Rename this symbol to camel case - - 4 4 │ console.log(_snake_case); - 5 5 │ - 6 │ - function·snake_function(snake_case,·PascalCase)·{} - 6 │ + function·snake_function(snakeCase,·PascalCase)·{} - 7 7 │ - 8 8 │ class PascalCase { - - -``` - -``` -useCamelCase.js:6:37 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer parameters names in camel case. - - 4 │ console.log(_snake_case); - 5 │ - > 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^ - 7 │ - 8 │ class PascalCase { - - i Safe fix: Rename this symbol to camel case - - 4 4 │ console.log(_snake_case); - 5 5 │ - 6 │ - function·snake_function(snake_case,·PascalCase)·{} - 6 │ + function·snake_function(snake_case,·pascalCase)·{} - 7 7 │ - 8 8 │ class PascalCase { - - -``` - -``` -useCamelCase.js:9:2 lint/nursery/useCamelCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer properties names in camel case. - - 8 │ class PascalCase { - > 9 │ snake_property = 1; - │ ^^^^^^^^^^^^^^ - 10 │ #private_snake_property = 2; - 11 │ #validPrivateMember = 3; - - -``` - -``` -useCamelCase.js:10:2 lint/nursery/useCamelCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer properties names in camel case. - - 8 │ class PascalCase { - 9 │ snake_property = 1; - > 10 │ #private_snake_property = 2; - │ ^^^^^^^^^^^^^^^^^^^^^^^ - 11 │ #validPrivateMember = 3; - 12 │ - - -``` - -``` -useCamelCase.js:13:2 lint/nursery/useCamelCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer methods names in camel case. - - 11 │ #validPrivateMember = 3; - 12 │ - > 13 │ snake_function() {} - │ ^^^^^^^^^^^^^^ - 14 │ - 15 │ get snake_getter() {} - - -``` - -``` -useCamelCase.js:15:6 lint/nursery/useCamelCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer methods names in camel case. - - 13 │ snake_function() {} - 14 │ - > 15 │ get snake_getter() {} - │ ^^^^^^^^^^^^ - 16 │ set snake_setter(v) { - 17 │ console.log(v); - - -``` - -``` -useCamelCase.js:16:6 lint/nursery/useCamelCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer methods names in camel case. - - 15 │ get snake_getter() {} - > 16 │ set snake_setter(v) { - │ ^^^^^^^^^^^^ - 17 │ console.log(v); - 18 │ } - - -``` - -``` -useCamelCase.js:32:5 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer variables names in camel case. - - 30 │ let longCamelCase; - 31 │ - > 32 │ let UPPER_CASE = 1; - │ ^^^^^^^^^^ - 33 │ let { UPPER_CASE } = env; - 34 │ let [ UPPER_CASE ] = env; - - i Safe fix: Rename this symbol to camel case - - 30 30 │ let longCamelCase; - 31 31 │ - 32 │ - let·UPPER_CASE·=·1; - 32 │ + let·uPPERCASE·=·1; - 33 33 │ let { UPPER_CASE } = env; - 34 34 │ let [ UPPER_CASE ] = env; - - -``` - -``` -useCamelCase.js:46:10 lint/nursery/useCamelCase FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Prefer functions names in camel case. - - 44 │ export default PascalCaseOkBecauseExport; - 45 │ - > 46 │ function PascalCaseNOk() { } - │ ^^^^^^^^^^^^^ - 47 │ console.log(PascalCaseNOk()); - 48 │ - - i Safe fix: Rename this symbol to camel case - - 44 44 │ export default PascalCaseOkBecauseExport; - 45 45 │ - 46 │ - function·PascalCaseNOk()·{·} - 47 │ - console.log(PascalCaseNOk()); - 46 │ + function·pascalCaseNOk()·{·} - 47 │ + console.log(pascalCaseNOk()); - 48 48 │ - - -``` - - diff --git a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx deleted file mode 100644 index 95aee0912f0..00000000000 --- a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx +++ /dev/null @@ -1,5 +0,0 @@ -// valid -function Component() {} -foo -export function ExportComponent() {} -export default function ExportDefaultComponent() {} diff --git a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx.snap deleted file mode 100644 index 20f55b12e8a..00000000000 --- a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.jsx.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: crates/rome_js_analyze/tests/spec_tests.rs -expression: useCamelCase.jsx ---- -# Input -```js -// valid -function Component() {} -foo -export function ExportComponent() {} -export default function ExportDefaultComponent() {} - -``` - - diff --git a/crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/invalid.js b/crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/invalid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/invalid.js rename to crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/invalid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/invalid.js.snap b/crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/invalid.js.snap similarity index 84% rename from crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/invalid.js.snap rename to crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/invalid.js.snap index 668b5214e7c..8786a71bb11 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/invalid.js.snap @@ -10,7 +10,7 @@ console.log("something") # Diagnostics ``` -invalid.js:1:1 lint/nursery/noConsoleLog ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:1:1 lint/suspicious/noConsoleLog ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Don't use console.log diff --git a/crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/valid.js b/crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/valid.js similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/valid.js rename to crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/valid.js diff --git a/crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/valid.js.snap b/crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/valid.js.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noConsoleLog/valid.js.snap rename to crates/rome_js_analyze/tests/specs/suspicious/noConsoleLog/valid.js.snap diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/invalid.jsx b/crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/invalid.jsx similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/invalid.jsx rename to crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/invalid.jsx diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/invalid.jsx.snap b/crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/invalid.jsx.snap similarity index 91% rename from crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/invalid.jsx.snap rename to crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/invalid.jsx.snap index 7493286030b..0605329ee8b 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/invalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/invalid.jsx.snap @@ -22,7 +22,7 @@ expression: invalid.jsx # Diagnostics ``` -invalid.jsx:2:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:2:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. @@ -44,7 +44,7 @@ invalid.jsx:2:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━ ``` ``` -invalid.jsx:5:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:5:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. @@ -66,7 +66,7 @@ invalid.jsx:5:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━ ``` ``` -invalid.jsx:8:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:8:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. @@ -96,7 +96,7 @@ invalid.jsx:8:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━ ``` ``` -invalid.jsx:11:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:11:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. @@ -118,7 +118,7 @@ invalid.jsx:11:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━ ``` ``` -invalid.jsx:11:32 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:11:32 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. @@ -140,7 +140,7 @@ invalid.jsx:11:32 lint/nursery/noDuplicateJsxProps ━━━━━━━━━ ``` ``` -invalid.jsx:13:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:13:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! This JSX property is assigned multiple times. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/valid.jsx b/crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/valid.jsx similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/valid.jsx rename to crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/valid.jsx diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/valid.jsx.snap b/crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/valid.jsx.snap similarity index 100% rename from crates/rome_js_analyze/tests/specs/nursery/noDuplicateJsxProps/valid.jsx.snap rename to crates/rome_js_analyze/tests/specs/suspicious/noDuplicateJsxProps/valid.jsx.snap diff --git a/crates/rome_service/src/configuration/linter/rules.rs b/crates/rome_service/src/configuration/linter/rules.rs index 832ee742741..31123c79f90 100644 --- a/crates/rome_service/src/configuration/linter/rules.rs +++ b/crates/rome_service/src/configuration/linter/rules.rs @@ -414,6 +414,10 @@ pub struct A11y { #[bpaf(long("use-button-type"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub use_button_type: Option, + #[doc = "Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop."] + #[bpaf(long("use-heading-content"), argument("on|off|warn"), optional, hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub use_heading_content: Option, #[doc = "Enforce that html element has lang attribute."] #[bpaf(long("use-html-lang"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] @@ -459,7 +463,7 @@ pub struct A11y { } impl A11y { const GROUP_NAME: &'static str = "a11y"; - pub(crate) const GROUP_RULES: [&'static str; 21] = [ + pub(crate) const GROUP_RULES: [&'static str; 22] = [ "noAccessKey", "noAutofocus", "noBlankTarget", @@ -473,6 +477,7 @@ impl A11y { "useAnchorContent", "useAriaPropsForRole", "useButtonType", + "useHeadingContent", "useHtmlLang", "useIframeTitle", "useKeyWithClickEvents", @@ -517,7 +522,6 @@ impl A11y { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16]), @@ -525,8 +529,9 @@ impl A11y { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21]), ]; - const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 21] = [ + const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 22] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -548,6 +553,7 @@ impl A11y { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21]), ]; #[doc = r" Retrieves the recommended rules"] pub(crate) fn is_recommended(&self) -> bool { matches!(self.recommended, Some(true)) } @@ -623,46 +629,51 @@ impl A11y { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } - if let Some(rule) = self.use_html_lang.as_ref() { + if let Some(rule) = self.use_heading_content.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } - if let Some(rule) = self.use_iframe_title.as_ref() { + if let Some(rule) = self.use_html_lang.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } - if let Some(rule) = self.use_key_with_click_events.as_ref() { + if let Some(rule) = self.use_iframe_title.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } - if let Some(rule) = self.use_key_with_mouse_events.as_ref() { + if let Some(rule) = self.use_key_with_click_events.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } - if let Some(rule) = self.use_media_caption.as_ref() { + if let Some(rule) = self.use_key_with_mouse_events.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } - if let Some(rule) = self.use_valid_anchor.as_ref() { + if let Some(rule) = self.use_media_caption.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } - if let Some(rule) = self.use_valid_aria_props.as_ref() { + if let Some(rule) = self.use_valid_anchor.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } - if let Some(rule) = self.use_valid_lang.as_ref() { + if let Some(rule) = self.use_valid_aria_props.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } + if let Some(rule) = self.use_valid_lang.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); + } + } index_set } pub(crate) fn get_disabled_rules(&self) -> IndexSet { @@ -732,46 +743,51 @@ impl A11y { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } - if let Some(rule) = self.use_html_lang.as_ref() { + if let Some(rule) = self.use_heading_content.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } - if let Some(rule) = self.use_iframe_title.as_ref() { + if let Some(rule) = self.use_html_lang.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } - if let Some(rule) = self.use_key_with_click_events.as_ref() { + if let Some(rule) = self.use_iframe_title.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } - if let Some(rule) = self.use_key_with_mouse_events.as_ref() { + if let Some(rule) = self.use_key_with_click_events.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } - if let Some(rule) = self.use_media_caption.as_ref() { + if let Some(rule) = self.use_key_with_mouse_events.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } - if let Some(rule) = self.use_valid_anchor.as_ref() { + if let Some(rule) = self.use_media_caption.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } - if let Some(rule) = self.use_valid_aria_props.as_ref() { + if let Some(rule) = self.use_valid_anchor.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } - if let Some(rule) = self.use_valid_lang.as_ref() { + if let Some(rule) = self.use_valid_aria_props.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } + if let Some(rule) = self.use_valid_lang.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); + } + } index_set } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] @@ -783,7 +799,7 @@ impl A11y { pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 20] { Self::RECOMMENDED_RULES_AS_FILTERS } - pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 21] { Self::ALL_RULES_AS_FILTERS } + pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 22] { Self::ALL_RULES_AS_FILTERS } #[doc = r" Select preset rules"] pub(crate) fn collect_preset_rules( &self, @@ -819,6 +835,7 @@ impl A11y { "useAnchorContent" => self.use_anchor_content.as_ref(), "useAriaPropsForRole" => self.use_aria_props_for_role.as_ref(), "useButtonType" => self.use_button_type.as_ref(), + "useHeadingContent" => self.use_heading_content.as_ref(), "useHtmlLang" => self.use_html_lang.as_ref(), "useIframeTitle" => self.use_iframe_title.as_ref(), "useKeyWithClickEvents" => self.use_key_with_click_events.as_ref(), @@ -848,6 +865,10 @@ pub struct Complexity { #[bpaf(long("no-extra-boolean-cast"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub no_extra_boolean_cast: Option, + #[doc = "Prefer for...of statement instead of Array.forEach."] + #[bpaf(long("no-for-each"), argument("on|off|warn"), optional, hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub no_for_each: Option, #[doc = "Disallow unclear usage of multiple space characters in regular expression literals"] #[bpaf( long("no-multiple-spaces-in-regular-expression-literals"), @@ -908,10 +929,23 @@ pub struct Complexity { #[bpaf(long("use-flat-map"), argument("on|off|warn"), optional, hide)] #[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."] + #[bpaf(long("use-literal-keys"), argument("on|off|warn"), optional, hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub use_literal_keys: Option, #[doc = "Enforce using concise optional chain instead of chained logical expressions."] #[bpaf(long("use-optional-chain"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub use_optional_chain: Option, + #[doc = "Disallow number literal object member names which are not base10 or uses underscore as separator"] + #[bpaf( + long("use-simple-number-keys"), + argument("on|off|warn"), + optional, + hide + )] + #[serde(skip_serializing_if = "Option::is_none")] + pub use_simple_number_keys: Option, #[doc = "Discard redundant terms from logical expressions."] #[bpaf( long("use-simplified-logic-expression"), @@ -924,8 +958,9 @@ pub struct Complexity { } impl Complexity { const GROUP_NAME: &'static str = "complexity"; - pub(crate) const GROUP_RULES: [&'static str; 13] = [ + pub(crate) const GROUP_RULES: [&'static str; 16] = [ "noExtraBooleanCast", + "noForEach", "noMultipleSpacesInRegularExpressionLiterals", "noUselessCatch", "noUselessConstructor", @@ -936,27 +971,31 @@ impl Complexity { "noUselessTypeConstraint", "noWith", "useFlatMap", + "useLiteralKeys", "useOptionalChain", + "useSimpleNumberKeys", "useSimplifiedLogicExpression", ]; - const RECOMMENDED_RULES: [&'static str; 11] = [ + const RECOMMENDED_RULES: [&'static str; 13] = [ "noExtraBooleanCast", "noMultipleSpacesInRegularExpressionLiterals", "noUselessCatch", "noUselessConstructor", + "noUselessFragments", "noUselessLabel", "noUselessRename", "noUselessSwitchCase", "noUselessTypeConstraint", "noWith", "useFlatMap", + "useLiteralKeys", "useOptionalChain", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 11] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 13] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7]), @@ -964,8 +1003,10 @@ impl Complexity { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13]), ]; - const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 13] = [ + const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 16] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -979,6 +1020,9 @@ impl Complexity { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15]), ]; #[doc = r" Retrieves the recommended rules"] pub(crate) fn is_recommended(&self) -> bool { matches!(self.recommended, Some(true)) } @@ -994,67 +1038,82 @@ impl Complexity { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0])); } } + if let Some(rule) = self.no_for_each.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1])); + } + } if let Some(rule) = self .no_multiple_spaces_in_regular_expression_literals .as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2])); } } if let Some(rule) = self.no_useless_catch.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); } } if let Some(rule) = self.no_useless_constructor.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); } } if let Some(rule) = self.no_useless_fragments.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); } } if let Some(rule) = self.no_useless_label.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); } } if let Some(rule) = self.no_useless_rename.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } if let Some(rule) = self.no_useless_switch_case.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } if let Some(rule) = self.no_useless_type_constraint.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } if let Some(rule) = self.no_with.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } if let Some(rule) = self.use_flat_map.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + } + } + if let Some(rule) = self.use_literal_keys.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } if let Some(rule) = self.use_optional_chain.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); + } + } + if let Some(rule) = self.use_simple_number_keys.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } if let Some(rule) = self.use_simplified_logic_expression.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } index_set @@ -1066,67 +1125,82 @@ impl Complexity { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0])); } } + if let Some(rule) = self.no_for_each.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1])); + } + } if let Some(rule) = self .no_multiple_spaces_in_regular_expression_literals .as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2])); } } if let Some(rule) = self.no_useless_catch.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); } } if let Some(rule) = self.no_useless_constructor.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); } } if let Some(rule) = self.no_useless_fragments.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); } } if let Some(rule) = self.no_useless_label.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); } } if let Some(rule) = self.no_useless_rename.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } if let Some(rule) = self.no_useless_switch_case.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } if let Some(rule) = self.no_useless_type_constraint.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } if let Some(rule) = self.no_with.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } if let Some(rule) = self.use_flat_map.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + } + } + if let Some(rule) = self.use_literal_keys.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } if let Some(rule) = self.use_optional_chain.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); + } + } + if let Some(rule) = self.use_simple_number_keys.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } if let Some(rule) = self.use_simplified_logic_expression.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } index_set @@ -1137,10 +1211,10 @@ impl Complexity { pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 11] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 13] { Self::RECOMMENDED_RULES_AS_FILTERS } - pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 13] { Self::ALL_RULES_AS_FILTERS } + pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 16] { Self::ALL_RULES_AS_FILTERS } #[doc = r" Select preset rules"] pub(crate) fn collect_preset_rules( &self, @@ -1162,6 +1236,7 @@ impl Complexity { pub(crate) fn get_rule_configuration(&self, rule_name: &str) -> Option<&RuleConfiguration> { match rule_name { "noExtraBooleanCast" => self.no_extra_boolean_cast.as_ref(), + "noForEach" => self.no_for_each.as_ref(), "noMultipleSpacesInRegularExpressionLiterals" => self .no_multiple_spaces_in_regular_expression_literals .as_ref(), @@ -1174,7 +1249,9 @@ impl Complexity { "noUselessTypeConstraint" => self.no_useless_type_constraint.as_ref(), "noWith" => self.no_with.as_ref(), "useFlatMap" => self.use_flat_map.as_ref(), + "useLiteralKeys" => self.use_literal_keys.as_ref(), "useOptionalChain" => self.use_optional_chain.as_ref(), + "useSimpleNumberKeys" => self.use_simple_number_keys.as_ref(), "useSimplifiedLogicExpression" => self.use_simplified_logic_expression.as_ref(), _ => None, } @@ -1330,6 +1407,10 @@ pub struct Correctness { #[bpaf(long("no-void-type-return"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub no_void_type_return: Option, + #[doc = "Require calls to isNaN() when checking for NaN."] + #[bpaf(long("use-is-nan"), argument("on|off|warn"), optional, hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub use_is_nan: Option, #[doc = "Enforce \"for\" loop update clause moving the counter in the right direction."] #[bpaf( long("use-valid-for-direction"), @@ -1346,7 +1427,7 @@ pub struct Correctness { } impl Correctness { const GROUP_NAME: &'static str = "correctness"; - pub(crate) const GROUP_RULES: [&'static str; 25] = [ + pub(crate) const GROUP_RULES: [&'static str; 26] = [ "noChildrenProp", "noConstAssign", "noConstructorReturn", @@ -1370,10 +1451,11 @@ impl Correctness { "noUnusedVariables", "noVoidElementsWithChildren", "noVoidTypeReturn", + "useIsNan", "useValidForDirection", "useYield", ]; - const RECOMMENDED_RULES: [&'static str; 23] = [ + const RECOMMENDED_RULES: [&'static str; 24] = [ "noChildrenProp", "noConstAssign", "noConstructorReturn", @@ -1395,10 +1477,11 @@ impl Correctness { "noUnusedLabels", "noVoidElementsWithChildren", "noVoidTypeReturn", + "useIsNan", "useValidForDirection", "useYield", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 23] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 24] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -1422,8 +1505,9 @@ impl Correctness { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25]), ]; - const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 25] = [ + const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 26] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -1449,6 +1533,7 @@ impl Correctness { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25]), ]; #[doc = r" Retrieves the recommended rules"] pub(crate) fn is_recommended(&self) -> bool { matches!(self.recommended, Some(true)) } @@ -1574,16 +1659,21 @@ impl Correctness { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } - if let Some(rule) = self.use_valid_for_direction.as_ref() { + if let Some(rule) = self.use_is_nan.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } - if let Some(rule) = self.use_yield.as_ref() { + if let Some(rule) = self.use_valid_for_direction.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } + if let Some(rule) = self.use_yield.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); + } + } index_set } pub(crate) fn get_disabled_rules(&self) -> IndexSet { @@ -1703,16 +1793,21 @@ impl Correctness { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } - if let Some(rule) = self.use_valid_for_direction.as_ref() { + if let Some(rule) = self.use_is_nan.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } - if let Some(rule) = self.use_yield.as_ref() { + if let Some(rule) = self.use_valid_for_direction.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } + if let Some(rule) = self.use_yield.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); + } + } index_set } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] @@ -1721,10 +1816,10 @@ impl Correctness { pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 23] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 24] { Self::RECOMMENDED_RULES_AS_FILTERS } - pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 25] { Self::ALL_RULES_AS_FILTERS } + pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 26] { Self::ALL_RULES_AS_FILTERS } #[doc = r" Select preset rules"] pub(crate) fn collect_preset_rules( &self, @@ -1768,6 +1863,7 @@ impl Correctness { "noUnusedVariables" => self.no_unused_variables.as_ref(), "noVoidElementsWithChildren" => self.no_void_elements_with_children.as_ref(), "noVoidTypeReturn" => self.no_void_type_return.as_ref(), + "useIsNan" => self.use_is_nan.as_ref(), "useValidForDirection" => self.use_valid_for_direction.as_ref(), "useYield" => self.use_yield.as_ref(), _ => None, @@ -1813,10 +1909,6 @@ pub struct Nursery { #[bpaf(long("no-confusing-arrow"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub no_confusing_arrow: Option, - #[doc = "Disallow the use of console.log"] - #[bpaf(long("no-console-log"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_console_log: Option, #[doc = "Disallow constant expressions in conditions"] #[bpaf(long("no-constant-condition"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] @@ -1839,15 +1931,6 @@ pub struct Nursery { )] #[serde(skip_serializing_if = "Option::is_none")] pub no_duplicate_json_keys: Option, - #[doc = "Prevents JSX properties to be assigned multiple times."] - #[bpaf( - long("no-duplicate-jsx-props"), - argument("on|off|warn"), - optional, - hide - )] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_duplicate_jsx_props: Option, #[doc = "Disallow functions that exceed a given complexity score."] #[bpaf( long("no-excessive-complexity"), @@ -1866,10 +1949,6 @@ pub struct Nursery { )] #[serde(skip_serializing_if = "Option::is_none")] pub no_fallthrough_switch_clause: Option, - #[doc = "Prefer for...of statement instead of Array.forEach."] - #[bpaf(long("no-for-each"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub no_for_each: Option, #[doc = "Use Number.isFinite instead of global isFinite."] #[bpaf(long("no-global-is-finite"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] @@ -1938,10 +2017,6 @@ pub struct Nursery { #[bpaf(long("use-arrow-function"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub use_arrow_function: Option, - #[doc = "Enforce camel case naming convention."] - #[bpaf(long("use-camel-case"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_camel_case: Option, #[doc = "Enforce all dependencies are correctly specified."] #[bpaf( long("use-exhaustive-dependencies"), @@ -1960,10 +2035,6 @@ pub struct Nursery { )] #[serde(skip_serializing_if = "Option::is_none")] pub use_grouped_type_import: 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."] - #[bpaf(long("use-heading-content"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_heading_content: Option, #[doc = "Enforce that all React hooks are being called from the Top Level component functions."] #[bpaf(long("use-hook-at-top-level"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] @@ -1981,10 +2052,6 @@ pub struct Nursery { #[bpaf(long("use-is-array"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub use_is_array: Option, - #[doc = "Require calls to isNaN() when checking for NaN."] - #[bpaf(long("use-is-nan"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_is_nan: Option, #[doc = "Require all enum members to be literal values."] #[bpaf( long("use-literal-enum-members"), @@ -1994,39 +2061,23 @@ pub struct Nursery { )] #[serde(skip_serializing_if = "Option::is_none")] pub use_literal_enum_members: Option, - #[doc = "Enforce the usage of a literal access to properties over computed property access."] - #[bpaf(long("use-literal-keys"), argument("on|off|warn"), optional, hide)] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_literal_keys: Option, #[doc = "Enforce naming conventions for everything across a codebase."] #[bpaf(long("use-naming-convention"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub use_naming_convention: Option, - #[doc = "Disallow number literal object member names which are not base10 or uses underscore as separator"] - #[bpaf( - long("use-simple-number-keys"), - argument("on|off|warn"), - optional, - hide - )] - #[serde(skip_serializing_if = "Option::is_none")] - pub use_simple_number_keys: Option, } impl Nursery { const GROUP_NAME: &'static str = "nursery"; - pub(crate) const GROUP_RULES: [&'static str; 36] = [ + pub(crate) const GROUP_RULES: [&'static str; 28] = [ "noAccumulatingSpread", "noAriaUnsupportedElements", "noBannedTypes", "noConfusingArrow", - "noConsoleLog", "noConstantCondition", "noControlCharactersInRegex", "noDuplicateJsonKeys", - "noDuplicateJsxProps", "noExcessiveComplexity", "noFallthroughSwitchClause", - "noForEach", "noGlobalIsFinite", "noGlobalIsNan", "noNoninteractiveTabindex", @@ -2039,26 +2090,20 @@ impl Nursery { "noVoid", "useAriaPropTypes", "useArrowFunction", - "useCamelCase", "useExhaustiveDependencies", "useGroupedTypeImport", - "useHeadingContent", "useHookAtTopLevel", "useImportRestrictions", "useIsArray", - "useIsNan", "useLiteralEnumMembers", - "useLiteralKeys", "useNamingConvention", - "useSimpleNumberKeys", ]; - const RECOMMENDED_RULES: [&'static str; 21] = [ + const RECOMMENDED_RULES: [&'static str; 18] = [ "noAriaUnsupportedElements", "noBannedTypes", "noConstantCondition", "noControlCharactersInRegex", "noDuplicateJsonKeys", - "noDuplicateJsxProps", "noGlobalIsFinite", "noGlobalIsNan", "noNonoctalDecimalEscape", @@ -2071,34 +2116,29 @@ impl Nursery { "useExhaustiveDependencies", "useGroupedTypeImport", "useIsArray", - "useIsNan", "useLiteralEnumMembers", - "useLiteralKeys", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 21] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 18] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[33]), ]; - const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 36] = [ + const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 28] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -2127,14 +2167,6 @@ impl Nursery { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[33]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[34]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[35]), ]; #[doc = r" Retrieves the recommended rules"] pub(crate) fn is_recommended(&self) -> bool { matches!(self.recommended, Some(true)) } @@ -2165,164 +2197,124 @@ impl Nursery { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); } } - if let Some(rule) = self.no_console_log.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); - } - } if let Some(rule) = self.no_constant_condition.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); } } if let Some(rule) = self.no_control_characters_in_regex.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); } } if let Some(rule) = self.no_duplicate_json_keys.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); - } - } - if let Some(rule) = self.no_duplicate_jsx_props.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); } } if let Some(rule) = self.no_excessive_complexity.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } if let Some(rule) = self.no_fallthrough_switch_clause.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); - } - } - if let Some(rule) = self.no_for_each.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } if let Some(rule) = self.no_global_is_finite.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } if let Some(rule) = self.no_global_is_nan.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } if let Some(rule) = self.no_noninteractive_tabindex.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); } } if let Some(rule) = self.no_nonoctal_decimal_escape.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } if let Some(rule) = self.no_redundant_roles.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } if let Some(rule) = self.no_self_assign.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } if let Some(rule) = self.no_static_only_class.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } if let Some(rule) = self.no_unsafe_declaration_merging.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } if let Some(rule) = self.no_useless_empty_export.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } if let Some(rule) = self.no_void.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } if let Some(rule) = self.use_aria_prop_types.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } if let Some(rule) = self.use_arrow_function.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); - } - } - if let Some(rule) = self.use_camel_case.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } if let Some(rule) = self.use_exhaustive_dependencies.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); - } - } - if let Some(rule) = self.use_grouped_type_import.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); } } - if let Some(rule) = self.use_heading_content.as_ref() { + if let Some(rule) = self.use_grouped_type_import.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } if let Some(rule) = self.use_hook_at_top_level.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } if let Some(rule) = self.use_import_restrictions.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } if let Some(rule) = self.use_is_array.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30])); - } - } - if let Some(rule) = self.use_is_nan.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); } } if let Some(rule) = self.use_literal_enum_members.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32])); - } - } - if let Some(rule) = self.use_literal_keys.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[33])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); } } if let Some(rule) = self.use_naming_convention.as_ref() { if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[34])); - } - } - if let Some(rule) = self.use_simple_number_keys.as_ref() { - if rule.is_enabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[35])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); } } index_set @@ -2349,164 +2341,124 @@ impl Nursery { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3])); } } - if let Some(rule) = self.no_console_log.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); - } - } if let Some(rule) = self.no_constant_condition.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[4])); } } if let Some(rule) = self.no_control_characters_in_regex.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5])); } } if let Some(rule) = self.no_duplicate_json_keys.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); - } - } - if let Some(rule) = self.no_duplicate_jsx_props.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6])); } } if let Some(rule) = self.no_excessive_complexity.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } if let Some(rule) = self.no_fallthrough_switch_clause.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); - } - } - if let Some(rule) = self.no_for_each.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } if let Some(rule) = self.no_global_is_finite.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } if let Some(rule) = self.no_global_is_nan.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } if let Some(rule) = self.no_noninteractive_tabindex.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); } } if let Some(rule) = self.no_nonoctal_decimal_escape.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } if let Some(rule) = self.no_redundant_roles.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } if let Some(rule) = self.no_self_assign.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } if let Some(rule) = self.no_static_only_class.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } if let Some(rule) = self.no_unsafe_declaration_merging.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } if let Some(rule) = self.no_useless_empty_export.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } if let Some(rule) = self.no_void.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } if let Some(rule) = self.use_aria_prop_types.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } if let Some(rule) = self.use_arrow_function.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); - } - } - if let Some(rule) = self.use_camel_case.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } if let Some(rule) = self.use_exhaustive_dependencies.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); } } if let Some(rule) = self.use_grouped_type_import.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); - } - } - if let Some(rule) = self.use_heading_content.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } if let Some(rule) = self.use_hook_at_top_level.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } if let Some(rule) = self.use_import_restrictions.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } if let Some(rule) = self.use_is_array.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30])); - } - } - if let Some(rule) = self.use_is_nan.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); } } if let Some(rule) = self.use_literal_enum_members.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32])); - } - } - if let Some(rule) = self.use_literal_keys.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[33])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); } } if let Some(rule) = self.use_naming_convention.as_ref() { if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[34])); - } - } - if let Some(rule) = self.use_simple_number_keys.as_ref() { - if rule.is_disabled() { - index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[35])); + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); } } index_set @@ -2517,10 +2469,10 @@ impl Nursery { pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 21] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 18] { Self::RECOMMENDED_RULES_AS_FILTERS } - pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 36] { Self::ALL_RULES_AS_FILTERS } + pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 28] { Self::ALL_RULES_AS_FILTERS } #[doc = r" Select preset rules"] pub(crate) fn collect_preset_rules( &self, @@ -2545,14 +2497,11 @@ impl Nursery { "noAriaUnsupportedElements" => self.no_aria_unsupported_elements.as_ref(), "noBannedTypes" => self.no_banned_types.as_ref(), "noConfusingArrow" => self.no_confusing_arrow.as_ref(), - "noConsoleLog" => self.no_console_log.as_ref(), "noConstantCondition" => self.no_constant_condition.as_ref(), "noControlCharactersInRegex" => self.no_control_characters_in_regex.as_ref(), "noDuplicateJsonKeys" => self.no_duplicate_json_keys.as_ref(), - "noDuplicateJsxProps" => self.no_duplicate_jsx_props.as_ref(), "noExcessiveComplexity" => self.no_excessive_complexity.as_ref(), "noFallthroughSwitchClause" => self.no_fallthrough_switch_clause.as_ref(), - "noForEach" => self.no_for_each.as_ref(), "noGlobalIsFinite" => self.no_global_is_finite.as_ref(), "noGlobalIsNan" => self.no_global_is_nan.as_ref(), "noNoninteractiveTabindex" => self.no_noninteractive_tabindex.as_ref(), @@ -2565,18 +2514,13 @@ impl Nursery { "noVoid" => self.no_void.as_ref(), "useAriaPropTypes" => self.use_aria_prop_types.as_ref(), "useArrowFunction" => self.use_arrow_function.as_ref(), - "useCamelCase" => self.use_camel_case.as_ref(), "useExhaustiveDependencies" => self.use_exhaustive_dependencies.as_ref(), "useGroupedTypeImport" => self.use_grouped_type_import.as_ref(), - "useHeadingContent" => self.use_heading_content.as_ref(), "useHookAtTopLevel" => self.use_hook_at_top_level.as_ref(), "useImportRestrictions" => self.use_import_restrictions.as_ref(), "useIsArray" => self.use_is_array.as_ref(), - "useIsNan" => self.use_is_nan.as_ref(), "useLiteralEnumMembers" => self.use_literal_enum_members.as_ref(), - "useLiteralKeys" => self.use_literal_keys.as_ref(), "useNamingConvention" => self.use_naming_convention.as_ref(), - "useSimpleNumberKeys" => self.use_simple_number_keys.as_ref(), _ => None, } } @@ -2978,7 +2922,7 @@ impl Style { "useTemplate", "useWhile", ]; - const RECOMMENDED_RULES: [&'static str; 15] = [ + const RECOMMENDED_RULES: [&'static str; 16] = [ "noArguments", "noCommaOperator", "noInferrableTypes", @@ -2989,13 +2933,14 @@ impl Style { "useConst", "useDefaultParameterLast", "useEnumInitializers", + "useExponentiationOperator", "useNumericLiterals", "useSelfClosingElements", "useSingleVarDeclarator", "useTemplate", "useWhile", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 15] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 16] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[3]), @@ -3006,6 +2951,7 @@ impl Style { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23]), @@ -3321,7 +3267,7 @@ impl Style { pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 15] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 16] { Self::RECOMMENDED_RULES_AS_FILTERS } pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 26] { Self::ALL_RULES_AS_FILTERS } @@ -3430,6 +3376,10 @@ pub struct Suspicious { #[bpaf(long("no-confusing-labels"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] pub no_confusing_labels: Option, + #[doc = "Disallow the use of console.log"] + #[bpaf(long("no-console-log"), argument("on|off|warn"), optional, hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub no_console_log: Option, #[doc = "Disallow TypeScript const enum"] #[bpaf(long("no-const-enum"), argument("on|off|warn"), optional, hide)] #[serde(skip_serializing_if = "Option::is_none")] @@ -3455,6 +3405,15 @@ pub struct Suspicious { )] #[serde(skip_serializing_if = "Option::is_none")] pub no_duplicate_class_members: Option, + #[doc = "Prevents JSX properties to be assigned multiple times."] + #[bpaf( + long("no-duplicate-jsx-props"), + argument("on|off|warn"), + optional, + hide + )] + #[serde(skip_serializing_if = "Option::is_none")] + pub no_duplicate_jsx_props: Option, #[doc = "Prevents object literals having more than one property declaration for the same name. If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored, which is likely a mistake."] #[bpaf( long("no-duplicate-object-keys"), @@ -3560,7 +3519,7 @@ pub struct Suspicious { } impl Suspicious { const GROUP_NAME: &'static str = "suspicious"; - pub(crate) const GROUP_RULES: [&'static str; 31] = [ + pub(crate) const GROUP_RULES: [&'static str; 33] = [ "noArrayIndexKey", "noAssignInExpressions", "noAsyncPromiseExecutor", @@ -3569,11 +3528,13 @@ impl Suspicious { "noCommentText", "noCompareNegZero", "noConfusingLabels", + "noConsoleLog", "noConstEnum", "noDebugger", "noDoubleEquals", "noDuplicateCase", "noDuplicateClassMembers", + "noDuplicateJsxProps", "noDuplicateObjectKeys", "noDuplicateParameters", "noEmptyInterface", @@ -3593,7 +3554,7 @@ impl Suspicious { "useNamespaceKeyword", "useValidTypeof", ]; - const RECOMMENDED_RULES: [&'static str; 30] = [ + const RECOMMENDED_RULES: [&'static str; 32] = [ "noArrayIndexKey", "noAssignInExpressions", "noAsyncPromiseExecutor", @@ -3607,6 +3568,7 @@ impl Suspicious { "noDoubleEquals", "noDuplicateCase", "noDuplicateClassMembers", + "noDuplicateJsxProps", "noDuplicateObjectKeys", "noDuplicateParameters", "noEmptyInterface", @@ -3617,6 +3579,7 @@ impl Suspicious { "noLabelVar", "noPrototypeBuiltins", "noRedeclare", + "noRedundantUseStrict", "noSelfCompare", "noShadowRestrictedNames", "noSparseArray", @@ -3625,7 +3588,7 @@ impl Suspicious { "useNamespaceKeyword", "useValidTypeof", ]; - const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 30] = [ + const RECOMMENDED_RULES_AS_FILTERS: [RuleFilter<'static>; 32] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -3634,7 +3597,6 @@ impl Suspicious { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[5]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[6]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11]), @@ -3649,6 +3611,7 @@ impl Suspicious { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26]), @@ -3656,8 +3619,10 @@ impl Suspicious { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32]), ]; - const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 31] = [ + const ALL_RULES_AS_FILTERS: [RuleFilter<'static>; 33] = [ RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[0]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[1]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[2]), @@ -3689,6 +3654,8 @@ impl Suspicious { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31]), + RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32]), ]; #[doc = r" Retrieves the recommended rules"] pub(crate) fn is_recommended(&self) -> bool { matches!(self.recommended, Some(true)) } @@ -3739,121 +3706,131 @@ impl Suspicious { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } - if let Some(rule) = self.no_const_enum.as_ref() { + if let Some(rule) = self.no_console_log.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } - if let Some(rule) = self.no_debugger.as_ref() { + if let Some(rule) = self.no_const_enum.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } - if let Some(rule) = self.no_double_equals.as_ref() { + if let Some(rule) = self.no_debugger.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } - if let Some(rule) = self.no_duplicate_case.as_ref() { + if let Some(rule) = self.no_double_equals.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); } } - if let Some(rule) = self.no_duplicate_class_members.as_ref() { + if let Some(rule) = self.no_duplicate_case.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } - if let Some(rule) = self.no_duplicate_object_keys.as_ref() { + if let Some(rule) = self.no_duplicate_class_members.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } - if let Some(rule) = self.no_duplicate_parameters.as_ref() { + if let Some(rule) = self.no_duplicate_jsx_props.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } - if let Some(rule) = self.no_empty_interface.as_ref() { + if let Some(rule) = self.no_duplicate_object_keys.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } - if let Some(rule) = self.no_explicit_any.as_ref() { + if let Some(rule) = self.no_duplicate_parameters.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } - if let Some(rule) = self.no_extra_non_null_assertion.as_ref() { + if let Some(rule) = self.no_empty_interface.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } - if let Some(rule) = self.no_function_assign.as_ref() { + if let Some(rule) = self.no_explicit_any.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } - if let Some(rule) = self.no_import_assign.as_ref() { + if let Some(rule) = self.no_extra_non_null_assertion.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } - if let Some(rule) = self.no_label_var.as_ref() { + if let Some(rule) = self.no_function_assign.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } - if let Some(rule) = self.no_prototype_builtins.as_ref() { + if let Some(rule) = self.no_import_assign.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); } } - if let Some(rule) = self.no_redeclare.as_ref() { + if let Some(rule) = self.no_label_var.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } - if let Some(rule) = self.no_redundant_use_strict.as_ref() { + if let Some(rule) = self.no_prototype_builtins.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } - if let Some(rule) = self.no_self_compare.as_ref() { + if let Some(rule) = self.no_redeclare.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } - if let Some(rule) = self.no_shadow_restricted_names.as_ref() { + if let Some(rule) = self.no_redundant_use_strict.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); } } - if let Some(rule) = self.no_sparse_array.as_ref() { + if let Some(rule) = self.no_self_compare.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); } } - if let Some(rule) = self.no_unsafe_negation.as_ref() { + if let Some(rule) = self.no_shadow_restricted_names.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); } } - if let Some(rule) = self.use_default_switch_clause_last.as_ref() { + if let Some(rule) = self.no_sparse_array.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28])); } } - if let Some(rule) = self.use_namespace_keyword.as_ref() { + if let Some(rule) = self.no_unsafe_negation.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29])); } } - if let Some(rule) = self.use_valid_typeof.as_ref() { + if let Some(rule) = self.use_default_switch_clause_last.as_ref() { if rule.is_enabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30])); } } + if let Some(rule) = self.use_namespace_keyword.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31])); + } + } + if let Some(rule) = self.use_valid_typeof.as_ref() { + if rule.is_enabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32])); + } + } index_set } pub(crate) fn get_disabled_rules(&self) -> IndexSet { @@ -3898,121 +3875,131 @@ impl Suspicious { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[7])); } } - if let Some(rule) = self.no_const_enum.as_ref() { + if let Some(rule) = self.no_console_log.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[8])); } } - if let Some(rule) = self.no_debugger.as_ref() { + if let Some(rule) = self.no_const_enum.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[9])); } } - if let Some(rule) = self.no_double_equals.as_ref() { + if let Some(rule) = self.no_debugger.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[10])); } } - if let Some(rule) = self.no_duplicate_case.as_ref() { + if let Some(rule) = self.no_double_equals.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[11])); } } - if let Some(rule) = self.no_duplicate_class_members.as_ref() { + if let Some(rule) = self.no_duplicate_case.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[12])); } } - if let Some(rule) = self.no_duplicate_object_keys.as_ref() { + if let Some(rule) = self.no_duplicate_class_members.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13])); } } - if let Some(rule) = self.no_duplicate_parameters.as_ref() { + if let Some(rule) = self.no_duplicate_jsx_props.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14])); } } - if let Some(rule) = self.no_empty_interface.as_ref() { + if let Some(rule) = self.no_duplicate_object_keys.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[15])); } } - if let Some(rule) = self.no_explicit_any.as_ref() { + if let Some(rule) = self.no_duplicate_parameters.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[16])); } } - if let Some(rule) = self.no_extra_non_null_assertion.as_ref() { + if let Some(rule) = self.no_empty_interface.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17])); } } - if let Some(rule) = self.no_function_assign.as_ref() { + if let Some(rule) = self.no_explicit_any.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[18])); } } - if let Some(rule) = self.no_import_assign.as_ref() { + if let Some(rule) = self.no_extra_non_null_assertion.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[19])); } } - if let Some(rule) = self.no_label_var.as_ref() { + if let Some(rule) = self.no_function_assign.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[20])); } } - if let Some(rule) = self.no_prototype_builtins.as_ref() { + if let Some(rule) = self.no_import_assign.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21])); } } - if let Some(rule) = self.no_redeclare.as_ref() { + if let Some(rule) = self.no_label_var.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22])); } } - if let Some(rule) = self.no_redundant_use_strict.as_ref() { + if let Some(rule) = self.no_prototype_builtins.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[23])); } } - if let Some(rule) = self.no_self_compare.as_ref() { + if let Some(rule) = self.no_redeclare.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[24])); } } - if let Some(rule) = self.no_shadow_restricted_names.as_ref() { + if let Some(rule) = self.no_redundant_use_strict.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[25])); } } - if let Some(rule) = self.no_sparse_array.as_ref() { + if let Some(rule) = self.no_self_compare.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26])); } } - if let Some(rule) = self.no_unsafe_negation.as_ref() { + if let Some(rule) = self.no_shadow_restricted_names.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[27])); } } - if let Some(rule) = self.use_default_switch_clause_last.as_ref() { + if let Some(rule) = self.no_sparse_array.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28])); } } - if let Some(rule) = self.use_namespace_keyword.as_ref() { + if let Some(rule) = self.no_unsafe_negation.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[29])); } } - if let Some(rule) = self.use_valid_typeof.as_ref() { + if let Some(rule) = self.use_default_switch_clause_last.as_ref() { if rule.is_disabled() { index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[30])); } } + if let Some(rule) = self.use_namespace_keyword.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[31])); + } + } + if let Some(rule) = self.use_valid_typeof.as_ref() { + if rule.is_disabled() { + index_set.insert(RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[32])); + } + } index_set } #[doc = r" Checks if, given a rule name, matches one of the rules contained in this category"] @@ -4021,10 +4008,10 @@ impl Suspicious { pub(crate) fn is_recommended_rule(rule_name: &str) -> bool { Self::RECOMMENDED_RULES.contains(&rule_name) } - pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 30] { + pub(crate) fn recommended_rules_as_filters() -> [RuleFilter<'static>; 32] { Self::RECOMMENDED_RULES_AS_FILTERS } - pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 31] { Self::ALL_RULES_AS_FILTERS } + pub(crate) fn all_rules_as_filters() -> [RuleFilter<'static>; 33] { Self::ALL_RULES_AS_FILTERS } #[doc = r" Select preset rules"] pub(crate) fn collect_preset_rules( &self, @@ -4053,11 +4040,13 @@ impl Suspicious { "noCommentText" => self.no_comment_text.as_ref(), "noCompareNegZero" => self.no_compare_neg_zero.as_ref(), "noConfusingLabels" => self.no_confusing_labels.as_ref(), + "noConsoleLog" => self.no_console_log.as_ref(), "noConstEnum" => self.no_const_enum.as_ref(), "noDebugger" => self.no_debugger.as_ref(), "noDoubleEquals" => self.no_double_equals.as_ref(), "noDuplicateCase" => self.no_duplicate_case.as_ref(), "noDuplicateClassMembers" => self.no_duplicate_class_members.as_ref(), + "noDuplicateJsxProps" => self.no_duplicate_jsx_props.as_ref(), "noDuplicateObjectKeys" => self.no_duplicate_object_keys.as_ref(), "noDuplicateParameters" => self.no_duplicate_parameters.as_ref(), "noEmptyInterface" => self.no_empty_interface.as_ref(), diff --git a/crates/rome_service/src/configuration/parse/json/rules.rs b/crates/rome_service/src/configuration/parse/json/rules.rs index d83cb280093..cf2ba76062e 100644 --- a/crates/rome_service/src/configuration/parse/json/rules.rs +++ b/crates/rome_service/src/configuration/parse/json/rules.rs @@ -132,6 +132,7 @@ impl VisitNode for A11y { "useAnchorContent", "useAriaPropsForRole", "useButtonType", + "useHeadingContent", "useHtmlLang", "useIframeTitle", "useKeyWithClickEvents", @@ -458,6 +459,29 @@ impl VisitNode for A11y { )); } }, + "useHeadingContent" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.use_heading_content = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "useHeadingContent", + diagnostics, + )?; + self.use_heading_content = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "useHtmlLang" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -660,6 +684,7 @@ impl VisitNode for Complexity { "recommended", "all", "noExtraBooleanCast", + "noForEach", "noMultipleSpacesInRegularExpressionLiterals", "noUselessCatch", "noUselessConstructor", @@ -670,7 +695,9 @@ impl VisitNode for Complexity { "noUselessTypeConstraint", "noWith", "useFlatMap", + "useLiteralKeys", "useOptionalChain", + "useSimpleNumberKeys", "useSimplifiedLogicExpression", ], diagnostics, @@ -714,6 +741,29 @@ impl VisitNode for Complexity { )); } }, + "noForEach" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.no_for_each = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "noForEach", + diagnostics, + )?; + self.no_for_each = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "noMultipleSpacesInRegularExpressionLiterals" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -945,6 +995,29 @@ impl VisitNode for Complexity { )); } }, + "useLiteralKeys" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.use_literal_keys = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "useLiteralKeys", + diagnostics, + )?; + self.use_literal_keys = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "useOptionalChain" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -968,6 +1041,29 @@ impl VisitNode for Complexity { )); } }, + "useSimpleNumberKeys" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.use_simple_number_keys = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "useSimpleNumberKeys", + diagnostics, + )?; + self.use_simple_number_keys = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "useSimplifiedLogicExpression" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -1031,6 +1127,7 @@ impl VisitNode for Correctness { "noUnusedVariables", "noVoidElementsWithChildren", "noVoidTypeReturn", + "useIsNan", "useValidForDirection", "useYield", ], @@ -1581,6 +1678,29 @@ impl VisitNode for Correctness { )); } }, + "useIsNan" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.use_is_nan = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "useIsNan", + diagnostics, + )?; + self.use_is_nan = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "useValidForDirection" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -1648,14 +1768,11 @@ impl VisitNode for Nursery { "noAriaUnsupportedElements", "noBannedTypes", "noConfusingArrow", - "noConsoleLog", "noConstantCondition", "noControlCharactersInRegex", "noDuplicateJsonKeys", - "noDuplicateJsxProps", "noExcessiveComplexity", "noFallthroughSwitchClause", - "noForEach", "noGlobalIsFinite", "noGlobalIsNan", "noNoninteractiveTabindex", @@ -1668,18 +1785,13 @@ impl VisitNode for Nursery { "noVoid", "useAriaPropTypes", "useArrowFunction", - "useCamelCase", "useExhaustiveDependencies", "useGroupedTypeImport", - "useHeadingContent", "useHookAtTopLevel", "useImportRestrictions", "useIsArray", - "useIsNan", "useLiteralEnumMembers", - "useLiteralKeys", "useNamingConvention", - "useSimpleNumberKeys", ], diagnostics, ) @@ -1791,29 +1903,6 @@ impl VisitNode for Nursery { )); } }, - "noConsoleLog" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.no_console_log = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "noConsoleLog", - diagnostics, - )?; - self.no_console_log = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "noConstantCondition" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -1883,29 +1972,6 @@ impl VisitNode for Nursery { )); } }, - "noDuplicateJsxProps" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.no_duplicate_jsx_props = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "noDuplicateJsxProps", - diagnostics, - )?; - self.no_duplicate_jsx_props = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "noExcessiveComplexity" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -1952,29 +2018,6 @@ impl VisitNode for Nursery { )); } }, - "noForEach" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.no_for_each = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "noForEach", - diagnostics, - )?; - self.no_for_each = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "noGlobalIsFinite" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -2251,29 +2294,6 @@ impl VisitNode for Nursery { )); } }, - "useCamelCase" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.use_camel_case = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "useCamelCase", - diagnostics, - )?; - self.use_camel_case = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "useExhaustiveDependencies" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -2320,29 +2340,6 @@ impl VisitNode for Nursery { )); } }, - "useHeadingContent" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.use_heading_content = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "useHeadingContent", - diagnostics, - )?; - self.use_heading_content = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "useHookAtTopLevel" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -2412,29 +2409,6 @@ impl VisitNode for Nursery { )); } }, - "useIsNan" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.use_is_nan = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "useIsNan", - diagnostics, - )?; - self.use_is_nan = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "useLiteralEnumMembers" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -2458,29 +2432,6 @@ impl VisitNode for Nursery { )); } }, - "useLiteralKeys" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.use_literal_keys = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "useLiteralKeys", - diagnostics, - )?; - self.use_literal_keys = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, "useNamingConvention" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -2504,29 +2455,6 @@ impl VisitNode for Nursery { )); } }, - "useSimpleNumberKeys" => match value { - AnyJsonValue::JsonStringValue(_) => { - let mut configuration = RuleConfiguration::default(); - self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; - self.use_simple_number_keys = Some(configuration); - } - AnyJsonValue::JsonObjectValue(_) => { - let mut rule_configuration = RuleConfiguration::default(); - rule_configuration.map_rule_configuration( - &value, - name_text, - "useSimpleNumberKeys", - diagnostics, - )?; - self.use_simple_number_keys = Some(rule_configuration); - } - _ => { - diagnostics.push(DeserializationDiagnostic::new_incorrect_type( - "object or string", - value.range(), - )); - } - }, _ => {} } Some(()) @@ -3348,11 +3276,13 @@ impl VisitNode for Suspicious { "noCommentText", "noCompareNegZero", "noConfusingLabels", + "noConsoleLog", "noConstEnum", "noDebugger", "noDoubleEquals", "noDuplicateCase", "noDuplicateClassMembers", + "noDuplicateJsxProps", "noDuplicateObjectKeys", "noDuplicateParameters", "noEmptyInterface", @@ -3574,6 +3504,29 @@ impl VisitNode for Suspicious { )); } }, + "noConsoleLog" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.no_console_log = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "noConsoleLog", + diagnostics, + )?; + self.no_console_log = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "noConstEnum" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); @@ -3689,6 +3642,29 @@ impl VisitNode for Suspicious { )); } }, + "noDuplicateJsxProps" => match value { + AnyJsonValue::JsonStringValue(_) => { + let mut configuration = RuleConfiguration::default(); + self.map_to_known_string(&value, name_text, &mut configuration, diagnostics)?; + self.no_duplicate_jsx_props = Some(configuration); + } + AnyJsonValue::JsonObjectValue(_) => { + let mut rule_configuration = RuleConfiguration::default(); + rule_configuration.map_rule_configuration( + &value, + name_text, + "noDuplicateJsxProps", + diagnostics, + )?; + self.no_duplicate_jsx_props = Some(rule_configuration); + } + _ => { + diagnostics.push(DeserializationDiagnostic::new_incorrect_type( + "object or string", + value.range(), + )); + } + }, "noDuplicateObjectKeys" => match value { AnyJsonValue::JsonStringValue(_) => { let mut configuration = RuleConfiguration::default(); diff --git a/editors/vscode/configuration_schema.json b/editors/vscode/configuration_schema.json index 97a1f0799b1..dacc5561ade 100644 --- a/editors/vscode/configuration_schema.json +++ b/editors/vscode/configuration_schema.json @@ -164,6 +164,13 @@ { "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" }, + { "type": "null" } + ] + }, "useHtmlLang": { "description": "Enforce that html element has lang attribute.", "anyOf": [ @@ -238,6 +245,13 @@ { "type": "null" } ] }, + "noForEach": { + "description": "Prefer for...of statement instead of Array.forEach.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noMultipleSpacesInRegularExpressionLiterals": { "description": "Disallow unclear usage of multiple space characters in regular expression literals", "anyOf": [ @@ -312,6 +326,13 @@ { "type": "null" } ] }, + "useLiteralKeys": { + "description": "Enforce the usage of a literal access to properties over computed property access.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useOptionalChain": { "description": "Enforce using concise optional chain instead of chained logical expressions.", "anyOf": [ @@ -319,6 +340,13 @@ { "type": "null" } ] }, + "useSimpleNumberKeys": { + "description": "Disallow number literal object member names which are not base10 or uses underscore as separator", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useSimplifiedLogicExpression": { "description": "Discard redundant terms from logical expressions.", "anyOf": [ @@ -515,6 +543,13 @@ "description": "It enables the recommended rules for this group", "type": ["boolean", "null"] }, + "useIsNan": { + "description": "Require calls to isNaN() when checking for NaN.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useValidForDirection": { "description": "Enforce \"for\" loop update clause moving the counter in the right direction.", "anyOf": [ @@ -816,13 +851,6 @@ { "type": "null" } ] }, - "noConsoleLog": { - "description": "Disallow the use of console.log", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noConstantCondition": { "description": "Disallow constant expressions in conditions", "anyOf": [ @@ -844,13 +872,6 @@ { "type": "null" } ] }, - "noDuplicateJsxProps": { - "description": "Prevents JSX properties to be assigned multiple times.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noExcessiveComplexity": { "description": "Disallow functions that exceed a given complexity score.", "anyOf": [ @@ -865,13 +886,6 @@ { "type": "null" } ] }, - "noForEach": { - "description": "Prefer for...of statement instead of Array.forEach.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noGlobalIsFinite": { "description": "Use Number.isFinite instead of global isFinite.", "anyOf": [ @@ -960,13 +974,6 @@ { "type": "null" } ] }, - "useCamelCase": { - "description": "Enforce camel case naming convention.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useExhaustiveDependencies": { "description": "Enforce all dependencies are correctly specified.", "anyOf": [ @@ -981,13 +988,6 @@ { "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" }, - { "type": "null" } - ] - }, "useHookAtTopLevel": { "description": "Enforce that all React hooks are being called from the Top Level component functions.", "anyOf": [ @@ -1009,13 +1009,6 @@ { "type": "null" } ] }, - "useIsNan": { - "description": "Require calls to isNaN() when checking for NaN.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useLiteralEnumMembers": { "description": "Require all enum members to be literal values.", "anyOf": [ @@ -1023,26 +1016,12 @@ { "type": "null" } ] }, - "useLiteralKeys": { - "description": "Enforce the usage of a literal access to properties over computed property access.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useNamingConvention": { "description": "Enforce naming conventions for everything across a codebase.", "anyOf": [ { "$ref": "#/definitions/RuleConfiguration" }, { "type": "null" } ] - }, - "useSimpleNumberKeys": { - "description": "Disallow number literal object member names which are not base10 or uses underscore as separator", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] } } }, @@ -1479,6 +1458,13 @@ { "type": "null" } ] }, + "noConsoleLog": { + "description": "Disallow the use of console.log", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noConstEnum": { "description": "Disallow TypeScript const enum", "anyOf": [ @@ -1514,6 +1500,13 @@ { "type": "null" } ] }, + "noDuplicateJsxProps": { + "description": "Prevents JSX properties to be assigned multiple times.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noDuplicateObjectKeys": { "description": "Prevents object literals having more than one property declaration for the same name. If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored, which is likely a mistake.", "anyOf": [ diff --git a/npm/backend-jsonrpc/src/workspace.ts b/npm/backend-jsonrpc/src/workspace.ts index fee46edf71c..6d5c367b7e1 100644 --- a/npm/backend-jsonrpc/src/workspace.ts +++ b/npm/backend-jsonrpc/src/workspace.ts @@ -304,6 +304,10 @@ export interface A11y { * Enforces the usage of the attribute type for the element button */ useButtonType?: RuleConfiguration; + /** + * 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; /** * Enforce that html element has lang attribute. */ @@ -349,6 +353,10 @@ export interface Complexity { * Disallow unnecessary boolean casts */ noExtraBooleanCast?: RuleConfiguration; + /** + * Prefer for...of statement instead of Array.forEach. + */ + noForEach?: RuleConfiguration; /** * Disallow unclear usage of multiple space characters in regular expression literals */ @@ -393,10 +401,18 @@ export interface Complexity { * Promotes the use of .flatMap() when map().flat() are used together. */ useFlatMap?: RuleConfiguration; + /** + * Enforce the usage of a literal access to properties over computed property access. + */ + useLiteralKeys?: RuleConfiguration; /** * Enforce using concise optional chain instead of chained logical expressions. */ useOptionalChain?: RuleConfiguration; + /** + * Disallow number literal object member names which are not base10 or uses underscore as separator + */ + useSimpleNumberKeys?: RuleConfiguration; /** * Discard redundant terms from logical expressions. */ @@ -506,6 +522,10 @@ export interface Correctness { * It enables the recommended rules for this group */ recommended?: boolean; + /** + * Require calls to isNaN() when checking for NaN. + */ + useIsNan?: RuleConfiguration; /** * Enforce "for" loop update clause moving the counter in the right direction. */ @@ -539,10 +559,6 @@ export interface Nursery { * Disallow arrow functions where they could be confused with comparisons. */ noConfusingArrow?: RuleConfiguration; - /** - * Disallow the use of console.log - */ - noConsoleLog?: RuleConfiguration; /** * Disallow constant expressions in conditions */ @@ -555,10 +571,6 @@ export interface Nursery { * Disallow two keys with the same name inside a JSON object. */ noDuplicateJsonKeys?: RuleConfiguration; - /** - * Prevents JSX properties to be assigned multiple times. - */ - noDuplicateJsxProps?: RuleConfiguration; /** * Disallow functions that exceed a given complexity score. */ @@ -567,10 +579,6 @@ export interface Nursery { * Disallow fallthrough of switch clauses. */ noFallthroughSwitchClause?: RuleConfiguration; - /** - * Prefer for...of statement instead of Array.forEach. - */ - noForEach?: RuleConfiguration; /** * Use Number.isFinite instead of global isFinite. */ @@ -623,10 +631,6 @@ export interface Nursery { * Use arrow functions over function expressions. */ useArrowFunction?: RuleConfiguration; - /** - * Enforce camel case naming convention. - */ - useCamelCase?: RuleConfiguration; /** * Enforce all dependencies are correctly specified. */ @@ -635,10 +639,6 @@ export interface Nursery { * Enforce the use of import type when an import only has specifiers with type qualifier. */ useGroupedTypeImport?: RuleConfiguration; - /** - * 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; /** * Enforce that all React hooks are being called from the Top Level component functions. */ @@ -651,26 +651,14 @@ export interface Nursery { * Use Array.isArray() instead of instanceof Array. */ useIsArray?: RuleConfiguration; - /** - * Require calls to isNaN() when checking for NaN. - */ - useIsNan?: RuleConfiguration; /** * Require all enum members to be literal values. */ useLiteralEnumMembers?: RuleConfiguration; - /** - * Enforce the usage of a literal access to properties over computed property access. - */ - useLiteralKeys?: RuleConfiguration; /** * Enforce naming conventions for everything across a codebase. */ useNamingConvention?: RuleConfiguration; - /** - * Disallow number literal object member names which are not base10 or uses underscore as separator - */ - useSimpleNumberKeys?: RuleConfiguration; } /** * A list of rules that belong to this group @@ -867,6 +855,10 @@ export interface Suspicious { * Disallow labeled statements that are not loops. */ noConfusingLabels?: RuleConfiguration; + /** + * Disallow the use of console.log + */ + noConsoleLog?: RuleConfiguration; /** * Disallow TypeScript const enum */ @@ -887,6 +879,10 @@ export interface Suspicious { * Disallow duplicate class members. */ noDuplicateClassMembers?: RuleConfiguration; + /** + * Prevents JSX properties to be assigned multiple times. + */ + noDuplicateJsxProps?: RuleConfiguration; /** * Prevents object literals having more than one property declaration for the same name. If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored, which is likely a mistake. */ @@ -1131,6 +1127,7 @@ export type Category = | "lint/a11y/useAnchorContent" | "lint/a11y/useAriaPropsForRole" | "lint/a11y/useButtonType" + | "lint/a11y/useHeadingContent" | "lint/a11y/useHtmlLang" | "lint/a11y/useIframeTitle" | "lint/a11y/useKeyWithClickEvents" @@ -1140,6 +1137,7 @@ export type Category = | "lint/a11y/useValidAriaProps" | "lint/a11y/useValidLang" | "lint/complexity/noExtraBooleanCast" + | "lint/complexity/noForEach" | "lint/complexity/noMultipleSpacesInRegularExpressionLiterals" | "lint/complexity/noUselessCatch" | "lint/complexity/noUselessConstructor" @@ -1150,7 +1148,9 @@ export type Category = | "lint/complexity/noUselessTypeConstraint" | "lint/complexity/noWith" | "lint/complexity/useFlatMap" + | "lint/complexity/useLiteralKeys" | "lint/complexity/useOptionalChain" + | "lint/complexity/useSimpleNumberKeys" | "lint/complexity/useSimplifiedLogicExpression" | "lint/correctness/noChildrenProp" | "lint/correctness/noConstAssign" @@ -1159,6 +1159,7 @@ export type Category = | "lint/correctness/noGlobalObjectCalls" | "lint/correctness/noInnerDeclarations" | "lint/correctness/noInvalidConstructorSuper" + | "lint/correctness/useIsNan" | "lint/correctness/noNewSymbol" | "lint/correctness/noPrecisionLoss" | "lint/correctness/noRenderReturnValue" @@ -1181,14 +1182,11 @@ export type Category = | "lint/nursery/noAriaUnsupportedElements" | "lint/nursery/noBannedTypes" | "lint/nursery/noConfusingArrow" - | "lint/nursery/noConsoleLog" | "lint/nursery/noConstantCondition" | "lint/nursery/noControlCharactersInRegex" | "lint/nursery/noDuplicateJsonKeys" - | "lint/nursery/noDuplicateJsxProps" | "lint/nursery/noExcessiveComplexity" | "lint/nursery/noFallthroughSwitchClause" - | "lint/nursery/noForEach" | "lint/nursery/noGlobalIsFinite" | "lint/nursery/noGlobalIsNan" | "lint/nursery/noNoninteractiveTabindex" @@ -1201,18 +1199,13 @@ export type Category = | "lint/nursery/noVoid" | "lint/nursery/useAriaPropTypes" | "lint/nursery/useArrowFunction" - | "lint/nursery/useCamelCase" | "lint/nursery/useExhaustiveDependencies" | "lint/nursery/useGroupedTypeImport" - | "lint/nursery/useHeadingContent" | "lint/nursery/useHookAtTopLevel" | "lint/nursery/useImportRestrictions" | "lint/nursery/useIsArray" - | "lint/nursery/useIsNan" | "lint/nursery/useLiteralEnumMembers" - | "lint/nursery/useLiteralKeys" | "lint/nursery/useNamingConvention" - | "lint/nursery/useSimpleNumberKeys" | "lint/performance/noDelete" | "lint/security/noDangerouslySetInnerHtml" | "lint/security/noDangerouslySetInnerHtmlWithChildren" @@ -1250,11 +1243,13 @@ export type Category = | "lint/suspicious/noCommentText" | "lint/suspicious/noCompareNegZero" | "lint/suspicious/noConfusingLabels" + | "lint/suspicious/noConsoleLog" | "lint/suspicious/noConstEnum" | "lint/suspicious/noDebugger" | "lint/suspicious/noDoubleEquals" | "lint/suspicious/noDuplicateCase" | "lint/suspicious/noDuplicateClassMembers" + | "lint/suspicious/noDuplicateJsxProps" | "lint/suspicious/noDuplicateObjectKeys" | "lint/suspicious/noDuplicateParameters" | "lint/suspicious/noEmptyInterface" diff --git a/npm/rome/configuration_schema.json b/npm/rome/configuration_schema.json index 97a1f0799b1..dacc5561ade 100644 --- a/npm/rome/configuration_schema.json +++ b/npm/rome/configuration_schema.json @@ -164,6 +164,13 @@ { "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" }, + { "type": "null" } + ] + }, "useHtmlLang": { "description": "Enforce that html element has lang attribute.", "anyOf": [ @@ -238,6 +245,13 @@ { "type": "null" } ] }, + "noForEach": { + "description": "Prefer for...of statement instead of Array.forEach.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noMultipleSpacesInRegularExpressionLiterals": { "description": "Disallow unclear usage of multiple space characters in regular expression literals", "anyOf": [ @@ -312,6 +326,13 @@ { "type": "null" } ] }, + "useLiteralKeys": { + "description": "Enforce the usage of a literal access to properties over computed property access.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useOptionalChain": { "description": "Enforce using concise optional chain instead of chained logical expressions.", "anyOf": [ @@ -319,6 +340,13 @@ { "type": "null" } ] }, + "useSimpleNumberKeys": { + "description": "Disallow number literal object member names which are not base10 or uses underscore as separator", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useSimplifiedLogicExpression": { "description": "Discard redundant terms from logical expressions.", "anyOf": [ @@ -515,6 +543,13 @@ "description": "It enables the recommended rules for this group", "type": ["boolean", "null"] }, + "useIsNan": { + "description": "Require calls to isNaN() when checking for NaN.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "useValidForDirection": { "description": "Enforce \"for\" loop update clause moving the counter in the right direction.", "anyOf": [ @@ -816,13 +851,6 @@ { "type": "null" } ] }, - "noConsoleLog": { - "description": "Disallow the use of console.log", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noConstantCondition": { "description": "Disallow constant expressions in conditions", "anyOf": [ @@ -844,13 +872,6 @@ { "type": "null" } ] }, - "noDuplicateJsxProps": { - "description": "Prevents JSX properties to be assigned multiple times.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noExcessiveComplexity": { "description": "Disallow functions that exceed a given complexity score.", "anyOf": [ @@ -865,13 +886,6 @@ { "type": "null" } ] }, - "noForEach": { - "description": "Prefer for...of statement instead of Array.forEach.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "noGlobalIsFinite": { "description": "Use Number.isFinite instead of global isFinite.", "anyOf": [ @@ -960,13 +974,6 @@ { "type": "null" } ] }, - "useCamelCase": { - "description": "Enforce camel case naming convention.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useExhaustiveDependencies": { "description": "Enforce all dependencies are correctly specified.", "anyOf": [ @@ -981,13 +988,6 @@ { "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" }, - { "type": "null" } - ] - }, "useHookAtTopLevel": { "description": "Enforce that all React hooks are being called from the Top Level component functions.", "anyOf": [ @@ -1009,13 +1009,6 @@ { "type": "null" } ] }, - "useIsNan": { - "description": "Require calls to isNaN() when checking for NaN.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useLiteralEnumMembers": { "description": "Require all enum members to be literal values.", "anyOf": [ @@ -1023,26 +1016,12 @@ { "type": "null" } ] }, - "useLiteralKeys": { - "description": "Enforce the usage of a literal access to properties over computed property access.", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] - }, "useNamingConvention": { "description": "Enforce naming conventions for everything across a codebase.", "anyOf": [ { "$ref": "#/definitions/RuleConfiguration" }, { "type": "null" } ] - }, - "useSimpleNumberKeys": { - "description": "Disallow number literal object member names which are not base10 or uses underscore as separator", - "anyOf": [ - { "$ref": "#/definitions/RuleConfiguration" }, - { "type": "null" } - ] } } }, @@ -1479,6 +1458,13 @@ { "type": "null" } ] }, + "noConsoleLog": { + "description": "Disallow the use of console.log", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noConstEnum": { "description": "Disallow TypeScript const enum", "anyOf": [ @@ -1514,6 +1500,13 @@ { "type": "null" } ] }, + "noDuplicateJsxProps": { + "description": "Prevents JSX properties to be assigned multiple times.", + "anyOf": [ + { "$ref": "#/definitions/RuleConfiguration" }, + { "type": "null" } + ] + }, "noDuplicateObjectKeys": { "description": "Prevents object literals having more than one property declaration for the same name. If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored, which is likely a mistake.", "anyOf": [ diff --git a/website/src/components/generated/NumberOfRules.astro b/website/src/components/generated/NumberOfRules.astro index 07715a7f29d..ea5c582e0f8 100644 --- a/website/src/components/generated/NumberOfRules.astro +++ b/website/src/components/generated/NumberOfRules.astro @@ -1,2 +1,2 @@ -

Rome's linter has a total of 155 rules

\ No newline at end of file +

Rome's linter has a total of 154 rules

\ No newline at end of file diff --git a/website/src/pages/lint/rules/index.mdx b/website/src/pages/lint/rules/index.mdx index 606bb8a785f..1643c51ece8 100644 --- a/website/src/pages/lint/rules/index.mdx +++ b/website/src/pages/lint/rules/index.mdx @@ -105,6 +105,13 @@ Enforce that elements with ARIA roles must have all required ARIA attributes for Enforces the usage of the attribute type for the element button

+

+ useHeadingContent +

+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. +
+

useHtmlLang recommended @@ -175,6 +182,12 @@ Rules that focus on inspecting complex code that could be simplified. Disallow unnecessary boolean casts

+

+ noForEach +

+Prefer for...of statement instead of Array.forEach. +
+

noMultipleSpacesInRegularExpressionLiterals recommended @@ -198,6 +211,7 @@ Disallow unnecessary constructors.

noUselessFragments + recommended

Disallow unnecessary fragments
@@ -244,6 +258,13 @@ Disallow with statements in non-strict contexts. Promotes the use of .flatMap() when map().flat() are used together.

+

+ useLiteralKeys + recommended +

+Enforce the usage of a literal access to properties over computed property access. +
+

useOptionalChain recommended @@ -251,6 +272,12 @@ Promotes the use of .flatMap() when map().flat() are u Enforce using concise optional chain instead of chained logical expressions.

+

+ useSimpleNumberKeys +

+Disallow number literal object member names which are not base10 or uses underscore as separator +
+

useSimplifiedLogicExpression

@@ -426,6 +453,13 @@ This rules prevents void elements (AKA self-closing elements) from having childr Disallow returning a value from a function with the return type 'void'
+

+ useIsNan + recommended +

+Require calls to isNaN() when checking for NaN. +
+

useValidForDirection recommended @@ -597,6 +631,7 @@ Require that each enum member value be explicitly initialized.

useExponentiationOperator + recommended

Disallow the use of Math.pow in favor of the ** operator.
@@ -719,6 +754,12 @@ Disallow comparing against -0 Disallow labeled statements that are not loops.

+

+ noConsoleLog +

+Disallow the use of console.log +
+

noConstEnum recommended @@ -755,6 +796,13 @@ If a switch statement has duplicate test expressions in case clauses, it is like Disallow duplicate class members.

+

+ noDuplicateJsxProps + recommended +

+Prevents JSX properties to be assigned multiple times. +
+

noDuplicateObjectKeys recommended @@ -828,6 +876,7 @@ Disallow variable, function, class, and type redeclarations in the same scope.

noRedundantUseStrict + recommended

Prevents from having redundant "use strict".
@@ -921,12 +970,6 @@ Disallow primitive type aliases and misleading types. Disallow arrow functions where they could be confused with comparisons.

-

- noConsoleLog -

-Disallow the use of console.log -
-

noConstantCondition

@@ -945,12 +988,6 @@ Prevents from having control characters and some escape sequences that match con Disallow two keys with the same name inside a JSON object.
-

- noDuplicateJsxProps -

-Prevents JSX properties to be assigned multiple times. -
-

noExcessiveComplexity

@@ -963,12 +1000,6 @@ Disallow functions that exceed a given complexity score. Disallow fallthrough of switch clauses.
-

- noForEach -

-Prefer for...of statement instead of Array.forEach. -
-

noGlobalIsFinite

@@ -1041,12 +1072,6 @@ Enforce that ARIA state and property values are valid. Use arrow functions over function expressions.
-

- useCamelCase -

-Enforce camel case naming convention. -
-

useExhaustiveDependencies

@@ -1059,13 +1084,6 @@ Enforce all dependencies are correctly specified. Enforce the use of import type when an import only has specifiers with type qualifier.
-

- useHeadingContent -

-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. -
-

useHookAtTopLevel

@@ -1085,34 +1103,16 @@ Disallows package private imports. Use Array.isArray() instead of instanceof Array.
-

- useIsNan -

-Require calls to isNaN() when checking for NaN. -
-

useLiteralEnumMembers

Require all enum members to be literal values.
-

- useLiteralKeys -

-Enforce the usage of a literal access to properties over computed property access. -
-

useNamingConvention

Enforce naming conventions for everything across a codebase.
-
-

- useSimpleNumberKeys -

-Disallow number literal object member names which are not base10 or uses underscore as separator -
diff --git a/website/src/pages/lint/rules/noConsoleLog.md b/website/src/pages/lint/rules/noConsoleLog.md index 3082b5ab19e..7db609ae98b 100644 --- a/website/src/pages/lint/rules/noConsoleLog.md +++ b/website/src/pages/lint/rules/noConsoleLog.md @@ -15,7 +15,7 @@ Disallow the use of `console.log` console.log() ``` -
nursery/noConsoleLog.js:1:1 lint/nursery/noConsoleLog ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
suspicious/noConsoleLog.js:1:1 lint/suspicious/noConsoleLog ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Don't use console.log
   
diff --git a/website/src/pages/lint/rules/noDuplicateJsxProps.md b/website/src/pages/lint/rules/noDuplicateJsxProps.md
index 47efaffa19b..17fb50bd663 100644
--- a/website/src/pages/lint/rules/noDuplicateJsxProps.md
+++ b/website/src/pages/lint/rules/noDuplicateJsxProps.md
@@ -5,6 +5,8 @@ parent: lint/rules/index
 
 # noDuplicateJsxProps (since v12.1.0)
 
+> This rule is recommended by Rome.
+
 Prevents JSX properties to be assigned multiple times.
 
 ## Examples
@@ -15,7 +17,7 @@ Prevents JSX properties to be assigned multiple times.
 
 ```
 
-
nursery/noDuplicateJsxProps.js:1:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
suspicious/noDuplicateJsxProps.js:1:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    This JSX property is assigned multiple times.
   
@@ -35,7 +37,7 @@ Prevents JSX properties to be assigned multiple times.
 
 ```
 
-
nursery/noDuplicateJsxProps.js:1:8 lint/nursery/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
suspicious/noDuplicateJsxProps.js:1:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    This JSX property is assigned multiple times.
   
diff --git a/website/src/pages/lint/rules/noForEach.md b/website/src/pages/lint/rules/noForEach.md
index 0f6f94d883c..2543f72c6f9 100644
--- a/website/src/pages/lint/rules/noForEach.md
+++ b/website/src/pages/lint/rules/noForEach.md
@@ -32,7 +32,7 @@ els.forEach(el => {
 })
 ```
 
-
nursery/noForEach.js:1:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/noForEach.js:1:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Prefer for...of instead of Array.forEach
   
@@ -51,7 +51,7 @@ els['forEach'](el => {
 })
 ```
 
-
nursery/noForEach.js:1:1 lint/nursery/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/noForEach.js:1:1 lint/complexity/noForEach ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Prefer for...of instead of Array.forEach
   
diff --git a/website/src/pages/lint/rules/noRedundantUseStrict.md b/website/src/pages/lint/rules/noRedundantUseStrict.md
index 1d896ac4bbf..b65d95a3949 100644
--- a/website/src/pages/lint/rules/noRedundantUseStrict.md
+++ b/website/src/pages/lint/rules/noRedundantUseStrict.md
@@ -5,6 +5,8 @@ parent: lint/rules/index
 
 # noRedundantUseStrict (since v11.0.0)
 
+> This rule is recommended by Rome.
+
 Prevents from having redundant `"use strict"`.
 
 ## Examples
@@ -20,7 +22,7 @@ function foo() {
 
 
suspicious/noRedundantUseStrict.js:3:3 lint/suspicious/noRedundantUseStrict  FIXABLE  ━━━━━━━━━━━━━━
 
-   Redundant use strict directive.
+   Redundant use strict directive.
   
     1 │ "use strict";
     2 │ function foo() {
@@ -57,7 +59,7 @@ function foo() {
 
 
suspicious/noRedundantUseStrict.js:2:1 lint/suspicious/noRedundantUseStrict  FIXABLE  ━━━━━━━━━━━━━━
 
-   Redundant use strict directive.
+   Redundant use strict directive.
   
     1 │ "use strict";
   > 2 │ "use strict";
@@ -90,7 +92,7 @@ function foo() {
 
 
suspicious/noRedundantUseStrict.js:3:1 lint/suspicious/noRedundantUseStrict  FIXABLE  ━━━━━━━━━━━━━━
 
-   Redundant use strict directive.
+   Redundant use strict directive.
   
     1 │ function foo() {
     2 │ "use strict";
@@ -127,7 +129,7 @@ class C1 {
 
 
suspicious/noRedundantUseStrict.js:3:3 lint/suspicious/noRedundantUseStrict  FIXABLE  ━━━━━━━━━━━━━━
 
-   Redundant use strict directive.
+   Redundant use strict directive.
   
     1 │ class C1 {
     2 │ 	test() {
@@ -170,7 +172,7 @@ const C2 = class {
 
 
suspicious/noRedundantUseStrict.js:3:3 lint/suspicious/noRedundantUseStrict  FIXABLE  ━━━━━━━━━━━━━━
 
-   Redundant use strict directive.
+   Redundant use strict directive.
   
     1 │ const C2 = class {
     2 │ 	test() {
diff --git a/website/src/pages/lint/rules/noUselessFragments.md b/website/src/pages/lint/rules/noUselessFragments.md
index fc0ad85081b..50b9df2461f 100644
--- a/website/src/pages/lint/rules/noUselessFragments.md
+++ b/website/src/pages/lint/rules/noUselessFragments.md
@@ -5,6 +5,8 @@ parent: lint/rules/index
 
 # noUselessFragments (since v0.10.0)
 
+> This rule is recommended by Rome.
+
 Disallow unnecessary fragments
 
 ## Examples
@@ -19,7 +21,7 @@ foo
 
 
complexity/noUselessFragments.js:1:1 lint/complexity/noUselessFragments  FIXABLE  ━━━━━━━━━━━━━━━━━━
 
-   Avoid using unnecessary Fragment.
+   Avoid using unnecessary Fragment.
   
   > 1 │ <>
    ^^
@@ -47,7 +49,7 @@ foo
 
 
complexity/noUselessFragments.js:1:1 lint/complexity/noUselessFragments  FIXABLE  ━━━━━━━━━━━━━━━━━━
 
-   Avoid using unnecessary Fragment.
+   Avoid using unnecessary Fragment.
   
   > 1 │ <React.Fragment>
    ^^^^^^^^^^^^^^^^
@@ -76,7 +78,7 @@ foo
 
 
complexity/noUselessFragments.js:2:5 lint/complexity/noUselessFragments  FIXABLE  ━━━━━━━━━━━━━━━━━━
 
-   Avoid using unnecessary Fragment.
+   Avoid using unnecessary Fragment.
   
     1 │ <>
   > 2 │     <>foo</>
@@ -96,7 +98,7 @@ foo
 
 
complexity/noUselessFragments.js:1:1 lint/complexity/noUselessFragments  FIXABLE  ━━━━━━━━━━━━━━━━━━
 
-   Avoid using unnecessary Fragment.
+   Avoid using unnecessary Fragment.
   
   > 1 │ <></>
    ^^^^^
diff --git a/website/src/pages/lint/rules/useCamelCase.md b/website/src/pages/lint/rules/useCamelCase.md
deleted file mode 100644
index e104f75c7e8..00000000000
--- a/website/src/pages/lint/rules/useCamelCase.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-title: Lint Rule useCamelCase
-parent: lint/rules/index
----
-
-# useCamelCase (since v0.8.0)
-
-Enforce camel case naming convention.
-
-## Examples
-
-### Invalid
-
-```jsx
-let snake_case;
-```
-
-
nursery/useCamelCase.js:1:5 lint/nursery/useCamelCase  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-
-   Prefer variables names in camel case.
-  
-  > 1 │ let snake_case;
-       ^^^^^^^^^^
-    2 │ 
-  
-   Safe fix: Rename this symbol to camel case
-  
-    1  - let·snake_case;
-      1+ let·snakeCase;
-    2 2  
-  
-
- -```jsx -let PascalCase; -``` - -
nursery/useCamelCase.js:1:5 lint/nursery/useCamelCase  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-
-   Prefer variables names in camel case.
-  
-  > 1 │ let PascalCase;
-       ^^^^^^^^^^
-    2 │ 
-  
-   Safe fix: Rename this symbol to camel case
-  
-    1  - let·PascalCase;
-      1+ let·pascalCase;
-    2 2  
-  
-
- -## Valid - -```jsx -let camelCase; -``` - -## Related links - -- [Disable a rule](/linter/#disable-a-lint-rule) -- [Rule options](/linter/#rule-options) diff --git a/website/src/pages/lint/rules/useExponentiationOperator.md b/website/src/pages/lint/rules/useExponentiationOperator.md index 8426e0ac326..6f5157a89b1 100644 --- a/website/src/pages/lint/rules/useExponentiationOperator.md +++ b/website/src/pages/lint/rules/useExponentiationOperator.md @@ -5,6 +5,8 @@ parent: lint/rules/index # useExponentiationOperator (since v11.0.0) +> This rule is recommended by Rome. + Disallow the use of `Math.pow` in favor of the `**` operator. >Introduced in ES2016, the infix exponentiation operator ** is an alternative for the standard Math.pow function. @@ -23,7 +25,7 @@ const foo = Math.pow(2, 8);
style/useExponentiationOperator.js:1:13 lint/style/useExponentiationOperator  FIXABLE  ━━━━━━━━━━━━━
 
-   Use the '**' operator instead of 'Math.pow'.
+   Use the '**' operator instead of 'Math.pow'.
   
   > 1 │ const foo = Math.pow(2, 8);
                ^^^^^^^^^^^^^^
@@ -43,7 +45,7 @@ const bar = Math.pow(a, b);
 
 
style/useExponentiationOperator.js:1:13 lint/style/useExponentiationOperator  FIXABLE  ━━━━━━━━━━━━━
 
-   Use the '**' operator instead of 'Math.pow'.
+   Use the '**' operator instead of 'Math.pow'.
   
   > 1 │ const bar = Math.pow(a, b);
                ^^^^^^^^^^^^^^
@@ -63,7 +65,7 @@ let baz = Math.pow(a + b, c + d);
 
 
style/useExponentiationOperator.js:1:11 lint/style/useExponentiationOperator  FIXABLE  ━━━━━━━━━━━━━
 
-   Use the '**' operator instead of 'Math.pow'.
+   Use the '**' operator instead of 'Math.pow'.
   
   > 1 │ let baz = Math.pow(a + b, c + d);
              ^^^^^^^^^^^^^^^^^^^^^^
@@ -83,7 +85,7 @@ let quux = Math.pow(-1, n);
 
 
style/useExponentiationOperator.js:1:12 lint/style/useExponentiationOperator  FIXABLE  ━━━━━━━━━━━━━
 
-   Use the '**' operator instead of 'Math.pow'.
+   Use the '**' operator instead of 'Math.pow'.
   
   > 1 │ let quux = Math.pow(-1, n);
               ^^^^^^^^^^^^^^^
diff --git a/website/src/pages/lint/rules/useHeadingContent.md b/website/src/pages/lint/rules/useHeadingContent.md
index 2aa722b5322..338967608e4 100644
--- a/website/src/pages/lint/rules/useHeadingContent.md
+++ b/website/src/pages/lint/rules/useHeadingContent.md
@@ -16,7 +16,7 @@ Accessible means that it is not hidden using the aria-hidden prop.
 

``` -
nursery/useHeadingContent.js:1:1 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
a11y/useHeadingContent.js:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Provide screen reader accessible content when using heading  elements.
   
@@ -32,7 +32,7 @@ Accessible means that it is not hidden using the aria-hidden prop.
 

``` -
nursery/useHeadingContent.js:1:1 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
a11y/useHeadingContent.js:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Provide screen reader accessible content when using heading  elements.
   
@@ -48,7 +48,7 @@ Accessible means that it is not hidden using the aria-hidden prop.
 

``` -
nursery/useHeadingContent.js:1:1 lint/nursery/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
a11y/useHeadingContent.js:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Provide screen reader accessible content when using heading  elements.
   
diff --git a/website/src/pages/lint/rules/useIsNan.md b/website/src/pages/lint/rules/useIsNan.md
index 0199fdc0e56..d60a2faf64a 100644
--- a/website/src/pages/lint/rules/useIsNan.md
+++ b/website/src/pages/lint/rules/useIsNan.md
@@ -5,6 +5,8 @@ parent: lint/rules/index
 
 # useIsNan (since v12.0.0)
 
+> This rule is recommended by Rome.
+
 Require calls to `isNaN()` when checking for `NaN`.
 
 In JavaScript, `NaN` is a special value of the `Number` type.
@@ -32,7 +34,7 @@ Source: [use-isnan](https://eslint.org/docs/latest/rules/use-isnan).
 123 == NaN
 ```
 
-
nursery/useIsNan.js:1:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
correctness/useIsNan.js:1:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Use the Number.isNaN function to compare with NaN.
   
@@ -46,7 +48,7 @@ Source: [use-isnan](https://eslint.org/docs/latest/rules/use-isnan).
 123 != NaN
 ```
 
-
nursery/useIsNan.js:1:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
correctness/useIsNan.js:1:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Use the Number.isNaN function to compare with NaN.
   
@@ -60,7 +62,7 @@ Source: [use-isnan](https://eslint.org/docs/latest/rules/use-isnan).
 switch(foo) { case (NaN): break; }
 ```
 
-
nursery/useIsNan.js:1:20 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
correctness/useIsNan.js:1:20 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    'case NaN' can never match. Use Number.isNaN before the switch.
   
@@ -74,7 +76,7 @@ switch(foo) { case (NaN): break; }
 Number.NaN == "abc"
 ```
 
-
nursery/useIsNan.js:1:1 lint/nursery/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
correctness/useIsNan.js:1:1 lint/correctness/useIsNan ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    Use the Number.isNaN function to compare with NaN.
   
diff --git a/website/src/pages/lint/rules/useLiteralKeys.md b/website/src/pages/lint/rules/useLiteralKeys.md
index 2de63b68228..f512ba6ff97 100644
--- a/website/src/pages/lint/rules/useLiteralKeys.md
+++ b/website/src/pages/lint/rules/useLiteralKeys.md
@@ -5,6 +5,8 @@ parent: lint/rules/index
 
 # useLiteralKeys (since v12.1.0)
 
+> This rule is recommended by Rome.
+
 Enforce the usage of a literal access to properties over computed property access.
 
 ## Examples
@@ -15,7 +17,7 @@ Enforce the usage of a literal access to properties over computed property acces
 a.b["c"];
 ```
 
-
nursery/useLiteralKeys.js:1:5 lint/nursery/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useLiteralKeys.js:1:5 lint/complexity/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    The computed expression can be simplified without the use of a string literal.
   
@@ -35,7 +37,7 @@ a.b["c"];
 a.c[`d`]
 ```
 
-
nursery/useLiteralKeys.js:1:5 lint/nursery/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useLiteralKeys.js:1:5 lint/complexity/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    The computed expression can be simplified without the use of a string literal.
   
@@ -55,7 +57,7 @@ a.c[`d`]
 a.c[`d`] = "something"
 ```
 
-
nursery/useLiteralKeys.js:1:5 lint/nursery/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useLiteralKeys.js:1:5 lint/complexity/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    The computed expression can be simplified without the use of a string literal.
   
@@ -77,7 +79,7 @@ a = {
 }
 ```
 
-
nursery/useLiteralKeys.js:2:3 lint/nursery/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useLiteralKeys.js:2:3 lint/complexity/useLiteralKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━
 
    The computed expression can be simplified without the use of a string literal.
   
diff --git a/website/src/pages/lint/rules/useSimpleNumberKeys.md b/website/src/pages/lint/rules/useSimpleNumberKeys.md
index eb5c7e74e68..a2658b9231d 100644
--- a/website/src/pages/lint/rules/useSimpleNumberKeys.md
+++ b/website/src/pages/lint/rules/useSimpleNumberKeys.md
@@ -15,7 +15,7 @@ Disallow number literal object member names which are not base10 or uses undersc
 ({ 0x1: 1 });
 ```
 
-
nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useSimpleNumberKeys.js:1:4 lint/complexity/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━
 
    Hexadecimal number literal is not allowed here.
   
@@ -35,7 +35,7 @@ Disallow number literal object member names which are not base10 or uses undersc
 ({ 11_1.11: "ee" });
 ```
 
-
nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useSimpleNumberKeys.js:1:4 lint/complexity/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━
 
    Number literal with underscore is not allowed here.
   
@@ -55,7 +55,7 @@ Disallow number literal object member names which are not base10 or uses undersc
 ({ 0o1: 1 });
 ```
 
-
nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useSimpleNumberKeys.js:1:4 lint/complexity/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━
 
    Octal number literal is not allowed here.
   
@@ -75,7 +75,7 @@ Disallow number literal object member names which are not base10 or uses undersc
 ({ 1n: 1 });
 ```
 
-
nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useSimpleNumberKeys.js:1:4 lint/complexity/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━
 
    Bigint is not allowed here.
   
@@ -95,7 +95,7 @@ Disallow number literal object member names which are not base10 or uses undersc
 ({ 11_1.11: "ee" });
 ```
 
-
nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━
+
complexity/useSimpleNumberKeys.js:1:4 lint/complexity/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━
 
    Number literal with underscore is not allowed here.