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