@ttsc/lint 0.14.0-dev.20260529.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -87
- package/lib/defaultFormat.d.ts +10 -6
- package/lib/defaultFormat.js +10 -6
- package/lib/defaultFormat.js.map +1 -1
- package/lib/structures/ITtscLintConfig.d.ts +5 -5
- package/lib/structures/TtscLintRuleSetting.d.ts +19 -19
- package/lib/structures/{ITtscLintFormat.d.ts → format/ITtscLintFormat.d.ts} +45 -70
- package/lib/structures/format/ITtscLintFormat.js.map +1 -0
- package/lib/structures/format/ITtscLintFormatJsDoc.d.ts +15 -0
- package/lib/structures/format/ITtscLintFormatJsDoc.js +3 -0
- package/lib/structures/format/ITtscLintFormatJsDoc.js.map +1 -0
- package/lib/structures/format/ITtscLintFormatSortImports.d.ts +54 -0
- package/lib/structures/format/ITtscLintFormatSortImports.js +3 -0
- package/lib/structures/format/ITtscLintFormatSortImports.js.map +1 -0
- package/lib/structures/format/index.d.ts +3 -0
- package/lib/structures/format/index.js +20 -0
- package/lib/structures/format/index.js.map +1 -0
- package/lib/structures/index.d.ts +1 -1
- package/lib/structures/index.js +1 -1
- package/lib/structures/index.js.map +1 -1
- package/lib/structures/rules/ITtscLintBoundariesRuleOptions.d.ts +18 -27
- package/lib/structures/rules/ITtscLintBoundariesRuleOptions.js +4 -5
- package/lib/structures/rules/ITtscLintBoundariesRuleOptions.js.map +1 -1
- package/lib/structures/rules/ITtscLintBoundariesRules.d.ts +29 -33
- package/lib/structures/rules/ITtscLintContributorRules.d.ts +6 -7
- package/lib/structures/rules/ITtscLintCoreRules.d.ts +380 -408
- package/lib/structures/rules/ITtscLintCypressRuleOptions.d.ts +5 -5
- package/lib/structures/rules/ITtscLintCypressRuleOptions.js +2 -2
- package/lib/structures/rules/ITtscLintCypressRules.d.ts +34 -38
- package/lib/structures/rules/ITtscLintFunctionalRuleOptions.d.ts +21 -24
- package/lib/structures/rules/ITtscLintFunctionalRuleOptions.js +2 -2
- package/lib/structures/rules/ITtscLintFunctionalRules.d.ts +51 -56
- package/lib/structures/rules/ITtscLintJestRules.d.ts +63 -74
- package/lib/structures/rules/ITtscLintJsdocRules.d.ts +47 -54
- package/lib/structures/rules/ITtscLintJsxA11yRules.d.ts +94 -102
- package/lib/structures/rules/ITtscLintNextjsRules.d.ts +50 -55
- package/lib/structures/rules/ITtscLintPlaywrightRules.d.ts +104 -122
- package/lib/structures/rules/ITtscLintPromiseRules.d.ts +62 -71
- package/lib/structures/rules/ITtscLintReactPerfRuleOptions.d.ts +4 -4
- package/lib/structures/rules/ITtscLintReactPerfRules.d.ts +17 -19
- package/lib/structures/rules/ITtscLintReactRuleOptions.d.ts +8 -10
- package/lib/structures/rules/ITtscLintReactRuleOptions.js +1 -2
- package/lib/structures/rules/ITtscLintReactRuleOptions.js.map +1 -1
- package/lib/structures/rules/ITtscLintReactRules.d.ts +91 -104
- package/lib/structures/rules/ITtscLintRegexpRules.d.ts +46 -54
- package/lib/structures/rules/ITtscLintRuleOptionsMap.d.ts +7 -8
- package/lib/structures/rules/ITtscLintSecurityRules.d.ts +45 -52
- package/lib/structures/rules/ITtscLintSolidRules.d.ts +53 -56
- package/lib/structures/rules/ITtscLintStorybookRuleOptions.d.ts +3 -4
- package/lib/structures/rules/ITtscLintStorybookRules.d.ts +60 -69
- package/lib/structures/rules/ITtscLintTanstackQueryRules.d.ts +31 -37
- package/lib/structures/rules/ITtscLintTestingLibraryRuleOptions.d.ts +2 -3
- package/lib/structures/rules/ITtscLintTestingLibraryRules.d.ts +102 -119
- package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +460 -518
- package/lib/structures/rules/ITtscLintVitestRules.d.ts +43 -51
- package/linthost/config.go +89 -72
- package/linthost/config_format.go +265 -99
- package/linthost/directives.go +5 -1
- package/linthost/display_width.go +72 -0
- package/linthost/fix.go +26 -1
- package/linthost/format.go +222 -25
- package/linthost/format_editor_settings.go +262 -0
- package/linthost/lsp.go +8 -4
- package/linthost/print_dispatch.go +3 -0
- package/linthost/print_doc.go +13 -0
- package/linthost/print_engine.go +68 -11
- package/linthost/print_nodes_array.go +108 -5
- package/linthost/print_nodes_call.go +515 -74
- package/linthost/print_nodes_function.go +25 -0
- package/linthost/print_nodes_imports.go +47 -14
- package/linthost/print_nodes_list.go +191 -8
- package/linthost/print_nodes_object.go +12 -6
- package/linthost/print_nodes_ternary.go +106 -0
- package/linthost/rules_boundaries.go +400 -400
- package/linthost/rules_camelcase.go +81 -81
- package/linthost/rules_complexity.go +52 -51
- package/linthost/rules_consistent_return.go +81 -81
- package/linthost/rules_core_extra.go +472 -472
- package/linthost/rules_curly.go +43 -43
- package/linthost/rules_default_case.go +15 -15
- package/linthost/rules_default_case_last.go +22 -22
- package/linthost/rules_format_arrow_parens.go +167 -0
- package/linthost/rules_format_bracket_spacing.go +117 -0
- package/linthost/rules_format_clause_join.go +172 -0
- package/linthost/rules_format_declaration_header.go +664 -0
- package/linthost/rules_format_indent.go +616 -0
- package/linthost/rules_format_jsdoc.go +4 -4
- package/linthost/rules_format_orphan_semi.go +106 -0
- package/linthost/rules_format_parameter_properties.go +175 -0
- package/linthost/rules_format_print_width.go +185 -69
- package/linthost/rules_format_quote_props.go +169 -0
- package/linthost/rules_format_quotes.go +75 -29
- package/linthost/rules_format_semi.go +185 -10
- package/linthost/rules_format_sort_imports.go +456 -121
- package/linthost/rules_format_statement_split.go +368 -0
- package/linthost/rules_format_ternary_nullish_parens.go +77 -0
- package/linthost/rules_format_trailing_comma.go +21 -2
- package/linthost/rules_format_whitespace.go +336 -0
- package/linthost/rules_functional.go +688 -688
- package/linthost/rules_gap.go +146 -11
- package/linthost/rules_grouped_accessor_pairs.go +60 -60
- package/linthost/rules_guard_for_in.go +122 -122
- package/linthost/rules_id_length.go +44 -44
- package/linthost/rules_imports.go +11 -3
- package/linthost/rules_init_declarations.go +25 -25
- package/linthost/rules_jsx_a11y.go +844 -844
- package/linthost/rules_max_classes_per_file.go +24 -24
- package/linthost/rules_max_depth.go +43 -43
- package/linthost/rules_max_lines.go +53 -53
- package/linthost/rules_max_lines_per_function.go +28 -28
- package/linthost/rules_max_nested_callbacks.go +26 -26
- package/linthost/rules_max_params.go +20 -20
- package/linthost/rules_max_statements.go +29 -29
- package/linthost/rules_nextjs.go +5 -5
- package/linthost/rules_no_else_return.go +38 -38
- package/linthost/rules_no_empty_named_blocks.go +45 -45
- package/linthost/rules_no_import_assign.go +96 -96
- package/linthost/rules_no_invalid_this.go +19 -19
- package/linthost/rules_no_loop_func.go +43 -43
- package/linthost/rules_no_magic_numbers.go +60 -60
- package/linthost/rules_no_mixed_operators.go +44 -44
- package/linthost/rules_no_param_reassign.go +64 -64
- package/linthost/rules_no_restricted_imports.go +45 -45
- package/linthost/rules_no_restricted_syntax.go +17 -17
- package/linthost/rules_no_shadow.go +112 -112
- package/linthost/rules_no_unreachable.go +36 -36
- package/linthost/rules_no_useless_assignment.go +79 -79
- package/linthost/rules_no_useless_constructor.go +167 -167
- package/linthost/rules_no_useless_return.go +28 -28
- package/linthost/rules_prefer_arrow_callback.go +74 -74
- package/linthost/rules_prefer_destructuring.go +61 -61
- package/linthost/rules_prefer_named_capture_group.go +87 -87
- package/linthost/rules_prefer_rest_params.go +61 -61
- package/linthost/rules_promise.go +800 -800
- package/linthost/rules_react.go +600 -600
- package/linthost/rules_react_extras.go +162 -162
- package/linthost/rules_react_hooks.go +2 -2
- package/linthost/rules_react_perf.go +231 -231
- package/linthost/rules_regexp.go +293 -293
- package/linthost/rules_security.go +613 -613
- package/linthost/rules_sort_imports.go +37 -37
- package/linthost/rules_sort_keys.go +88 -88
- package/linthost/rules_suggestions.go +13 -0
- package/linthost/rules_ts.go +2 -2
- package/linthost/rules_ts_async.go +247 -247
- package/linthost/rules_ts_class_literal_property_style.go +64 -64
- package/linthost/rules_ts_consistent_type_exports.go +209 -209
- package/linthost/rules_ts_explicit_function_return_type.go +35 -35
- package/linthost/rules_ts_extra.go +6 -2
- package/linthost/rules_ts_no_base_to_string.go +140 -140
- package/linthost/rules_ts_no_confusing_void.go +28 -28
- package/linthost/rules_ts_no_deprecated.go +110 -110
- package/linthost/rules_ts_no_for_in_array.go +45 -45
- package/linthost/rules_ts_no_magic_numbers.go +67 -67
- package/linthost/rules_ts_no_meaningless_void_operator.go +44 -44
- package/linthost/rules_ts_no_misused_spread.go +64 -64
- package/linthost/rules_ts_no_redundant_type_constituents.go +72 -72
- package/linthost/rules_ts_no_restricted_types.go +28 -28
- package/linthost/rules_ts_no_unnecessary_boolean_literal_compare.go +87 -87
- package/linthost/rules_ts_no_unnecessary_condition.go +184 -184
- package/linthost/rules_ts_no_unnecessary_qualifier.go +72 -72
- package/linthost/rules_ts_no_unnecessary_template_expression.go +120 -120
- package/linthost/rules_ts_no_unnecessary_type_arguments.go +171 -171
- package/linthost/rules_ts_no_unnecessary_type_assertion.go +90 -90
- package/linthost/rules_ts_no_unsafe_argument.go +50 -50
- package/linthost/rules_ts_no_unsafe_assignment.go +60 -60
- package/linthost/rules_ts_no_unsafe_call.go +40 -40
- package/linthost/rules_ts_no_unsafe_enum_comparison.go +147 -147
- package/linthost/rules_ts_no_unsafe_member_access.go +29 -29
- package/linthost/rules_ts_no_unsafe_return.go +64 -64
- package/linthost/rules_ts_no_unsafe_unary_minus.go +42 -42
- package/linthost/rules_ts_no_useless_constructor.go +20 -20
- package/linthost/rules_ts_non_nullable_type_assertion_style.go +60 -60
- package/linthost/rules_ts_parameter_properties.go +10 -10
- package/linthost/rules_ts_prefer_find.go +116 -116
- package/linthost/rules_ts_prefer_includes.go +173 -173
- package/linthost/rules_ts_prefer_nullish_coalescing.go +54 -54
- package/linthost/rules_ts_prefer_optional_chain.go +156 -156
- package/linthost/rules_ts_prefer_promise_reject_errors.go +104 -104
- package/linthost/rules_ts_prefer_readonly.go +31 -31
- package/linthost/rules_ts_prefer_reduce_type_parameter.go +74 -74
- package/linthost/rules_ts_prefer_regexp_exec.go +69 -69
- package/linthost/rules_ts_prefer_return_this_type.go +79 -79
- package/linthost/rules_ts_prefer_string_starts_ends_with.go +237 -237
- package/linthost/rules_ts_promise_function_async.go +41 -41
- package/linthost/rules_ts_related_getter_setter_pairs.go +61 -61
- package/linthost/rules_ts_require_array_sort_compare.go +58 -58
- package/linthost/rules_ts_restrict_plus_operands.go +82 -82
- package/linthost/rules_ts_restrict_template_expressions.go +50 -50
- package/linthost/rules_ts_simple.go +249 -249
- package/linthost/rules_ts_sort_type_constituents.go +88 -88
- package/linthost/rules_ts_strict_boolean_expressions.go +103 -103
- package/linthost/rules_ts_switch_exhaustiveness_check.go +90 -90
- package/linthost/rules_ts_unbound_method.go +65 -65
- package/linthost/rules_tsdoc.go +88 -88
- package/linthost/rules_unicorn_better_regex.go +1 -1
- package/linthost/rules_unicorn_catch_error_name.go +19 -19
- package/linthost/rules_unicorn_consistent_assert.go +20 -20
- package/linthost/rules_unicorn_consistent_date_clone.go +27 -27
- package/linthost/rules_unicorn_consistent_destructuring.go +3 -3
- package/linthost/rules_unicorn_consistent_empty_array_spread.go +34 -34
- package/linthost/rules_unicorn_consistent_existence_index_check.go +42 -42
- package/linthost/rules_unicorn_consistent_function_scoping.go +3 -3
- package/linthost/rules_unicorn_consistent_template_literal_escape.go +3 -3
- package/linthost/rules_unicorn_custom_error_definition.go +92 -92
- package/linthost/rules_unicorn_empty_brace_spaces.go +47 -47
- package/linthost/rules_unicorn_error_message.go +34 -34
- package/linthost/rules_unicorn_escape_case.go +14 -14
- package/linthost/rules_unicorn_expiring_todo_comments.go +36 -36
- package/linthost/rules_unicorn_explicit_length_check.go +51 -51
- package/linthost/rules_unicorn_filename_case.go +1 -1
- package/linthost/rules_unicorn_import_style.go +1 -1
- package/linthost/rules_unicorn_isolated_functions.go +2 -2
- package/linthost/rules_unicorn_new_for_builtins.go +49 -49
- package/linthost/rules_unicorn_no_abusive_eslint_disable.go +31 -31
- package/linthost/rules_unicorn_no_accessor_recursion.go +69 -69
- package/linthost/rules_unicorn_no_anonymous_default_export.go +40 -40
- package/linthost/rules_unicorn_no_array_callback_reference.go +33 -33
- package/linthost/rules_unicorn_no_array_for_each.go +14 -14
- package/linthost/rules_unicorn_no_array_method_this_argument.go +29 -29
- package/linthost/rules_unicorn_no_array_reduce.go +15 -15
- package/linthost/rules_unicorn_no_array_reverse.go +17 -17
- package/linthost/rules_unicorn_no_array_sort.go +17 -17
- package/linthost/rules_unicorn_no_await_expression_member.go +12 -12
- package/linthost/rules_unicorn_no_await_in_promise_methods.go +38 -38
- package/linthost/rules_unicorn_no_console_spaces.go +30 -30
- package/linthost/rules_unicorn_no_document_cookie.go +13 -13
- package/linthost/rules_unicorn_no_empty_file.go +16 -16
- package/linthost/rules_unicorn_no_for_loop.go +58 -58
- package/linthost/rules_unicorn_no_hex_escape.go +11 -11
- package/linthost/rules_unicorn_no_immediate_mutation.go +55 -55
- package/linthost/rules_unicorn_no_instanceof_builtins.go +34 -34
- package/linthost/rules_unicorn_no_invalid_fetch_options.go +52 -52
- package/linthost/rules_unicorn_no_invalid_remove_event_listener.go +25 -25
- package/linthost/rules_unicorn_no_keyword_prefix.go +56 -56
- package/linthost/rules_unicorn_no_lonely_if.go +21 -21
- package/linthost/rules_unicorn_no_magic_array_flat_depth.go +22 -22
- package/linthost/rules_unicorn_no_named_default.go +25 -25
- package/linthost/rules_unicorn_no_negated_condition.go +54 -54
- package/linthost/rules_unicorn_no_negation_in_equality_check.go +23 -23
- package/linthost/rules_unicorn_no_nested_ternary.go +15 -15
- package/linthost/rules_unicorn_no_new_array.go +5 -5
- package/linthost/rules_unicorn_no_new_buffer.go +5 -5
- package/linthost/rules_unicorn_no_null.go +2 -2
- package/linthost/rules_unicorn_no_object_as_default_parameter.go +19 -19
- package/linthost/rules_unicorn_no_process_exit.go +17 -17
- package/linthost/rules_unicorn_no_single_promise_in_promise_methods.go +29 -29
- package/linthost/rules_unicorn_no_static_only_class.go +27 -27
- package/linthost/rules_unicorn_no_thenable.go +47 -47
- package/linthost/rules_unicorn_no_this_assignment.go +10 -10
- package/linthost/rules_unicorn_no_typeof_undefined.go +31 -31
- package/linthost/rules_unicorn_no_unnecessary_array_flat_depth.go +23 -23
- package/linthost/rules_unicorn_no_unnecessary_array_splice_count.go +37 -37
- package/linthost/rules_unicorn_no_unnecessary_await.go +24 -24
- package/linthost/rules_unicorn_no_unnecessary_slice_end.go +22 -22
- package/linthost/rules_unicorn_no_unreadable_array_destructuring.go +67 -67
- package/linthost/rules_unicorn_no_unreadable_iife.go +22 -22
- package/linthost/rules_unicorn_no_useless_collection_argument.go +34 -34
- package/linthost/rules_unicorn_no_useless_error_capture_stack_trace.go +18 -18
- package/linthost/rules_unicorn_no_useless_fallback_in_spread.go +49 -49
- package/linthost/rules_unicorn_no_useless_iterator_to_array.go +41 -41
- package/linthost/rules_unicorn_no_useless_length_check.go +82 -82
- package/linthost/rules_unicorn_no_useless_promise_resolve_reject.go +42 -42
- package/linthost/rules_unicorn_no_useless_spread.go +38 -38
- package/linthost/rules_unicorn_no_useless_switch_case.go +29 -29
- package/linthost/rules_unicorn_no_useless_undefined.go +25 -25
- package/linthost/rules_unicorn_no_zero_fractions.go +17 -17
- package/linthost/rules_unicorn_number_literal_case.go +33 -33
- package/linthost/rules_unicorn_numeric_separators_style.go +36 -36
- package/linthost/rules_unicorn_prefer_add_event_listener.go +30 -30
- package/linthost/rules_unicorn_prefer_array_find.go +27 -27
- package/linthost/rules_unicorn_prefer_array_flat.go +25 -25
- package/linthost/rules_unicorn_prefer_array_flat_map.go +37 -37
- package/linthost/rules_unicorn_prefer_array_index_of.go +108 -108
- package/linthost/rules_unicorn_prefer_array_some.go +43 -43
- package/linthost/rules_unicorn_prefer_at.go +42 -42
- package/linthost/rules_unicorn_prefer_bigint_literals.go +42 -42
- package/linthost/rules_unicorn_prefer_blob_reading_methods.go +15 -15
- package/linthost/rules_unicorn_prefer_class_fields.go +57 -57
- package/linthost/rules_unicorn_prefer_classlist_toggle.go +76 -76
- package/linthost/rules_unicorn_prefer_code_point.go +21 -21
- package/linthost/rules_unicorn_prefer_date_now.go +47 -47
- package/linthost/rules_unicorn_prefer_default_parameters.go +96 -96
- package/linthost/rules_unicorn_prefer_dom_node_append.go +14 -14
- package/linthost/rules_unicorn_prefer_dom_node_dataset.go +27 -27
- package/linthost/rules_unicorn_prefer_dom_node_remove.go +17 -17
- package/linthost/rules_unicorn_prefer_dom_node_text_content.go +11 -11
- package/linthost/rules_unicorn_prefer_event_target.go +10 -10
- package/linthost/rules_unicorn_prefer_export_from.go +99 -99
- package/linthost/rules_unicorn_prefer_global_this.go +91 -91
- package/linthost/rules_unicorn_prefer_import_meta_properties.go +38 -38
- package/linthost/rules_unicorn_prefer_includes.go +108 -108
- package/linthost/rules_unicorn_prefer_json_parse_buffer.go +37 -37
- package/linthost/rules_unicorn_prefer_keyboard_event_key.go +10 -10
- package/linthost/rules_unicorn_prefer_logical_operator_over_ternary.go +20 -20
- package/linthost/rules_unicorn_prefer_math_min_max.go +33 -33
- package/linthost/rules_unicorn_prefer_math_trunc.go +32 -32
- package/linthost/rules_unicorn_prefer_modern_dom_apis.go +18 -18
- package/linthost/rules_unicorn_prefer_modern_math_apis.go +38 -38
- package/linthost/rules_unicorn_prefer_module.go +22 -22
- package/linthost/rules_unicorn_prefer_native_coercion_functions.go +73 -73
- package/linthost/rules_unicorn_prefer_negative_index.go +46 -46
- package/linthost/rules_unicorn_prefer_node_protocol.go +90 -90
- package/linthost/rules_unicorn_prefer_number_properties.go +57 -57
- package/linthost/rules_unicorn_prefer_object_from_entries.go +26 -26
- package/linthost/rules_unicorn_prefer_optional_catch_binding.go +24 -24
- package/linthost/rules_unicorn_prefer_prototype_methods.go +25 -25
- package/linthost/rules_unicorn_prefer_query_selector.go +25 -25
- package/linthost/rules_unicorn_prefer_reflect_apply.go +10 -10
- package/linthost/rules_unicorn_prefer_regexp_test_rule.go +47 -47
- package/linthost/rules_unicorn_prefer_response_static_json.go +26 -26
- package/linthost/rules_unicorn_prefer_set_has.go +16 -16
- package/linthost/rules_unicorn_prefer_set_size.go +22 -22
- package/linthost/rules_unicorn_prefer_simple_condition_first.go +3 -3
- package/linthost/rules_unicorn_prefer_single_call.go +59 -59
- package/linthost/rules_unicorn_prefer_spread.go +24 -24
- package/linthost/rules_unicorn_prefer_string_raw.go +12 -12
- package/linthost/rules_unicorn_prefer_string_replace_all.go +46 -46
- package/linthost/rules_unicorn_prefer_string_slice.go +17 -17
- package/linthost/rules_unicorn_prefer_string_starts_ends_with.go +104 -104
- package/linthost/rules_unicorn_prefer_string_trim_start_end.go +21 -21
- package/linthost/rules_unicorn_prefer_structured_clone.go +36 -36
- package/linthost/rules_unicorn_prefer_switch.go +65 -65
- package/linthost/rules_unicorn_prefer_ternary.go +35 -35
- package/linthost/rules_unicorn_prefer_top_level_await.go +34 -34
- package/linthost/rules_unicorn_prefer_type_error.go +84 -84
- package/linthost/rules_unicorn_prevent_abbreviations.go +68 -68
- package/linthost/rules_unicorn_relative_url_style.go +19 -19
- package/linthost/rules_unicorn_require_array_join_separator.go +18 -18
- package/linthost/rules_unicorn_require_module_attributes.go +25 -25
- package/linthost/rules_unicorn_require_module_specifiers.go +28 -28
- package/linthost/rules_unicorn_require_number_to_fixed_digits_argument.go +18 -18
- package/linthost/rules_unicorn_require_post_message_target_origin.go +18 -18
- package/linthost/rules_unicorn_string_content.go +1 -1
- package/linthost/rules_unicorn_switch_case_braces.go +16 -16
- package/linthost/rules_unicorn_switch_case_break_position.go +3 -3
- package/linthost/rules_unicorn_template_indent.go +1 -1
- package/linthost/rules_unicorn_text_encoding_identifier_case.go +36 -36
- package/linthost/rules_unicorn_throw_new_error.go +30 -30
- package/linthost/rules_var.go +273 -3
- package/package.json +3 -3
- package/src/defaultFormat.ts +11 -7
- package/src/structures/ITtscLintConfig.ts +5 -5
- package/src/structures/TtscLintRuleSetting.ts +19 -19
- package/src/structures/{ITtscLintFormat.ts → format/ITtscLintFormat.ts} +48 -75
- package/src/structures/format/ITtscLintFormatJsDoc.ts +16 -0
- package/src/structures/format/ITtscLintFormatSortImports.ts +62 -0
- package/src/structures/format/index.ts +3 -0
- package/src/structures/index.ts +1 -1
- package/src/structures/rules/ITtscLintBoundariesRuleOptions.ts +20 -31
- package/src/structures/rules/ITtscLintBoundariesRules.ts +32 -36
- package/src/structures/rules/ITtscLintContributorRules.ts +6 -7
- package/src/structures/rules/ITtscLintCoreRules.ts +380 -408
- package/src/structures/rules/ITtscLintCypressRuleOptions.ts +5 -5
- package/src/structures/rules/ITtscLintCypressRules.ts +34 -38
- package/src/structures/rules/ITtscLintFunctionalRuleOptions.ts +28 -41
- package/src/structures/rules/ITtscLintFunctionalRules.ts +51 -56
- package/src/structures/rules/ITtscLintJestRules.ts +63 -74
- package/src/structures/rules/ITtscLintJsdocRules.ts +47 -54
- package/src/structures/rules/ITtscLintJsxA11yRules.ts +94 -102
- package/src/structures/rules/ITtscLintNextjsRules.ts +50 -55
- package/src/structures/rules/ITtscLintPlaywrightRules.ts +104 -122
- package/src/structures/rules/ITtscLintPromiseRules.ts +62 -71
- package/src/structures/rules/ITtscLintReactPerfRuleOptions.ts +4 -4
- package/src/structures/rules/ITtscLintReactPerfRules.ts +17 -19
- package/src/structures/rules/ITtscLintReactRuleOptions.ts +8 -10
- package/src/structures/rules/ITtscLintReactRules.ts +91 -104
- package/src/structures/rules/ITtscLintRegexpRules.ts +46 -54
- package/src/structures/rules/ITtscLintRuleOptionsMap.ts +7 -8
- package/src/structures/rules/ITtscLintSecurityRules.ts +45 -52
- package/src/structures/rules/ITtscLintSolidRules.ts +53 -56
- package/src/structures/rules/ITtscLintStorybookRuleOptions.ts +3 -4
- package/src/structures/rules/ITtscLintStorybookRules.ts +60 -69
- package/src/structures/rules/ITtscLintTanstackQueryRules.ts +31 -37
- package/src/structures/rules/ITtscLintTestingLibraryRuleOptions.ts +2 -3
- package/src/structures/rules/ITtscLintTestingLibraryRules.ts +102 -119
- package/src/structures/rules/ITtscLintTypeScriptRules.ts +460 -518
- package/src/structures/rules/ITtscLintVitestRules.ts +43 -51
- package/lib/structures/ITtscLintFormat.js.map +0 -1
- /package/lib/structures/{ITtscLintFormat.js → format/ITtscLintFormat.js} +0 -0
|
@@ -1,97 +1,97 @@
|
|
|
1
1
|
import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Generic ESLint-compatible rules that apply to both JavaScript and
|
|
5
|
-
*
|
|
4
|
+
* Generic ESLint-compatible rules that apply to both JavaScript and TypeScript
|
|
5
|
+
* source.
|
|
6
6
|
*
|
|
7
7
|
* Every rule listed here corresponds 1-to-1 with an ESLint core rule of the
|
|
8
|
-
* same kebab-case id. TypeScript-only rules and `@typescript-eslint`
|
|
9
|
-
*
|
|
10
|
-
* {@link ITtscLintTypeScriptRules}.
|
|
8
|
+
* same kebab-case id. TypeScript-only rules and `@typescript-eslint` extension
|
|
9
|
+
* rules do **not** live here — they belong to {@link ITtscLintTypeScriptRules}.
|
|
11
10
|
*
|
|
12
|
-
* Keeping the core family namespace-free means projects migrating from
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Keeping the core family namespace-free means projects migrating from ESLint
|
|
12
|
+
* can paste their rule severities into a `ttsc.lint.config.ts` file without
|
|
13
|
+
* renaming anything.
|
|
15
14
|
*
|
|
16
|
-
* The fix availability noted in each rule's JSDoc applies when `ttsc fix`
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* The fix availability noted in each rule's JSDoc applies when `ttsc fix` or
|
|
16
|
+
* the LSP code action is invoked; a rule marked _Autofixable_ may still produce
|
|
17
|
+
* diagnostics that require human review for edge cases.
|
|
19
18
|
*
|
|
20
19
|
* @reference https://eslint.org/docs/latest/rules/
|
|
21
20
|
*/
|
|
22
21
|
export interface ITtscLintCoreRules {
|
|
23
22
|
/**
|
|
24
|
-
* Require block statements for every `if`, `else`, `while`, `for`, and `do`
|
|
23
|
+
* Require block statements for every `if`, `else`, `while`, `for`, and `do`
|
|
24
|
+
* body — reject the single-statement shorthand.
|
|
25
25
|
*
|
|
26
26
|
* @reference https://eslint.org/docs/latest/rules/curly
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
curly?: TtscLintRuleSetting;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Require `switch` statements to include a `default` clause.
|
|
32
32
|
*
|
|
33
|
-
* A switch without `default` silently drops every discriminant value
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* A switch without `default` silently drops every discriminant value that no
|
|
34
|
+
* `case` label matched. The rule forces the catch-all branch to be written
|
|
35
|
+
* out so unhandled cases become an intentional decision instead of a hidden
|
|
36
|
+
* fall-through.
|
|
37
37
|
*
|
|
38
38
|
* @reference https://eslint.org/docs/latest/rules/default-case
|
|
39
39
|
*/
|
|
40
40
|
"default-case"?: TtscLintRuleSetting;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Require the `default` clause of a `switch` statement to appear
|
|
44
|
-
*
|
|
43
|
+
* Require the `default` clause of a `switch` statement to appear after every
|
|
44
|
+
* explicit `case` label.
|
|
45
45
|
*
|
|
46
|
-
* Placing `default` ahead of a `case` reverses the visual order of
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* misordering rather than intent.
|
|
46
|
+
* Placing `default` ahead of a `case` reverses the visual order of the labels
|
|
47
|
+
* and changes the fall-through path — running `default` and then falling into
|
|
48
|
+
* the next `case` is almost always a misordering rather than intent.
|
|
50
49
|
*
|
|
51
50
|
* @reference https://eslint.org/docs/latest/rules/default-case-last
|
|
52
51
|
*/
|
|
53
52
|
"default-case-last"?: TtscLintRuleSetting;
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
|
-
* Reject identifier declarations that aren't camelCase or PascalCase —
|
|
55
|
+
* Reject identifier declarations that aren't camelCase or PascalCase —
|
|
56
|
+
* snake_case bindings are flagged.
|
|
57
57
|
*
|
|
58
58
|
* @reference https://eslint.org/docs/latest/rules/camelcase
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
camelcase?: TtscLintRuleSetting;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Reject function bodies whose cyclomatic complexity exceeds twenty (default
|
|
63
|
+
* Reject function bodies whose cyclomatic complexity exceeds twenty (default
|
|
64
|
+
* ESLint threshold).
|
|
64
65
|
*
|
|
65
66
|
* @reference https://eslint.org/docs/latest/rules/complexity
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
complexity?: TtscLintRuleSetting;
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
|
-
* Reject functions where some `return` statements return a value and
|
|
71
|
-
*
|
|
71
|
+
* Reject functions where some `return` statements return a value and others
|
|
72
|
+
* (explicit bare `return;` or implicit fall-through) do not.
|
|
72
73
|
*
|
|
73
74
|
* @reference https://eslint.org/docs/latest/rules/consistent-return
|
|
74
75
|
*/
|
|
75
76
|
"consistent-return"?: TtscLintRuleSetting;
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
|
-
* Reject `(req, opt = 1, req2)` and similar parameter lists where a
|
|
79
|
-
*
|
|
79
|
+
* Reject `(req, opt = 1, req2)` and similar parameter lists where a required
|
|
80
|
+
* parameter follows an optional or default-valued one.
|
|
80
81
|
*
|
|
81
|
-
* The call site cannot omit the trailing required parameter, so the
|
|
82
|
-
*
|
|
83
|
-
* accidental ordering.
|
|
82
|
+
* The call site cannot omit the trailing required parameter, so the optional
|
|
83
|
+
* becomes positionally required too — almost always an accidental ordering.
|
|
84
84
|
*
|
|
85
85
|
* @reference https://eslint.org/docs/latest/rules/default-param-last
|
|
86
86
|
*/
|
|
87
87
|
"default-param-last"?: TtscLintRuleSetting;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Prefer dot access (`obj.value`) over bracket access (`obj["value"]`)
|
|
91
|
-
*
|
|
90
|
+
* Prefer dot access (`obj.value`) over bracket access (`obj["value"]`) when
|
|
91
|
+
* the string key is a valid JavaScript identifier.
|
|
92
92
|
*
|
|
93
|
-
* Bracket access remains accepted for reserved words, dynamic keys, or
|
|
94
|
-
*
|
|
93
|
+
* Bracket access remains accepted for reserved words, dynamic keys, or keys
|
|
94
|
+
* containing characters that cannot appear in an identifier.
|
|
95
95
|
*
|
|
96
96
|
* @reference https://eslint.org/docs/latest/rules/dot-notation
|
|
97
97
|
*/
|
|
@@ -100,56 +100,53 @@ export interface ITtscLintCoreRules {
|
|
|
100
100
|
/**
|
|
101
101
|
* Require strict equality operators `===` / `!==` over `==` / `!=`.
|
|
102
102
|
*
|
|
103
|
-
* Loose equality performs implicit type coercion that frequently hides
|
|
104
|
-
* bugs.
|
|
103
|
+
* Loose equality performs implicit type coercion that frequently hides bugs.
|
|
105
104
|
*
|
|
106
105
|
* @reference https://eslint.org/docs/latest/rules/eqeqeq
|
|
107
106
|
*/
|
|
108
|
-
|
|
107
|
+
eqeqeq?: TtscLintRuleSetting;
|
|
109
108
|
|
|
110
109
|
/**
|
|
111
|
-
* Reject `for` statements whose update clause moves the counter away
|
|
112
|
-
*
|
|
113
|
-
*
|
|
110
|
+
* Reject `for` statements whose update clause moves the counter away from the
|
|
111
|
+
* termination condition, such as `for (let i = 0; i < 10; i--)`. Such loops
|
|
112
|
+
* either never run or never terminate.
|
|
114
113
|
*
|
|
115
114
|
* @reference https://eslint.org/docs/latest/rules/for-direction
|
|
116
115
|
*/
|
|
117
116
|
"for-direction"?: TtscLintRuleSetting;
|
|
118
117
|
|
|
119
118
|
/**
|
|
120
|
-
* Require a `get` accessor's body to return a value on every
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
119
|
+
* Require a `get` accessor's body to return a value on every reachable exit.
|
|
120
|
+
* A getter that falls through returns `undefined` to the caller, which is
|
|
121
|
+
* almost never the intent and turns into a silent bug that only surfaces when
|
|
122
|
+
* the property is finally read.
|
|
124
123
|
*
|
|
125
124
|
* @reference https://eslint.org/docs/latest/rules/getter-return
|
|
126
125
|
*/
|
|
127
126
|
"getter-return"?: TtscLintRuleSetting;
|
|
128
127
|
|
|
129
128
|
/**
|
|
130
|
-
* Require the `get` and `set` accessors of a single property to be
|
|
131
|
-
*
|
|
129
|
+
* Require the `get` and `set` accessors of a single property to be declared
|
|
130
|
+
* adjacent in the class body.
|
|
132
131
|
*
|
|
133
|
-
* When the read and write halves of a property are split apart by
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* without noticing the other.
|
|
132
|
+
* When the read and write halves of a property are split apart by unrelated
|
|
133
|
+
* members, a reader scanning the class has to chase the pair across the body
|
|
134
|
+
* — and patches to one half are easy to make without noticing the other.
|
|
137
135
|
*
|
|
138
136
|
* @reference https://eslint.org/docs/latest/rules/grouped-accessor-pairs
|
|
139
137
|
*/
|
|
140
138
|
"grouped-accessor-pairs"?: TtscLintRuleSetting;
|
|
141
139
|
|
|
142
140
|
/**
|
|
143
|
-
* Require the body of every `for (key in obj)` loop to begin with a
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* continue;` is also accepted.
|
|
141
|
+
* Require the body of every `for (key in obj)` loop to begin with a guard
|
|
142
|
+
* against inherited keys: `Object.hasOwn(obj, key)` or the older
|
|
143
|
+
* `Object.prototype.hasOwnProperty.call(obj, key)`. The inverted-guard
|
|
144
|
+
* early-skip shape `if (!Object.hasOwn(...)) continue;` is also accepted.
|
|
148
145
|
*
|
|
149
|
-
* Without the guard the loop processes every enumerable name on the
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
146
|
+
* Without the guard the loop processes every enumerable name on the prototype
|
|
147
|
+
* chain — including monkey-patches someone else attached to
|
|
148
|
+
* `Object.prototype` — so an unguarded body silently leaks work onto
|
|
149
|
+
* inherited entries.
|
|
153
150
|
*
|
|
154
151
|
* @reference https://eslint.org/docs/latest/rules/guard-for-in
|
|
155
152
|
*/
|
|
@@ -163,7 +160,8 @@ export interface ITtscLintCoreRules {
|
|
|
163
160
|
"id-length"?: TtscLintRuleSetting;
|
|
164
161
|
|
|
165
162
|
/**
|
|
166
|
-
* Require every `var` / `let` declaration to be initialized at its
|
|
163
|
+
* Require every `var` / `let` declaration to be initialized at its
|
|
164
|
+
* declaration site.
|
|
167
165
|
*
|
|
168
166
|
* @reference https://eslint.org/docs/latest/rules/init-declarations
|
|
169
167
|
*/
|
|
@@ -205,16 +203,15 @@ export interface ITtscLintCoreRules {
|
|
|
205
203
|
"max-nested-callbacks"?: TtscLintRuleSetting;
|
|
206
204
|
|
|
207
205
|
/**
|
|
208
|
-
* Reject function declarations whose parameter list grows beyond
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* subset.
|
|
206
|
+
* Reject function declarations whose parameter list grows beyond three. Long
|
|
207
|
+
* parameter lists are hard to read at the call site because positional
|
|
208
|
+
* arguments lose their names; folding them into an options object recovers
|
|
209
|
+
* the names and lets callers pass a subset.
|
|
213
210
|
*
|
|
214
|
-
* Every function-like declaration is checked: function declarations,
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
211
|
+
* Every function-like declaration is checked: function declarations, function
|
|
212
|
+
* expressions, arrow functions, methods, accessors, and constructors. The
|
|
213
|
+
* threshold is fixed at three to match the ESLint default; rule options are
|
|
214
|
+
* deferred.
|
|
218
215
|
*
|
|
219
216
|
* @reference https://eslint.org/docs/latest/rules/max-params
|
|
220
217
|
*/
|
|
@@ -230,19 +227,19 @@ export interface ITtscLintCoreRules {
|
|
|
230
227
|
/**
|
|
231
228
|
* Reject calls to `alert`, `confirm`, and `prompt`.
|
|
232
229
|
*
|
|
233
|
-
* These browser dialogs block the main thread and are almost always
|
|
234
|
-
*
|
|
230
|
+
* These browser dialogs block the main thread and are almost always debugging
|
|
231
|
+
* leftovers or placeholders for a proper UI component.
|
|
235
232
|
*
|
|
236
233
|
* @reference https://eslint.org/docs/latest/rules/no-alert
|
|
237
234
|
*/
|
|
238
235
|
"no-alert"?: TtscLintRuleSetting;
|
|
239
236
|
|
|
240
237
|
/**
|
|
241
|
-
* Reject `Array(...)` and `new Array(...)` constructor calls in favor
|
|
242
|
-
*
|
|
238
|
+
* Reject `Array(...)` and `new Array(...)` constructor calls in favor of
|
|
239
|
+
* array literals.
|
|
243
240
|
*
|
|
244
|
-
* `Array(n)` and `[n]` behave differently for a single numeric
|
|
245
|
-
*
|
|
241
|
+
* `Array(n)` and `[n]` behave differently for a single numeric argument, and
|
|
242
|
+
* the array literal is uniformly clearer.
|
|
246
243
|
*
|
|
247
244
|
* @reference https://eslint.org/docs/latest/rules/no-array-constructor
|
|
248
245
|
*/
|
|
@@ -251,21 +248,21 @@ export interface ITtscLintCoreRules {
|
|
|
251
248
|
/**
|
|
252
249
|
* Reject `new Promise(async (resolve, reject) => { ... })`.
|
|
253
250
|
*
|
|
254
|
-
* Promises thrown asynchronously inside the executor are dropped
|
|
255
|
-
*
|
|
256
|
-
*
|
|
251
|
+
* Promises thrown asynchronously inside the executor are dropped silently
|
|
252
|
+
* because the constructor has already returned the outer Promise. Use a
|
|
253
|
+
* regular function and call `reject` explicitly.
|
|
257
254
|
*
|
|
258
255
|
* @reference https://eslint.org/docs/latest/rules/no-async-promise-executor
|
|
259
256
|
*/
|
|
260
257
|
"no-async-promise-executor"?: TtscLintRuleSetting;
|
|
261
258
|
|
|
262
259
|
/**
|
|
263
|
-
* Reject `await` expressions evaluated inside a loop body. The loop
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
260
|
+
* Reject `await` expressions evaluated inside a loop body. The loop runs
|
|
261
|
+
* strictly serially because each iteration blocks on the previous one's
|
|
262
|
+
* microtask hop; when the operations are independent the equivalent
|
|
263
|
+
* `Promise.all([…])` is dramatically faster. The rule intentionally exempts
|
|
264
|
+
* `for await … of` because the awaitable iterator is the loop's whole reason
|
|
265
|
+
* for existing.
|
|
269
266
|
*
|
|
270
267
|
* @reference https://eslint.org/docs/latest/rules/no-await-in-loop
|
|
271
268
|
*/
|
|
@@ -274,9 +271,8 @@ export interface ITtscLintCoreRules {
|
|
|
274
271
|
/**
|
|
275
272
|
* Reject bitwise operators (`&`, `|`, `^`, `~`, `<<`, `>>`, `>>>`).
|
|
276
273
|
*
|
|
277
|
-
* Bitwise operators are almost always typos for the logical operators
|
|
278
|
-
*
|
|
279
|
-
* bit-twiddling.
|
|
274
|
+
* Bitwise operators are almost always typos for the logical operators (`&&`,
|
|
275
|
+
* `||`); enable when the codebase has no legitimate bit-twiddling.
|
|
280
276
|
*
|
|
281
277
|
* @reference https://eslint.org/docs/latest/rules/no-bitwise
|
|
282
278
|
*/
|
|
@@ -286,18 +282,17 @@ export interface ITtscLintCoreRules {
|
|
|
286
282
|
* Reject `arguments.caller` and `arguments.callee`, both deprecated
|
|
287
283
|
* properties forbidden in strict mode.
|
|
288
284
|
*
|
|
289
|
-
* They defeat engine optimizations and break under ES modules, where
|
|
290
|
-
*
|
|
285
|
+
* They defeat engine optimizations and break under ES modules, where strict
|
|
286
|
+
* mode is implicit.
|
|
291
287
|
*
|
|
292
288
|
* @reference https://eslint.org/docs/latest/rules/no-caller
|
|
293
289
|
*/
|
|
294
290
|
"no-caller"?: TtscLintRuleSetting;
|
|
295
291
|
|
|
296
292
|
/**
|
|
297
|
-
* Reject lexical declarations (`let`, `const`, `class`, `function`)
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* sibling clauses.
|
|
293
|
+
* Reject lexical declarations (`let`, `const`, `class`, `function`) inside
|
|
294
|
+
* `case` or `default` clauses without their own block, since the declaration
|
|
295
|
+
* shares the whole `switch` scope and leaks into sibling clauses.
|
|
301
296
|
*
|
|
302
297
|
* Wrap the case body in `{ ... }` to introduce a fresh block.
|
|
303
298
|
*
|
|
@@ -308,8 +303,8 @@ export interface ITtscLintCoreRules {
|
|
|
308
303
|
/**
|
|
309
304
|
* Reject reassigning a class binding (`class C {}; C = ...`).
|
|
310
305
|
*
|
|
311
|
-
* The declaration name is effectively final; overwriting it silently
|
|
312
|
-
*
|
|
306
|
+
* The declaration name is effectively final; overwriting it silently leaves
|
|
307
|
+
* other call sites pointing at the original class.
|
|
313
308
|
*
|
|
314
309
|
* @reference https://eslint.org/docs/latest/rules/no-class-assign
|
|
315
310
|
*/
|
|
@@ -318,17 +313,16 @@ export interface ITtscLintCoreRules {
|
|
|
318
313
|
/**
|
|
319
314
|
* Reject comparisons against `-0` (`x === -0`, `x < -0`, etc.).
|
|
320
315
|
*
|
|
321
|
-
* `===` treats `+0` and `-0` as equal, so the comparison never
|
|
322
|
-
*
|
|
323
|
-
* actually matters.
|
|
316
|
+
* `===` treats `+0` and `-0` as equal, so the comparison never distinguishes
|
|
317
|
+
* them; use `Object.is(x, -0)` when the sign of zero actually matters.
|
|
324
318
|
*
|
|
325
319
|
* @reference https://eslint.org/docs/latest/rules/no-compare-neg-zero
|
|
326
320
|
*/
|
|
327
321
|
"no-compare-neg-zero"?: TtscLintRuleSetting;
|
|
328
322
|
|
|
329
323
|
/**
|
|
330
|
-
* Reject assignment expressions inside conditions, such as `if (x =
|
|
331
|
-
*
|
|
324
|
+
* Reject assignment expressions inside conditions, such as `if (x = y)` —
|
|
325
|
+
* almost always a typo for `==` / `===`.
|
|
332
326
|
*
|
|
333
327
|
* @reference https://eslint.org/docs/latest/rules/no-cond-assign
|
|
334
328
|
*/
|
|
@@ -345,12 +339,12 @@ export interface ITtscLintCoreRules {
|
|
|
345
339
|
"no-console"?: TtscLintRuleSetting;
|
|
346
340
|
|
|
347
341
|
/**
|
|
348
|
-
* Reject conditions whose value can be determined statically, such
|
|
349
|
-
*
|
|
350
|
-
*
|
|
342
|
+
* Reject conditions whose value can be determined statically, such as `while
|
|
343
|
+
* (true)` or `if (false)`, in `if`, `while`, `do/while`, `for`, and ternary
|
|
344
|
+
* expressions.
|
|
351
345
|
*
|
|
352
|
-
* The default `checkLoops` configuration still permits intentional
|
|
353
|
-
*
|
|
346
|
+
* The default `checkLoops` configuration still permits intentional infinite
|
|
347
|
+
* loops in a few forms; see upstream for the matrix.
|
|
354
348
|
*
|
|
355
349
|
* @reference https://eslint.org/docs/latest/rules/no-constant-condition
|
|
356
350
|
*/
|
|
@@ -367,21 +361,21 @@ export interface ITtscLintCoreRules {
|
|
|
367
361
|
"no-continue"?: TtscLintRuleSetting;
|
|
368
362
|
|
|
369
363
|
/**
|
|
370
|
-
* Reject `return X;` (with a value) inside a class constructor. The
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
364
|
+
* Reject `return X;` (with a value) inside a class constructor. The returned
|
|
365
|
+
* value is ignored when the constructor is invoked with `new` unless it
|
|
366
|
+
* happens to be an object; relying on that behavior is always a
|
|
367
|
+
* misunderstanding of the constructor protocol.
|
|
374
368
|
*
|
|
375
369
|
* @reference https://eslint.org/docs/latest/rules/no-constructor-return
|
|
376
370
|
*/
|
|
377
371
|
"no-constructor-return"?: TtscLintRuleSetting;
|
|
378
372
|
|
|
379
373
|
/**
|
|
380
|
-
* Reject ASCII control characters (`\x00`–`\x1F`) inside regular
|
|
381
|
-
*
|
|
374
|
+
* Reject ASCII control characters (`\x00`–`\x1F`) inside regular expression
|
|
375
|
+
* literals and `RegExp` strings.
|
|
382
376
|
*
|
|
383
|
-
* They render invisibly in source and almost always indicate an
|
|
384
|
-
*
|
|
377
|
+
* They render invisibly in source and almost always indicate an accidental
|
|
378
|
+
* paste or a missed `\t` / `\n` escape.
|
|
385
379
|
*
|
|
386
380
|
* @reference https://eslint.org/docs/latest/rules/no-control-regex
|
|
387
381
|
*/
|
|
@@ -390,8 +384,7 @@ export interface ITtscLintCoreRules {
|
|
|
390
384
|
/**
|
|
391
385
|
* Reject `debugger` statements.
|
|
392
386
|
*
|
|
393
|
-
* Typically configured as `"error"` so accidental debugger leftovers
|
|
394
|
-
* fail CI.
|
|
387
|
+
* Typically configured as `"error"` so accidental debugger leftovers fail CI.
|
|
395
388
|
*
|
|
396
389
|
* @reference https://eslint.org/docs/latest/rules/no-debugger
|
|
397
390
|
*/
|
|
@@ -400,17 +393,16 @@ export interface ITtscLintCoreRules {
|
|
|
400
393
|
/**
|
|
401
394
|
* Reject `delete` applied to plain variable bindings (`delete x`).
|
|
402
395
|
*
|
|
403
|
-
* The operation is forbidden in strict mode (and therefore in ES
|
|
404
|
-
*
|
|
405
|
-
* `var` declarations.
|
|
396
|
+
* The operation is forbidden in strict mode (and therefore in ES modules) and
|
|
397
|
+
* never has the intended effect on `let` / `const` / `var` declarations.
|
|
406
398
|
*
|
|
407
399
|
* @reference https://eslint.org/docs/latest/rules/no-delete-var
|
|
408
400
|
*/
|
|
409
401
|
"no-delete-var"?: TtscLintRuleSetting;
|
|
410
402
|
|
|
411
403
|
/**
|
|
412
|
-
* Reject `function f(a, a)` and similar parameter lists that declare
|
|
413
|
-
*
|
|
404
|
+
* Reject `function f(a, a)` and similar parameter lists that declare the same
|
|
405
|
+
* name twice.
|
|
414
406
|
*
|
|
415
407
|
* The function cannot bind both arguments and fails in strict mode.
|
|
416
408
|
*
|
|
@@ -419,62 +411,61 @@ export interface ITtscLintCoreRules {
|
|
|
419
411
|
"no-dupe-args"?: TtscLintRuleSetting;
|
|
420
412
|
|
|
421
413
|
/**
|
|
422
|
-
* Reject two declarations of the same member on a single class. The
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
414
|
+
* Reject two declarations of the same member on a single class. The later
|
|
415
|
+
* declaration silently overwrites the earlier one at runtime; the syntax
|
|
416
|
+
* permits it but the result is never what the author intended. A getter and a
|
|
417
|
+
* setter for the same property coexist; an instance member and a static
|
|
418
|
+
* member with the same name coexist.
|
|
427
419
|
*
|
|
428
420
|
* @reference https://eslint.org/docs/latest/rules/no-dupe-class-members
|
|
429
421
|
*/
|
|
430
422
|
"no-dupe-class-members"?: TtscLintRuleSetting;
|
|
431
423
|
|
|
432
424
|
/**
|
|
433
|
-
* Reject `if (a) {} else if (a) {}` — the second branch is
|
|
434
|
-
*
|
|
425
|
+
* Reject `if (a) {} else if (a) {}` — the second branch is unreachable
|
|
426
|
+
* because the first condition already handled it.
|
|
435
427
|
*
|
|
436
428
|
* @reference https://eslint.org/docs/latest/rules/no-dupe-else-if
|
|
437
429
|
*/
|
|
438
430
|
"no-dupe-else-if"?: TtscLintRuleSetting;
|
|
439
431
|
|
|
440
432
|
/**
|
|
441
|
-
* Reject `{ a: 1, a: 2 }` — duplicate property keys in an object
|
|
442
|
-
*
|
|
433
|
+
* Reject `{ a: 1, a: 2 }` — duplicate property keys in an object literal
|
|
434
|
+
* silently overwrite earlier values.
|
|
443
435
|
*
|
|
444
436
|
* @reference https://eslint.org/docs/latest/rules/no-dupe-keys
|
|
445
437
|
*/
|
|
446
438
|
"no-dupe-keys"?: TtscLintRuleSetting;
|
|
447
439
|
|
|
448
440
|
/**
|
|
449
|
-
* Reject the same `case` label appearing twice in a `switch` —
|
|
450
|
-
*
|
|
441
|
+
* Reject the same `case` label appearing twice in a `switch` — later
|
|
442
|
+
* duplicates are unreachable.
|
|
451
443
|
*
|
|
452
444
|
* @reference https://eslint.org/docs/latest/rules/no-duplicate-case
|
|
453
445
|
*/
|
|
454
446
|
"no-duplicate-case"?: TtscLintRuleSetting;
|
|
455
447
|
|
|
456
448
|
/**
|
|
457
|
-
* Reject two import declarations that resolve to the same module
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* and obscures the dependency graph.
|
|
449
|
+
* Reject two import declarations that resolve to the same module specifier.
|
|
450
|
+
* The runtime sees one module load either way; the duplicated declaration is
|
|
451
|
+
* purely noise at the head of the file and obscures the dependency graph.
|
|
461
452
|
*
|
|
462
453
|
* @reference https://eslint.org/docs/latest/rules/no-duplicate-imports
|
|
463
454
|
*/
|
|
464
455
|
"no-duplicate-imports"?: TtscLintRuleSetting;
|
|
465
456
|
|
|
466
457
|
/**
|
|
467
|
-
* Reject an `else` block whose preceding `if` branch already
|
|
468
|
-
*
|
|
469
|
-
*
|
|
458
|
+
* Reject an `else` block whose preceding `if` branch already terminates
|
|
459
|
+
* control flow with `return`, `throw`, `break`, or `continue` — flatten the
|
|
460
|
+
* body into the surrounding scope.
|
|
470
461
|
*
|
|
471
462
|
* @reference https://eslint.org/docs/latest/rules/no-else-return
|
|
472
463
|
*/
|
|
473
464
|
"no-else-return"?: TtscLintRuleSetting;
|
|
474
465
|
|
|
475
466
|
/**
|
|
476
|
-
* Reject empty blocks (`if (x) {}`, `while (x) {}`, `try {} catch
|
|
477
|
-
*
|
|
467
|
+
* Reject empty blocks (`if (x) {}`, `while (x) {}`, `try {} catch (e) {}`
|
|
468
|
+
* etc.) that almost always indicate forgotten code.
|
|
478
469
|
*
|
|
479
470
|
* @reference https://eslint.org/docs/latest/rules/no-empty
|
|
480
471
|
*/
|
|
@@ -483,44 +474,41 @@ export interface ITtscLintCoreRules {
|
|
|
483
474
|
/**
|
|
484
475
|
* Reject empty regex character classes (`[]`).
|
|
485
476
|
*
|
|
486
|
-
* An empty class never matches anything, so the entire pattern can
|
|
487
|
-
*
|
|
488
|
-
* allowed.
|
|
477
|
+
* An empty class never matches anything, so the entire pattern can never
|
|
478
|
+
* succeed; the negated form `[^]` (matches any character) is allowed.
|
|
489
479
|
*
|
|
490
480
|
* @reference https://eslint.org/docs/latest/rules/no-empty-character-class
|
|
491
481
|
*/
|
|
492
482
|
"no-empty-character-class"?: TtscLintRuleSetting;
|
|
493
483
|
|
|
494
484
|
/**
|
|
495
|
-
* Reject empty function and method bodies (`function f() {}`, `()
|
|
496
|
-
* => {}`).
|
|
485
|
+
* Reject empty function and method bodies (`function f() {}`, `() => {}`).
|
|
497
486
|
*
|
|
498
|
-
* Use `() => undefined` or a leading TODO comment when the empty
|
|
499
|
-
*
|
|
487
|
+
* Use `() => undefined` or a leading TODO comment when the empty body is
|
|
488
|
+
* intentional.
|
|
500
489
|
*
|
|
501
490
|
* @reference https://eslint.org/docs/latest/rules/no-empty-function
|
|
502
491
|
*/
|
|
503
492
|
"no-empty-function"?: TtscLintRuleSetting;
|
|
504
493
|
|
|
505
494
|
/**
|
|
506
|
-
* Reject empty named import or export clauses — `import {} from "x"`,
|
|
507
|
-
*
|
|
495
|
+
* Reject empty named import or export clauses — `import {} from "x"`, `import
|
|
496
|
+
* name, {} from "x"`, and `export {}` — which bind nothing.
|
|
508
497
|
*
|
|
509
|
-
* The empty-only import shape leaves just the side-effect load and is
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
* module-syntax statement is already present.
|
|
498
|
+
* The empty-only import shape leaves just the side-effect load and is better
|
|
499
|
+
* written as `import "x"`; the default-plus-empty form should drop the empty
|
|
500
|
+
* clause; and a bare `export {}` either restates module-ness redundantly or
|
|
501
|
+
* marks an otherwise non-module file in a way that has cleaner alternatives.
|
|
502
|
+
* The stricter sibling rule `typescript/no-useless-empty-export` fires only
|
|
503
|
+
* when another module-syntax statement is already present.
|
|
516
504
|
*
|
|
517
505
|
* @reference https://eslint.org/docs/latest/rules/no-empty-named-blocks
|
|
518
506
|
*/
|
|
519
507
|
"no-empty-named-blocks"?: TtscLintRuleSetting;
|
|
520
508
|
|
|
521
509
|
/**
|
|
522
|
-
* Reject empty destructuring patterns (`const {} = obj`, `function
|
|
523
|
-
*
|
|
510
|
+
* Reject empty destructuring patterns (`const {} = obj`, `function f([])
|
|
511
|
+
* {}`), which bind nothing and are usually mid-edit typos.
|
|
524
512
|
*
|
|
525
513
|
* @reference https://eslint.org/docs/latest/rules/no-empty-pattern
|
|
526
514
|
*/
|
|
@@ -538,80 +526,77 @@ export interface ITtscLintCoreRules {
|
|
|
538
526
|
*
|
|
539
527
|
* Use `x === null` or the explicit `x === null || x === undefined`.
|
|
540
528
|
*
|
|
541
|
-
* Pairs with `eqeqeq` but kept separate so the loose null shortcut can
|
|
542
|
-
*
|
|
529
|
+
* Pairs with `eqeqeq` but kept separate so the loose null shortcut can be
|
|
530
|
+
* allowed under `"smart"`-style `eqeqeq` exceptions.
|
|
543
531
|
*
|
|
544
532
|
* @reference https://eslint.org/docs/latest/rules/no-eq-null
|
|
545
533
|
*/
|
|
546
534
|
"no-eq-null"?: TtscLintRuleSetting;
|
|
547
535
|
|
|
548
536
|
/**
|
|
549
|
-
* Reject `eval(...)` and indirect `eval` calls — almost always a
|
|
550
|
-
*
|
|
537
|
+
* Reject `eval(...)` and indirect `eval` calls — almost always a security or
|
|
538
|
+
* correctness bug.
|
|
551
539
|
*
|
|
552
540
|
* @reference https://eslint.org/docs/latest/rules/no-eval
|
|
553
541
|
*/
|
|
554
542
|
"no-eval"?: TtscLintRuleSetting;
|
|
555
543
|
|
|
556
544
|
/**
|
|
557
|
-
* Reject reassigning the parameter of a `catch` clause (`catch (e) {
|
|
558
|
-
*
|
|
545
|
+
* Reject reassigning the parameter of a `catch` clause (`catch (e) { e = ...
|
|
546
|
+
* }`), which loses the original error reference.
|
|
559
547
|
*
|
|
560
548
|
* @reference https://eslint.org/docs/latest/rules/no-ex-assign
|
|
561
549
|
*/
|
|
562
550
|
"no-ex-assign"?: TtscLintRuleSetting;
|
|
563
551
|
|
|
564
552
|
/**
|
|
565
|
-
* Reject assignments to a built-in prototype such as
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
* left alone.
|
|
553
|
+
* Reject assignments to a built-in prototype such as `Array.prototype.foo =
|
|
554
|
+
* bar`. Only `<Builtin>.prototype.<key> = …` is flagged; assigning to
|
|
555
|
+
* `Object.foo = …` (a static property) is left alone.
|
|
569
556
|
*
|
|
570
557
|
* @reference https://eslint.org/docs/latest/rules/no-extend-native
|
|
571
558
|
*/
|
|
572
559
|
"no-extend-native"?: TtscLintRuleSetting;
|
|
573
560
|
|
|
574
561
|
/**
|
|
575
|
-
* Reject unnecessary `Function.prototype.bind()` calls — for
|
|
576
|
-
*
|
|
577
|
-
* (which ignores `this`).
|
|
562
|
+
* Reject unnecessary `Function.prototype.bind()` calls — for example, binding
|
|
563
|
+
* without arguments or binding an arrow function (which ignores `this`).
|
|
578
564
|
*
|
|
579
565
|
* @reference https://eslint.org/docs/latest/rules/no-extra-bind
|
|
580
566
|
*/
|
|
581
567
|
"no-extra-bind"?: TtscLintRuleSetting;
|
|
582
568
|
|
|
583
569
|
/**
|
|
584
|
-
* Reject redundant boolean casts such as `!!Boolean(x)`, `if
|
|
585
|
-
*
|
|
570
|
+
* Reject redundant boolean casts such as `!!Boolean(x)`, `if (Boolean(x))`,
|
|
571
|
+
* or `Boolean(!!x)`.
|
|
586
572
|
*
|
|
587
573
|
* @reference https://eslint.org/docs/latest/rules/no-extra-boolean-cast
|
|
588
574
|
*/
|
|
589
575
|
"no-extra-boolean-cast"?: TtscLintRuleSetting;
|
|
590
576
|
|
|
591
577
|
/**
|
|
592
|
-
* Reject `switch` case fall-through unless preceded by an explicit
|
|
593
|
-
*
|
|
578
|
+
* Reject `switch` case fall-through unless preceded by an explicit `// falls
|
|
579
|
+
* through` comment.
|
|
594
580
|
*
|
|
595
581
|
* @reference https://eslint.org/docs/latest/rules/no-fallthrough
|
|
596
582
|
*/
|
|
597
583
|
"no-fallthrough"?: TtscLintRuleSetting;
|
|
598
584
|
|
|
599
585
|
/**
|
|
600
|
-
* Reject reassignment of function declarations (`function f() {}; f
|
|
601
|
-
* = 0;`).
|
|
586
|
+
* Reject reassignment of function declarations (`function f() {}; f = 0;`).
|
|
602
587
|
*
|
|
603
|
-
* The hoisted binding looks final to most readers; overwriting it
|
|
604
|
-
*
|
|
588
|
+
* The hoisted binding looks final to most readers; overwriting it makes the
|
|
589
|
+
* original implementation unreachable from other references.
|
|
605
590
|
*
|
|
606
591
|
* @reference https://eslint.org/docs/latest/rules/no-func-assign
|
|
607
592
|
*/
|
|
608
593
|
"no-func-assign"?: TtscLintRuleSetting;
|
|
609
594
|
|
|
610
595
|
/**
|
|
611
|
-
* Reject common implicit-coercion idioms (`!!x`, `+x`, `"" + x`) in
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
596
|
+
* Reject common implicit-coercion idioms (`!!x`, `+x`, `"" + x`) in favor of
|
|
597
|
+
* the explicit `Boolean(x)` / `Number(x)` / `String(x)` conversions. The
|
|
598
|
+
* explicit forms are more readable and avoid surprise around primitive edge
|
|
599
|
+
* cases.
|
|
615
600
|
*
|
|
616
601
|
* @reference https://eslint.org/docs/latest/rules/no-implicit-coercion
|
|
617
602
|
*/
|
|
@@ -619,43 +604,44 @@ export interface ITtscLintCoreRules {
|
|
|
619
604
|
|
|
620
605
|
/**
|
|
621
606
|
* Reject writes to a binding introduced by an `import` declaration —
|
|
622
|
-
* assignment (`x = …`), compound assignment, or increment/decrement
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
607
|
+
* assignment (`x = …`), compound assignment, or increment/decrement of an
|
|
608
|
+
* imported name, plus property mutations of a namespace import (`ns.foo =
|
|
609
|
+
* …`). Imported bindings are read-only at runtime; mutating them either
|
|
610
|
+
* throws under strict mode or silently desynchronises the module's view of
|
|
611
|
+
* its own exports.
|
|
627
612
|
*
|
|
628
613
|
* @reference https://eslint.org/docs/latest/rules/no-import-assign
|
|
629
614
|
*/
|
|
630
615
|
"no-import-assign"?: TtscLintRuleSetting;
|
|
631
616
|
|
|
632
617
|
/**
|
|
633
|
-
* Reject `function` and `var` declarations nested in non-function
|
|
634
|
-
*
|
|
618
|
+
* Reject `function` and `var` declarations nested in non-function blocks
|
|
619
|
+
* (loops, `if`, etc.) — they hoist in surprising ways.
|
|
635
620
|
*
|
|
636
621
|
* @reference https://eslint.org/docs/latest/rules/no-inner-declarations
|
|
637
622
|
*/
|
|
638
623
|
"no-inner-declarations"?: TtscLintRuleSetting;
|
|
639
624
|
|
|
640
625
|
/**
|
|
641
|
-
* Reject `this` references outside any function-like, class method, or
|
|
626
|
+
* Reject `this` references outside any function-like, class method, or
|
|
627
|
+
* class-static-block context.
|
|
642
628
|
*
|
|
643
629
|
* @reference https://eslint.org/docs/latest/rules/no-invalid-this
|
|
644
630
|
*/
|
|
645
631
|
"no-invalid-this"?: TtscLintRuleSetting;
|
|
646
632
|
|
|
647
633
|
/**
|
|
648
|
-
* Reject irregular whitespace characters (zero-width space,
|
|
649
|
-
*
|
|
650
|
-
*
|
|
634
|
+
* Reject irregular whitespace characters (zero-width space, non-breaking
|
|
635
|
+
* space, etc.) in source — typically copy-paste artifacts from rich-text
|
|
636
|
+
* editors.
|
|
651
637
|
*
|
|
652
638
|
* @reference https://eslint.org/docs/latest/rules/no-irregular-whitespace
|
|
653
639
|
*/
|
|
654
640
|
"no-irregular-whitespace"?: TtscLintRuleSetting;
|
|
655
641
|
|
|
656
642
|
/**
|
|
657
|
-
* Reject the legacy `__iterator__` property — a SpiderMonkey-only
|
|
658
|
-
*
|
|
643
|
+
* Reject the legacy `__iterator__` property — a SpiderMonkey-only extension
|
|
644
|
+
* predating ES2015 iterators.
|
|
659
645
|
*
|
|
660
646
|
* Use `Symbol.iterator` or a generator.
|
|
661
647
|
*
|
|
@@ -666,135 +652,133 @@ export interface ITtscLintCoreRules {
|
|
|
666
652
|
/**
|
|
667
653
|
* Reject labeled statements (`outer: for (...) { break outer; }`).
|
|
668
654
|
*
|
|
669
|
-
* Labels obscure control flow; prefer extracting the inner loop into
|
|
670
|
-
*
|
|
655
|
+
* Labels obscure control flow; prefer extracting the inner loop into a
|
|
656
|
+
* function and using `return`, or refactoring with a flag variable.
|
|
671
657
|
*
|
|
672
658
|
* @reference https://eslint.org/docs/latest/rules/no-labels
|
|
673
659
|
*/
|
|
674
660
|
"no-labels"?: TtscLintRuleSetting;
|
|
675
661
|
|
|
676
662
|
/**
|
|
677
|
-
* Reject standalone `{ ... }` blocks that introduce no lexical
|
|
678
|
-
*
|
|
663
|
+
* Reject standalone `{ ... }` blocks that introduce no lexical scope distinct
|
|
664
|
+
* from the surrounding block.
|
|
679
665
|
*
|
|
680
|
-
* Blocks that actually declare `let`, `const`, `class`, or `function`
|
|
681
|
-
*
|
|
682
|
-
* inner scope.
|
|
666
|
+
* Blocks that actually declare `let`, `const`, `class`, or `function` (in
|
|
667
|
+
* strict mode) are exempt, since those declarations need the inner scope.
|
|
683
668
|
*
|
|
684
669
|
* @reference https://eslint.org/docs/latest/rules/no-lone-blocks
|
|
685
670
|
*/
|
|
686
671
|
"no-lone-blocks"?: TtscLintRuleSetting;
|
|
687
672
|
|
|
688
673
|
/**
|
|
689
|
-
* Reject `if (cond) { if (...) { ... } }` where the inner `if` is
|
|
690
|
-
*
|
|
674
|
+
* Reject `if (cond) { if (...) { ... } }` where the inner `if` is the only
|
|
675
|
+
* statement in an `else` — prefer `else if`.
|
|
691
676
|
*
|
|
692
677
|
* @reference https://eslint.org/docs/latest/rules/no-lonely-if
|
|
693
678
|
*/
|
|
694
679
|
"no-lonely-if"?: TtscLintRuleSetting;
|
|
695
680
|
|
|
696
681
|
/**
|
|
697
|
-
* Reject function declarations defined inside the body of a loop.
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* final value instead of its own.
|
|
682
|
+
* Reject function declarations defined inside the body of a loop. Each
|
|
683
|
+
* iteration of the loop allocates a fresh function whose closure captures the
|
|
684
|
+
* surrounding `let`/`var` binding — a class of bugs where every captured
|
|
685
|
+
* function reads the iteration's final value instead of its own.
|
|
702
686
|
*
|
|
703
687
|
* @reference https://eslint.org/docs/latest/rules/no-loop-func
|
|
704
688
|
*/
|
|
705
689
|
"no-loop-func"?: TtscLintRuleSetting;
|
|
706
690
|
|
|
707
691
|
/**
|
|
708
|
-
* Reject numeric literals whose source text cannot round-trip
|
|
709
|
-
*
|
|
692
|
+
* Reject numeric literals whose source text cannot round-trip through
|
|
693
|
+
* `Number` without losing digits, including overflow.
|
|
710
694
|
*
|
|
711
695
|
* @reference https://eslint.org/docs/latest/rules/no-loss-of-precision
|
|
712
696
|
*/
|
|
713
697
|
"no-loss-of-precision"?: TtscLintRuleSetting;
|
|
714
698
|
|
|
715
699
|
/**
|
|
716
|
-
* Reject inline numeric literals outside `const` initializer position. `0`,
|
|
700
|
+
* Reject inline numeric literals outside `const` initializer position. `0`,
|
|
701
|
+
* `1`, `-1`, array indices, and enum values are exempt.
|
|
717
702
|
*
|
|
718
703
|
* @reference https://eslint.org/docs/latest/rules/no-magic-numbers
|
|
719
704
|
*/
|
|
720
705
|
"no-magic-numbers"?: TtscLintRuleSetting;
|
|
721
706
|
|
|
722
707
|
/**
|
|
723
|
-
* Reject regex character classes that contain combined Unicode
|
|
724
|
-
*
|
|
725
|
-
*
|
|
708
|
+
* Reject regex character classes that contain combined Unicode sequences
|
|
709
|
+
* (e.g. surrogate pairs) which most readers will not realize represent
|
|
710
|
+
* multiple code units.
|
|
726
711
|
*
|
|
727
712
|
* @reference https://eslint.org/docs/latest/rules/no-misleading-character-class
|
|
728
713
|
*/
|
|
729
714
|
"no-misleading-character-class"?: TtscLintRuleSetting;
|
|
730
715
|
|
|
731
716
|
/**
|
|
732
|
-
* Reject mixing operators of different precedence families in the
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
* `&&` binds tighter than `||`.
|
|
717
|
+
* Reject mixing operators of different precedence families in the same
|
|
718
|
+
* expression without explicit parentheses around the inner sub-expression.
|
|
719
|
+
* The famous case is `a && b || c`: readers expect left-to-right grouping but
|
|
720
|
+
* the parser sees `(a && b) || c` because `&&` binds tighter than `||`.
|
|
737
721
|
*
|
|
738
|
-
* The conservative baseline only flags the highest-confusion mixes —
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
722
|
+
* The conservative baseline only flags the highest-confusion mixes — logical
|
|
723
|
+
* mixed with a different logical (`&&` next to `||` / `??`), and bitwise
|
|
724
|
+
* (`&`, `|`, `^`) next to a comparison or logical. Wrapping the inner
|
|
725
|
+
* sub-expression in parens suppresses the report.
|
|
742
726
|
*
|
|
743
727
|
* @reference https://eslint.org/docs/latest/rules/no-mixed-operators
|
|
744
728
|
*/
|
|
745
729
|
"no-mixed-operators"?: TtscLintRuleSetting;
|
|
746
730
|
|
|
747
731
|
/**
|
|
748
|
-
* Reject chained assignment such as `a = b = 0`, which obscures
|
|
749
|
-
*
|
|
732
|
+
* Reject chained assignment such as `a = b = 0`, which obscures intent and
|
|
733
|
+
* surprises readers who expect comparison.
|
|
750
734
|
*
|
|
751
735
|
* @reference https://eslint.org/docs/latest/rules/no-multi-assign
|
|
752
736
|
*/
|
|
753
737
|
"no-multi-assign"?: TtscLintRuleSetting;
|
|
754
738
|
|
|
755
739
|
/**
|
|
756
|
-
* Reject backslash-newline multiline string literals; use template
|
|
757
|
-
*
|
|
740
|
+
* Reject backslash-newline multiline string literals; use template literals
|
|
741
|
+
* instead.
|
|
758
742
|
*
|
|
759
743
|
* @reference https://eslint.org/docs/latest/rules/no-multi-str
|
|
760
744
|
*/
|
|
761
745
|
"no-multi-str"?: TtscLintRuleSetting;
|
|
762
746
|
|
|
763
747
|
/**
|
|
764
|
-
* Reject `if (!cond) { ... } else { ... }` — flip the branches so
|
|
765
|
-
*
|
|
748
|
+
* Reject `if (!cond) { ... } else { ... }` — flip the branches so the
|
|
749
|
+
* positive condition reads first.
|
|
766
750
|
*
|
|
767
751
|
* @reference https://eslint.org/docs/latest/rules/no-negated-condition
|
|
768
752
|
*/
|
|
769
753
|
"no-negated-condition"?: TtscLintRuleSetting;
|
|
770
754
|
|
|
771
755
|
/**
|
|
772
|
-
* Reject ternary expressions nested in other ternaries
|
|
773
|
-
*
|
|
756
|
+
* Reject ternary expressions nested in other ternaries (`a ? b : c ? d : e`),
|
|
757
|
+
* which are hard to read at a glance.
|
|
774
758
|
*
|
|
775
759
|
* @reference https://eslint.org/docs/latest/rules/no-nested-ternary
|
|
776
760
|
*/
|
|
777
761
|
"no-nested-ternary"?: TtscLintRuleSetting;
|
|
778
762
|
|
|
779
763
|
/**
|
|
780
|
-
* Reject `new` expressions whose return value is not assigned or
|
|
781
|
-
*
|
|
764
|
+
* Reject `new` expressions whose return value is not assigned or used — the
|
|
765
|
+
* object is created only for its constructor side effects.
|
|
782
766
|
*
|
|
783
767
|
* @reference https://eslint.org/docs/latest/rules/no-new
|
|
784
768
|
*/
|
|
785
769
|
"no-new"?: TtscLintRuleSetting;
|
|
786
770
|
|
|
787
771
|
/**
|
|
788
|
-
* Reject `new Function(...)` and `Function(...)` calls, which
|
|
789
|
-
*
|
|
772
|
+
* Reject `new Function(...)` and `Function(...)` calls, which effectively
|
|
773
|
+
* evaluate a string and have the same risks as `eval`.
|
|
790
774
|
*
|
|
791
775
|
* @reference https://eslint.org/docs/latest/rules/no-new-func
|
|
792
776
|
*/
|
|
793
777
|
"no-new-func"?: TtscLintRuleSetting;
|
|
794
778
|
|
|
795
779
|
/**
|
|
796
|
-
* Reject primitive wrapper constructors `new String(...)`, `new
|
|
797
|
-
*
|
|
780
|
+
* Reject primitive wrapper constructors `new String(...)`, `new Number(...)`,
|
|
781
|
+
* `new Boolean(...)`.
|
|
798
782
|
*
|
|
799
783
|
* The resulting objects compare unequal to their primitive counterparts.
|
|
800
784
|
*
|
|
@@ -803,27 +787,26 @@ export interface ITtscLintCoreRules {
|
|
|
803
787
|
"no-new-wrappers"?: TtscLintRuleSetting;
|
|
804
788
|
|
|
805
789
|
/**
|
|
806
|
-
* Reject `new Symbol(...)`. `Symbol` is a function but not a
|
|
807
|
-
*
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
* Symbol check.
|
|
790
|
+
* Reject `new Symbol(...)`. `Symbol` is a function but not a constructor;
|
|
791
|
+
* calling it with `new` throws a TypeError at runtime. The upstream rule was
|
|
792
|
+
* renamed `no-new-native-nonconstructor`; the legacy name remains the more
|
|
793
|
+
* readable pointer for this specific Symbol check.
|
|
811
794
|
*
|
|
812
795
|
* @reference https://eslint.org/docs/latest/rules/no-new-symbol
|
|
813
796
|
*/
|
|
814
797
|
"no-new-symbol"?: TtscLintRuleSetting;
|
|
815
798
|
|
|
816
799
|
/**
|
|
817
|
-
* Reject calling global non-callable objects as functions, such as
|
|
818
|
-
*
|
|
800
|
+
* Reject calling global non-callable objects as functions, such as `Math()`
|
|
801
|
+
* or `JSON()`.
|
|
819
802
|
*
|
|
820
803
|
* @reference https://eslint.org/docs/latest/rules/no-obj-calls
|
|
821
804
|
*/
|
|
822
805
|
"no-obj-calls"?: TtscLintRuleSetting;
|
|
823
806
|
|
|
824
807
|
/**
|
|
825
|
-
* Reject `new Object()` and `Object()` constructor calls; use an
|
|
826
|
-
*
|
|
808
|
+
* Reject `new Object()` and `Object()` constructor calls; use an object
|
|
809
|
+
* literal `{}` instead.
|
|
827
810
|
*
|
|
828
811
|
* @reference https://eslint.org/docs/latest/rules/no-object-constructor
|
|
829
812
|
*/
|
|
@@ -839,21 +822,19 @@ export interface ITtscLintCoreRules {
|
|
|
839
822
|
"no-octal"?: TtscLintRuleSetting;
|
|
840
823
|
|
|
841
824
|
/**
|
|
842
|
-
* Reject octal escape sequences in string literals (`"\251"`,
|
|
843
|
-
* `"\07"`).
|
|
825
|
+
* Reject octal escape sequences in string literals (`"\251"`, `"\07"`).
|
|
844
826
|
*
|
|
845
|
-
* Deprecated and forbidden in strict mode; use Unicode (`©`) or hex
|
|
846
|
-
*
|
|
827
|
+
* Deprecated and forbidden in strict mode; use Unicode (`©`) or hex (`\xA9`)
|
|
828
|
+
* escapes.
|
|
847
829
|
*
|
|
848
830
|
* @reference https://eslint.org/docs/latest/rules/no-octal-escape
|
|
849
831
|
*/
|
|
850
832
|
"no-octal-escape"?: TtscLintRuleSetting;
|
|
851
833
|
|
|
852
834
|
/**
|
|
853
|
-
* Reject reassigning a function parameter inside the body of the
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
* (`param.foo = …`) are not flagged.
|
|
835
|
+
* Reject reassigning a function parameter inside the body of the function it
|
|
836
|
+
* belongs to. The parameter name stops pointing at the caller's argument
|
|
837
|
+
* after the write. Property mutations (`param.foo = …`) are not flagged.
|
|
857
838
|
*
|
|
858
839
|
* @reference https://eslint.org/docs/latest/rules/no-param-reassign
|
|
859
840
|
*/
|
|
@@ -862,16 +843,16 @@ export interface ITtscLintCoreRules {
|
|
|
862
843
|
/**
|
|
863
844
|
* Reject `++` and `--` operators.
|
|
864
845
|
*
|
|
865
|
-
* Prefer `+= 1` / `-= 1` to keep statements expression-only and
|
|
866
|
-
*
|
|
846
|
+
* Prefer `+= 1` / `-= 1` to keep statements expression-only and avoid ASI
|
|
847
|
+
* surprises.
|
|
867
848
|
*
|
|
868
849
|
* @reference https://eslint.org/docs/latest/rules/no-plusplus
|
|
869
850
|
*/
|
|
870
851
|
"no-plusplus"?: TtscLintRuleSetting;
|
|
871
852
|
|
|
872
853
|
/**
|
|
873
|
-
* Reject `return` inside the Promise executor function — the value
|
|
874
|
-
*
|
|
854
|
+
* Reject `return` inside the Promise executor function — the value is
|
|
855
|
+
* ignored.
|
|
875
856
|
*
|
|
876
857
|
* @reference https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
877
858
|
*/
|
|
@@ -886,38 +867,37 @@ export interface ITtscLintCoreRules {
|
|
|
886
867
|
"no-proto"?: TtscLintRuleSetting;
|
|
887
868
|
|
|
888
869
|
/**
|
|
889
|
-
* Reject `obj.hasOwnProperty(key)` and other direct
|
|
890
|
-
*
|
|
891
|
-
* may be shadowed.
|
|
870
|
+
* Reject `obj.hasOwnProperty(key)` and other direct `Object.prototype`
|
|
871
|
+
* builtins on user objects, since the property may be shadowed.
|
|
892
872
|
*
|
|
893
|
-
* Use `Object.prototype.hasOwnProperty.call(obj, key)` or
|
|
894
|
-
* `Object.hasOwn`.
|
|
873
|
+
* Use `Object.prototype.hasOwnProperty.call(obj, key)` or `Object.hasOwn`.
|
|
895
874
|
*
|
|
896
875
|
* @reference https://eslint.org/docs/latest/rules/no-prototype-builtins
|
|
897
876
|
*/
|
|
898
877
|
"no-prototype-builtins"?: TtscLintRuleSetting;
|
|
899
878
|
|
|
900
879
|
/**
|
|
901
|
-
* Reject declaring the same binding more than once in the same scope
|
|
902
|
-
*
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
880
|
+
* Reject declaring the same binding more than once in the same scope (`var x
|
|
881
|
+
* = 1; var x = 2;`, two `function foo()` declarations side by side, or a
|
|
882
|
+
* parameter rebound by a later `var` in the body). The second declaration
|
|
883
|
+
* silently overwrites the first; shadowing the binding in a nested scope is
|
|
884
|
+
* left alone.
|
|
906
885
|
*
|
|
907
886
|
* @reference https://eslint.org/docs/latest/rules/no-redeclare
|
|
908
887
|
*/
|
|
909
888
|
"no-redeclare"?: TtscLintRuleSetting;
|
|
910
889
|
|
|
911
890
|
/**
|
|
912
|
-
* Reject more than one consecutive literal space in a regex; use
|
|
913
|
-
*
|
|
891
|
+
* Reject more than one consecutive literal space in a regex; use `{N}`
|
|
892
|
+
* quantifiers for clarity.
|
|
914
893
|
*
|
|
915
894
|
* @reference https://eslint.org/docs/latest/rules/no-regex-spaces
|
|
916
895
|
*/
|
|
917
896
|
"no-regex-spaces"?: TtscLintRuleSetting;
|
|
918
897
|
|
|
919
898
|
/**
|
|
920
|
-
* Reject `import` declarations targeting any module specifier in the project
|
|
899
|
+
* Reject `import` declarations targeting any module specifier in the project
|
|
900
|
+
* denylist.
|
|
921
901
|
*
|
|
922
902
|
* @reference https://eslint.org/docs/latest/rules/no-restricted-imports
|
|
923
903
|
*/
|
|
@@ -931,92 +911,90 @@ export interface ITtscLintCoreRules {
|
|
|
931
911
|
"no-restricted-syntax"?: TtscLintRuleSetting;
|
|
932
912
|
|
|
933
913
|
/**
|
|
934
|
-
* Reject assignment expressions used as the operand of `return`
|
|
935
|
-
*
|
|
914
|
+
* Reject assignment expressions used as the operand of `return` (`return x =
|
|
915
|
+
* 1`) — almost always a typo for `===`.
|
|
936
916
|
*
|
|
937
917
|
* @reference https://eslint.org/docs/latest/rules/no-return-assign
|
|
938
918
|
*/
|
|
939
919
|
"no-return-assign"?: TtscLintRuleSetting;
|
|
940
920
|
|
|
941
921
|
/**
|
|
942
|
-
* Reject `javascript:` URLs in string literals — they execute their
|
|
943
|
-
*
|
|
944
|
-
*
|
|
922
|
+
* Reject `javascript:` URLs in string literals — they execute their body as
|
|
923
|
+
* code on browser navigation, and security scanners treat them as an `eval`
|
|
924
|
+
* equivalent.
|
|
945
925
|
*
|
|
946
926
|
* @reference https://eslint.org/docs/latest/rules/no-script-url
|
|
947
927
|
*/
|
|
948
928
|
"no-script-url"?: TtscLintRuleSetting;
|
|
949
929
|
|
|
950
930
|
/**
|
|
951
|
-
* Reject `x = x` and destructuring forms that copy a value to
|
|
952
|
-
*
|
|
931
|
+
* Reject `x = x` and destructuring forms that copy a value to itself — almost
|
|
932
|
+
* always a typo.
|
|
953
933
|
*
|
|
954
934
|
* @reference https://eslint.org/docs/latest/rules/no-self-assign
|
|
955
935
|
*/
|
|
956
936
|
"no-self-assign"?: TtscLintRuleSetting;
|
|
957
937
|
|
|
958
938
|
/**
|
|
959
|
-
* Reject comparing a value to itself (`x === x`). Use
|
|
960
|
-
*
|
|
939
|
+
* Reject comparing a value to itself (`x === x`). Use `Number.isNaN(x)` to
|
|
940
|
+
* test for `NaN`.
|
|
961
941
|
*
|
|
962
942
|
* @reference https://eslint.org/docs/latest/rules/no-self-compare
|
|
963
943
|
*/
|
|
964
944
|
"no-self-compare"?: TtscLintRuleSetting;
|
|
965
945
|
|
|
966
946
|
/**
|
|
967
|
-
* Reject comma expressions (`a, b`) outside the heads of `for`
|
|
968
|
-
* statements.
|
|
947
|
+
* Reject comma expressions (`a, b`) outside the heads of `for` statements.
|
|
969
948
|
*
|
|
970
949
|
* @reference https://eslint.org/docs/latest/rules/no-sequences
|
|
971
950
|
*/
|
|
972
951
|
"no-sequences"?: TtscLintRuleSetting;
|
|
973
952
|
|
|
974
953
|
/**
|
|
975
|
-
* Reject explicit `return` from a setter — setters' return values
|
|
976
|
-
*
|
|
954
|
+
* Reject explicit `return` from a setter — setters' return values are
|
|
955
|
+
* ignored.
|
|
977
956
|
*
|
|
978
957
|
* @reference https://eslint.org/docs/latest/rules/no-setter-return
|
|
979
958
|
*/
|
|
980
959
|
"no-setter-return"?: TtscLintRuleSetting;
|
|
981
960
|
|
|
982
961
|
/**
|
|
983
|
-
* Reject a variable declaration that shadows a same-name binding in
|
|
984
|
-
*
|
|
962
|
+
* Reject a variable declaration that shadows a same-name binding in an
|
|
963
|
+
* enclosing scope.
|
|
985
964
|
*
|
|
986
965
|
* @reference https://eslint.org/docs/latest/rules/no-shadow
|
|
987
966
|
*/
|
|
988
967
|
"no-shadow"?: TtscLintRuleSetting;
|
|
989
968
|
|
|
990
969
|
/**
|
|
991
|
-
* Reject redeclaring restricted globals (`NaN`, `Infinity`,
|
|
992
|
-
*
|
|
970
|
+
* Reject redeclaring restricted globals (`NaN`, `Infinity`, `undefined`,
|
|
971
|
+
* etc.).
|
|
993
972
|
*
|
|
994
973
|
* @reference https://eslint.org/docs/latest/rules/no-shadow-restricted-names
|
|
995
974
|
*/
|
|
996
975
|
"no-shadow-restricted-names"?: TtscLintRuleSetting;
|
|
997
976
|
|
|
998
977
|
/**
|
|
999
|
-
* Reject array literals with elision (`[, 1, , 3]`), which read
|
|
1000
|
-
*
|
|
978
|
+
* Reject array literals with elision (`[, 1, , 3]`), which read surprisingly
|
|
979
|
+
* and rarely express intent.
|
|
1001
980
|
*
|
|
1002
981
|
* @reference https://eslint.org/docs/latest/rules/no-sparse-arrays
|
|
1003
982
|
*/
|
|
1004
983
|
"no-sparse-arrays"?: TtscLintRuleSetting;
|
|
1005
984
|
|
|
1006
985
|
/**
|
|
1007
|
-
* Reject `${expr}` inside ordinary single- or double-quoted
|
|
1008
|
-
*
|
|
986
|
+
* Reject `${expr}` inside ordinary single- or double-quoted strings — almost
|
|
987
|
+
* always a missing template-literal backtick.
|
|
1009
988
|
*
|
|
1010
989
|
* @reference https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
1011
990
|
*/
|
|
1012
991
|
"no-template-curly-in-string"?: TtscLintRuleSetting;
|
|
1013
992
|
|
|
1014
993
|
/**
|
|
1015
|
-
* Reject `this` (or `super.x`) references that precede the first
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
* actually called.
|
|
994
|
+
* Reject `this` (or `super.x`) references that precede the first `super()`
|
|
995
|
+
* call in a derived constructor. The runtime throws a ReferenceError on the
|
|
996
|
+
* first such access; catching it at lint time avoids a class of bugs that
|
|
997
|
+
* only surface after the constructor is actually called.
|
|
1020
998
|
*
|
|
1021
999
|
* @reference https://eslint.org/docs/latest/rules/no-this-before-super
|
|
1022
1000
|
*/
|
|
@@ -1030,9 +1008,8 @@ export interface ITtscLintCoreRules {
|
|
|
1030
1008
|
"no-throw-literal"?: TtscLintRuleSetting;
|
|
1031
1009
|
|
|
1032
1010
|
/**
|
|
1033
|
-
* Reject initializing a variable to the literal `undefined`
|
|
1034
|
-
*
|
|
1035
|
-
* same effect.
|
|
1011
|
+
* Reject initializing a variable to the literal `undefined` (`let x =
|
|
1012
|
+
* undefined`) — declaring without an initializer has the same effect.
|
|
1036
1013
|
*
|
|
1037
1014
|
* @reference https://eslint.org/docs/latest/rules/no-undef-init
|
|
1038
1015
|
*/
|
|
@@ -1047,61 +1024,58 @@ export interface ITtscLintCoreRules {
|
|
|
1047
1024
|
"no-undefined"?: TtscLintRuleSetting;
|
|
1048
1025
|
|
|
1049
1026
|
/**
|
|
1050
|
-
* Reject `cond ? true : false` and similar ternaries that can be
|
|
1051
|
-
*
|
|
1027
|
+
* Reject `cond ? true : false` and similar ternaries that can be simplified
|
|
1028
|
+
* to a boolean coercion or the condition itself.
|
|
1052
1029
|
*
|
|
1053
1030
|
* @reference https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
1054
1031
|
*/
|
|
1055
1032
|
"no-unneeded-ternary"?: TtscLintRuleSetting;
|
|
1056
1033
|
|
|
1057
1034
|
/**
|
|
1058
|
-
* Reject statements that follow an unconditional `return`, `throw`,
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1035
|
+
* Reject statements that follow an unconditional `return`, `throw`, `break`,
|
|
1036
|
+
* or `continue` in the same block — control flow has already left the block,
|
|
1037
|
+
* so any later statement is dead code.
|
|
1061
1038
|
*
|
|
1062
|
-
* The conservative baseline scans the immediate statement list of a
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1039
|
+
* The conservative baseline scans the immediate statement list of a block (or
|
|
1040
|
+
* the top-level source / module body) only; hoistable function declarations
|
|
1041
|
+
* following the terminator are exempt because they are hoisted above the
|
|
1042
|
+
* unreachable point.
|
|
1066
1043
|
*
|
|
1067
1044
|
* @reference https://eslint.org/docs/latest/rules/no-unreachable
|
|
1068
1045
|
*/
|
|
1069
1046
|
"no-unreachable"?: TtscLintRuleSetting;
|
|
1070
1047
|
|
|
1071
1048
|
/**
|
|
1072
|
-
* Reject `return` and `throw` inside a `finally` block, which
|
|
1073
|
-
*
|
|
1074
|
-
* `try`/`catch`.
|
|
1049
|
+
* Reject `return` and `throw` inside a `finally` block, which override any
|
|
1050
|
+
* earlier `return`/`throw` from the corresponding `try`/`catch`.
|
|
1075
1051
|
*
|
|
1076
1052
|
* @reference https://eslint.org/docs/latest/rules/no-unsafe-finally
|
|
1077
1053
|
*/
|
|
1078
1054
|
"no-unsafe-finally"?: TtscLintRuleSetting;
|
|
1079
1055
|
|
|
1080
1056
|
/**
|
|
1081
|
-
* Reject `!key in obj` and `!a instanceof B` where the `!` binds
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1057
|
+
* Reject `!key in obj` and `!a instanceof B` where the `!` binds tighter than
|
|
1058
|
+
* the relational operator and silently coerces the left operand to a
|
|
1059
|
+
* boolean.
|
|
1084
1060
|
*
|
|
1085
|
-
* Wrap in parens (`!(key in obj)`) when the negation is genuinely
|
|
1086
|
-
* intended.
|
|
1061
|
+
* Wrap in parens (`!(key in obj)`) when the negation is genuinely intended.
|
|
1087
1062
|
*
|
|
1088
1063
|
* @reference https://eslint.org/docs/latest/rules/no-unsafe-negation
|
|
1089
1064
|
*/
|
|
1090
1065
|
"no-unsafe-negation"?: TtscLintRuleSetting;
|
|
1091
1066
|
|
|
1092
1067
|
/**
|
|
1093
|
-
* Reject member access or call expressions that chain off an
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
* continue with `?.` to remain safe.
|
|
1068
|
+
* Reject member access or call expressions that chain off an optional chain
|
|
1069
|
+
* without continuing the chain. `(obj?.foo).bar` throws a TypeError if obj is
|
|
1070
|
+
* null/undefined; the chain must continue with `?.` to remain safe.
|
|
1097
1071
|
*
|
|
1098
1072
|
* @reference https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
|
|
1099
1073
|
*/
|
|
1100
1074
|
"no-unsafe-optional-chaining"?: TtscLintRuleSetting;
|
|
1101
1075
|
|
|
1102
1076
|
/**
|
|
1103
|
-
* Reject expression statements with no observable effect, like a
|
|
1104
|
-
*
|
|
1077
|
+
* Reject expression statements with no observable effect, like a bare `x;` or
|
|
1078
|
+
* `'use strict' && f();`.
|
|
1105
1079
|
*
|
|
1106
1080
|
* @reference https://eslint.org/docs/latest/rules/no-unused-expressions
|
|
1107
1081
|
*/
|
|
@@ -1110,88 +1084,86 @@ export interface ITtscLintCoreRules {
|
|
|
1110
1084
|
/**
|
|
1111
1085
|
* Reject labels that no `break` or `continue` statement references.
|
|
1112
1086
|
*
|
|
1113
|
-
* Usually the targeted statement was renamed or removed but the label
|
|
1114
|
-
*
|
|
1087
|
+
* Usually the targeted statement was renamed or removed but the label was
|
|
1088
|
+
* left behind.
|
|
1115
1089
|
*
|
|
1116
1090
|
* @reference https://eslint.org/docs/latest/rules/no-unused-labels
|
|
1117
1091
|
*/
|
|
1118
1092
|
"no-unused-labels"?: TtscLintRuleSetting;
|
|
1119
1093
|
|
|
1120
1094
|
/**
|
|
1121
|
-
* Reject an assignment whose value is immediately overwritten by the
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1127
|
-
* always a leftover from refactoring.
|
|
1095
|
+
* Reject an assignment whose value is immediately overwritten by the very
|
|
1096
|
+
* next statement without an intervening read of the same identifier. The
|
|
1097
|
+
* conservative baseline only fires on two syntactically adjacent `x =
|
|
1098
|
+
* <expr>;` statements where the left-hand sides are the same bare identifier
|
|
1099
|
+
* and the second statement's right-hand side does not reference `x` itself —
|
|
1100
|
+
* almost always a leftover from refactoring.
|
|
1128
1101
|
*
|
|
1129
1102
|
* @reference https://eslint.org/docs/latest/rules/no-useless-assignment
|
|
1130
1103
|
*/
|
|
1131
1104
|
"no-useless-assignment"?: TtscLintRuleSetting;
|
|
1132
1105
|
|
|
1133
1106
|
/**
|
|
1134
|
-
* Reject unnecessary `.call()` / `.apply()` calls (such as
|
|
1135
|
-
*
|
|
1107
|
+
* Reject unnecessary `.call()` / `.apply()` calls (such as `f.call(undefined,
|
|
1108
|
+
* x)`).
|
|
1136
1109
|
*
|
|
1137
1110
|
* @reference https://eslint.org/docs/latest/rules/no-useless-call
|
|
1138
1111
|
*/
|
|
1139
1112
|
"no-useless-call"?: TtscLintRuleSetting;
|
|
1140
1113
|
|
|
1141
1114
|
/**
|
|
1142
|
-
* Reject `catch (e) { throw e }` patterns that only rethrow the
|
|
1143
|
-
*
|
|
1115
|
+
* Reject `catch (e) { throw e }` patterns that only rethrow the caught error
|
|
1116
|
+
* without adding context or handling.
|
|
1144
1117
|
*
|
|
1145
1118
|
* @reference https://eslint.org/docs/latest/rules/no-useless-catch
|
|
1146
1119
|
*/
|
|
1147
1120
|
"no-useless-catch"?: TtscLintRuleSetting;
|
|
1148
1121
|
|
|
1149
1122
|
/**
|
|
1150
|
-
* Reject computed property keys whose expression is a literal
|
|
1151
|
-
*
|
|
1123
|
+
* Reject computed property keys whose expression is a literal identifier (`{
|
|
1124
|
+
* ["foo"]: 1 }`).
|
|
1152
1125
|
*
|
|
1153
1126
|
* @reference https://eslint.org/docs/latest/rules/no-useless-computed-key
|
|
1154
1127
|
*/
|
|
1155
1128
|
"no-useless-computed-key"?: TtscLintRuleSetting;
|
|
1156
1129
|
|
|
1157
1130
|
/**
|
|
1158
|
-
* Reject `"a" + "b"` and similar concatenations where every operand
|
|
1159
|
-
*
|
|
1131
|
+
* Reject `"a" + "b"` and similar concatenations where every operand is a
|
|
1132
|
+
* literal string.
|
|
1160
1133
|
*
|
|
1161
1134
|
* @reference https://eslint.org/docs/latest/rules/no-useless-concat
|
|
1162
1135
|
*/
|
|
1163
1136
|
"no-useless-concat"?: TtscLintRuleSetting;
|
|
1164
1137
|
|
|
1165
1138
|
/**
|
|
1166
|
-
* Reject empty constructor bodies (`class X { constructor() {} }`)
|
|
1167
|
-
*
|
|
1139
|
+
* Reject empty constructor bodies (`class X { constructor() {} }`) that add
|
|
1140
|
+
* nothing over the implicit constructor.
|
|
1168
1141
|
*
|
|
1169
1142
|
* @reference https://eslint.org/docs/latest/rules/no-useless-constructor
|
|
1170
1143
|
*/
|
|
1171
1144
|
"no-useless-constructor"?: TtscLintRuleSetting;
|
|
1172
1145
|
|
|
1173
1146
|
/**
|
|
1174
|
-
* Reject unnecessary escape sequences in strings and regex
|
|
1175
|
-
*
|
|
1147
|
+
* Reject unnecessary escape sequences in strings and regex literals, such as
|
|
1148
|
+
* `"\."` or `/\,/`. Autofixable.
|
|
1176
1149
|
*
|
|
1177
1150
|
* @reference https://eslint.org/docs/latest/rules/no-useless-escape
|
|
1178
1151
|
*/
|
|
1179
1152
|
"no-useless-escape"?: TtscLintRuleSetting;
|
|
1180
1153
|
|
|
1181
1154
|
/**
|
|
1182
|
-
* Reject `{ x: x }` destructuring renames that bind back to the
|
|
1183
|
-
*
|
|
1155
|
+
* Reject `{ x: x }` destructuring renames that bind back to the same name.
|
|
1156
|
+
* Autofixable.
|
|
1184
1157
|
*
|
|
1185
1158
|
* @reference https://eslint.org/docs/latest/rules/no-useless-rename
|
|
1186
1159
|
*/
|
|
1187
1160
|
"no-useless-rename"?: TtscLintRuleSetting;
|
|
1188
1161
|
|
|
1189
1162
|
/**
|
|
1190
|
-
* Reject a bare `return;` whose only effect is to end a function
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
1193
|
-
*
|
|
1194
|
-
* load-bearing.
|
|
1163
|
+
* Reject a bare `return;` whose only effect is to end a function body that
|
|
1164
|
+
* would have returned anyway. The conservative baseline only fires on the
|
|
1165
|
+
* last statement of a function-like's immediate body — earlier `return;`
|
|
1166
|
+
* inside a branch or loop may still be load-bearing.
|
|
1195
1167
|
*
|
|
1196
1168
|
* @reference https://eslint.org/docs/latest/rules/no-useless-return
|
|
1197
1169
|
*/
|
|
@@ -1200,8 +1172,8 @@ export interface ITtscLintCoreRules {
|
|
|
1200
1172
|
/**
|
|
1201
1173
|
* Reject `var` declarations.
|
|
1202
1174
|
*
|
|
1203
|
-
* Use `let` for mutable bindings and `const` for immutable ones.
|
|
1204
|
-
*
|
|
1175
|
+
* Use `let` for mutable bindings and `const` for immutable ones. Autofixable
|
|
1176
|
+
* to `let`.
|
|
1205
1177
|
*
|
|
1206
1178
|
* @reference https://eslint.org/docs/latest/rules/no-var
|
|
1207
1179
|
*/
|
|
@@ -1210,48 +1182,48 @@ export interface ITtscLintCoreRules {
|
|
|
1210
1182
|
/**
|
|
1211
1183
|
* Reject `with (...)` statements.
|
|
1212
1184
|
*
|
|
1213
|
-
* `with` is forbidden in strict mode (and therefore in modules),
|
|
1214
|
-
*
|
|
1185
|
+
* `with` is forbidden in strict mode (and therefore in modules), defeats
|
|
1186
|
+
* lexical scoping, and blocks engine optimization.
|
|
1215
1187
|
*
|
|
1216
1188
|
* @reference https://eslint.org/docs/latest/rules/no-with
|
|
1217
1189
|
*/
|
|
1218
1190
|
"no-with"?: TtscLintRuleSetting;
|
|
1219
1191
|
|
|
1220
1192
|
/**
|
|
1221
|
-
* Reject `{ foo: foo }` and similar object-literal shorthand
|
|
1222
|
-
*
|
|
1193
|
+
* Reject `{ foo: foo }` and similar object-literal shorthand candidates in
|
|
1194
|
+
* favor of `{ foo }`. Autofixable.
|
|
1223
1195
|
*
|
|
1224
1196
|
* @reference https://eslint.org/docs/latest/rules/object-shorthand
|
|
1225
1197
|
*/
|
|
1226
1198
|
"object-shorthand"?: TtscLintRuleSetting;
|
|
1227
1199
|
|
|
1228
1200
|
/**
|
|
1229
|
-
* Prefer compound assignment (`x += y`) over the long form
|
|
1230
|
-
*
|
|
1201
|
+
* Prefer compound assignment (`x += y`) over the long form (`x = x + y`)
|
|
1202
|
+
* where the two are equivalent.
|
|
1231
1203
|
*
|
|
1232
1204
|
* @reference https://eslint.org/docs/latest/rules/operator-assignment
|
|
1233
1205
|
*/
|
|
1234
1206
|
"operator-assignment"?: TtscLintRuleSetting;
|
|
1235
1207
|
|
|
1236
1208
|
/**
|
|
1237
|
-
* Reject `function() { ... }` expressions passed as callback arguments —
|
|
1209
|
+
* Reject `function() { ... }` expressions passed as callback arguments —
|
|
1210
|
+
* prefer the arrow form.
|
|
1238
1211
|
*
|
|
1239
1212
|
* @reference https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
1240
1213
|
*/
|
|
1241
1214
|
"prefer-arrow-callback"?: TtscLintRuleSetting;
|
|
1242
1215
|
|
|
1243
1216
|
/**
|
|
1244
|
-
* Require `const` for variables that are never reassigned after
|
|
1245
|
-
*
|
|
1217
|
+
* Require `const` for variables that are never reassigned after declaration.
|
|
1218
|
+
* Autofixable for single-declaration `let`s.
|
|
1246
1219
|
*
|
|
1247
1220
|
* @reference https://eslint.org/docs/latest/rules/prefer-const
|
|
1248
1221
|
*/
|
|
1249
1222
|
"prefer-const"?: TtscLintRuleSetting;
|
|
1250
1223
|
|
|
1251
1224
|
/**
|
|
1252
|
-
* Reject single-property and single-index variable declarations
|
|
1253
|
-
*
|
|
1254
|
-
* replace verbatim.
|
|
1225
|
+
* Reject single-property and single-index variable declarations (`const a =
|
|
1226
|
+
* obj.a`, `const x = arr[0]`) that destructuring would replace verbatim.
|
|
1255
1227
|
*
|
|
1256
1228
|
* @reference https://eslint.org/docs/latest/rules/prefer-destructuring
|
|
1257
1229
|
*/
|
|
@@ -1265,9 +1237,8 @@ export interface ITtscLintCoreRules {
|
|
|
1265
1237
|
"prefer-exponentiation-operator"?: TtscLintRuleSetting;
|
|
1266
1238
|
|
|
1267
1239
|
/**
|
|
1268
|
-
* Prefer `for..of` over a traditional `for (let i = 0; i <
|
|
1269
|
-
*
|
|
1270
|
-
* body.
|
|
1240
|
+
* Prefer `for..of` over a traditional `for (let i = 0; i < arr.length; i++)`
|
|
1241
|
+
* loop when the index is never used inside the body.
|
|
1271
1242
|
*
|
|
1272
1243
|
* @reference https://eslint.org/docs/latest/rules/prefer-for-of
|
|
1273
1244
|
*/
|
|
@@ -1275,26 +1246,27 @@ export interface ITtscLintCoreRules {
|
|
|
1275
1246
|
|
|
1276
1247
|
/**
|
|
1277
1248
|
* Prefer `Object.hasOwn(obj, key)` over
|
|
1278
|
-
* `Object.prototype.hasOwnProperty.call(obj, key)`. The new helper
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1249
|
+
* `Object.prototype.hasOwnProperty.call(obj, key)`. The new helper is
|
|
1250
|
+
* shorter, less error-prone, and matches the form linters elsewhere
|
|
1251
|
+
* recommend.
|
|
1281
1252
|
*
|
|
1282
1253
|
* @reference https://eslint.org/docs/latest/rules/prefer-object-has-own
|
|
1283
1254
|
*/
|
|
1284
1255
|
"prefer-object-has-own"?: TtscLintRuleSetting;
|
|
1285
1256
|
|
|
1286
1257
|
/**
|
|
1287
|
-
* Prefer object-spread `{ ...a, ...b }` over `Object.assign({}, a, b)`.
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1258
|
+
* Prefer object-spread `{ ...a, ...b }` over `Object.assign({}, a, b)`. Only
|
|
1259
|
+
* fires when the first argument is an empty object literal — mutating
|
|
1260
|
+
* `Object.assign(target, …)` calls are left alone because the spread form
|
|
1261
|
+
* does not preserve their observable side effects.
|
|
1291
1262
|
*
|
|
1292
1263
|
* @reference https://eslint.org/docs/latest/rules/prefer-object-spread
|
|
1293
1264
|
*/
|
|
1294
1265
|
"prefer-object-spread"?: TtscLintRuleSetting;
|
|
1295
1266
|
|
|
1296
1267
|
/**
|
|
1297
|
-
* Reject regex literals with unnamed capturing groups `(...)` — prefer named
|
|
1268
|
+
* Reject regex literals with unnamed capturing groups `(...)` — prefer named
|
|
1269
|
+
* groups `(?<name>...)`.
|
|
1298
1270
|
*
|
|
1299
1271
|
* @reference https://eslint.org/docs/latest/rules/prefer-named-capture-group
|
|
1300
1272
|
*/
|
|
@@ -1302,17 +1274,17 @@ export interface ITtscLintCoreRules {
|
|
|
1302
1274
|
|
|
1303
1275
|
/**
|
|
1304
1276
|
* Prefer ES2015+ numeric literal forms (`0b…`, `0o…`, `0x…`) over
|
|
1305
|
-
* `parseInt(string, 2 | 8 | 16)`. The literal form is shorter, type-
|
|
1306
|
-
*
|
|
1277
|
+
* `parseInt(string, 2 | 8 | 16)`. The literal form is shorter, type- safe at
|
|
1278
|
+
* lint time, and not subject to runtime radix mismatches.
|
|
1307
1279
|
*
|
|
1308
1280
|
* @reference https://eslint.org/docs/latest/rules/prefer-numeric-literals
|
|
1309
1281
|
*/
|
|
1310
1282
|
"prefer-numeric-literals"?: TtscLintRuleSetting;
|
|
1311
1283
|
|
|
1312
1284
|
/**
|
|
1313
|
-
* Reject reading from `arguments` in a non-arrow function body —
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1285
|
+
* Reject reading from `arguments` in a non-arrow function body — prefer the
|
|
1286
|
+
* ES2015 rest-parameter form `(...args)`, which declares the variadic
|
|
1287
|
+
* contract on the signature and yields a real array.
|
|
1316
1288
|
*
|
|
1317
1289
|
* @reference https://eslint.org/docs/latest/rules/prefer-rest-params
|
|
1318
1290
|
*/
|
|
@@ -1321,17 +1293,17 @@ export interface ITtscLintCoreRules {
|
|
|
1321
1293
|
/**
|
|
1322
1294
|
* Prefer spread arguments `f(...args)` over `f.apply(null, args)`.
|
|
1323
1295
|
*
|
|
1324
|
-
* Only flags `apply` calls whose `this` argument is provably the
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1296
|
+
* Only flags `apply` calls whose `this` argument is provably the same
|
|
1297
|
+
* receiver (or `null` / `undefined`); calls that genuinely rebind `this` are
|
|
1298
|
+
* left alone.
|
|
1327
1299
|
*
|
|
1328
1300
|
* @reference https://eslint.org/docs/latest/rules/prefer-spread
|
|
1329
1301
|
*/
|
|
1330
1302
|
"prefer-spread"?: TtscLintRuleSetting;
|
|
1331
1303
|
|
|
1332
1304
|
/**
|
|
1333
|
-
* Prefer template literals over string concatenation when any
|
|
1334
|
-
*
|
|
1305
|
+
* Prefer template literals over string concatenation when any operand is
|
|
1306
|
+
* non-literal.
|
|
1335
1307
|
*
|
|
1336
1308
|
* @reference https://eslint.org/docs/latest/rules/prefer-template
|
|
1337
1309
|
*/
|
|
@@ -1340,23 +1312,23 @@ export interface ITtscLintCoreRules {
|
|
|
1340
1312
|
/**
|
|
1341
1313
|
* Require an explicit radix argument for `parseInt(str, radix)`.
|
|
1342
1314
|
*
|
|
1343
|
-
* Without it, `"0123"` parses as decimal or octal depending on the
|
|
1344
|
-
* engine.
|
|
1315
|
+
* Without it, `"0123"` parses as decimal or octal depending on the engine.
|
|
1345
1316
|
*
|
|
1346
1317
|
* @reference https://eslint.org/docs/latest/rules/radix
|
|
1347
1318
|
*/
|
|
1348
|
-
|
|
1319
|
+
radix?: TtscLintRuleSetting;
|
|
1349
1320
|
|
|
1350
1321
|
/**
|
|
1351
|
-
* Require generator functions to contain at least one `yield`. A
|
|
1352
|
-
*
|
|
1322
|
+
* Require generator functions to contain at least one `yield`. A `yield`-less
|
|
1323
|
+
* generator is almost always a typo.
|
|
1353
1324
|
*
|
|
1354
1325
|
* @reference https://eslint.org/docs/latest/rules/require-yield
|
|
1355
1326
|
*/
|
|
1356
1327
|
"require-yield"?: TtscLintRuleSetting;
|
|
1357
1328
|
|
|
1358
1329
|
/**
|
|
1359
|
-
* Reject import specifiers within a single `import` declaration that aren't
|
|
1330
|
+
* Reject import specifiers within a single `import` declaration that aren't
|
|
1331
|
+
* alphabetically sorted.
|
|
1360
1332
|
*
|
|
1361
1333
|
* @reference https://eslint.org/docs/latest/rules/sort-imports
|
|
1362
1334
|
*/
|
|
@@ -1370,25 +1342,25 @@ export interface ITtscLintCoreRules {
|
|
|
1370
1342
|
"sort-keys"?: TtscLintRuleSetting;
|
|
1371
1343
|
|
|
1372
1344
|
/**
|
|
1373
|
-
* Require `Number.isNaN` / `isNaN` for `NaN` checks; restrict
|
|
1374
|
-
*
|
|
1345
|
+
* Require `Number.isNaN` / `isNaN` for `NaN` checks; restrict `typeof`
|
|
1346
|
+
* comparisons to the documented strings.
|
|
1375
1347
|
*
|
|
1376
1348
|
* @reference https://eslint.org/docs/latest/rules/use-isnan
|
|
1377
1349
|
*/
|
|
1378
1350
|
"use-isnan"?: TtscLintRuleSetting;
|
|
1379
1351
|
|
|
1380
1352
|
/**
|
|
1381
|
-
* Restrict the right-hand operand of `typeof` to the documented
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1353
|
+
* Restrict the right-hand operand of `typeof` to the documented strings
|
|
1354
|
+
* (`"number"`, `"object"`, ...) so `typeof x === "undefiend"` typos are
|
|
1355
|
+
* caught.
|
|
1384
1356
|
*
|
|
1385
1357
|
* @reference https://eslint.org/docs/latest/rules/valid-typeof
|
|
1386
1358
|
*/
|
|
1387
1359
|
"valid-typeof"?: TtscLintRuleSetting;
|
|
1388
1360
|
|
|
1389
1361
|
/**
|
|
1390
|
-
* Require `var` declarations to be hoisted to the top of their
|
|
1391
|
-
*
|
|
1362
|
+
* Require `var` declarations to be hoisted to the top of their scope by hand,
|
|
1363
|
+
* mirroring how the engine treats them.
|
|
1392
1364
|
*
|
|
1393
1365
|
* Has no effect when `no-var` forbids `var` altogether.
|
|
1394
1366
|
*
|
|
@@ -1397,10 +1369,10 @@ export interface ITtscLintCoreRules {
|
|
|
1397
1369
|
"vars-on-top"?: TtscLintRuleSetting;
|
|
1398
1370
|
|
|
1399
1371
|
/**
|
|
1400
|
-
* Reject Yoda-style comparisons (`if (42 === x)`); use
|
|
1401
|
-
*
|
|
1372
|
+
* Reject Yoda-style comparisons (`if (42 === x)`); use `if (x === 42)` so the
|
|
1373
|
+
* variable comes first.
|
|
1402
1374
|
*
|
|
1403
1375
|
* @reference https://eslint.org/docs/latest/rules/yoda
|
|
1404
1376
|
*/
|
|
1405
|
-
|
|
1377
|
+
yoda?: TtscLintRuleSetting;
|
|
1406
1378
|
}
|