From 6dcaae5cd8998b14d3633c29ee48111c81274004 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:53:52 +0000 Subject: [PATCH] chore(linter): move typescript/no-magic-numbers to eslint/no-magic-numbers (#5640) closes #5614 --- crates/oxc_linter/src/rules.rs | 38 +-- .../no_magic_numbers.rs | 0 .../src/snapshots/no_magic_numbers.snap | 266 +++++++++--------- 3 files changed, 152 insertions(+), 152 deletions(-) rename crates/oxc_linter/src/rules/{typescript => eslint}/no_magic_numbers.rs (100%) diff --git a/crates/oxc_linter/src/rules.rs b/crates/oxc_linter/src/rules.rs index aaceeffea121f..d82bb40cb6908 100644 --- a/crates/oxc_linter/src/rules.rs +++ b/crates/oxc_linter/src/rules.rs @@ -82,6 +82,7 @@ mod eslint { pub mod no_iterator; pub mod no_label_var; pub mod no_loss_of_precision; + pub mod no_magic_numbers; pub mod no_multi_str; pub mod no_new; pub mod no_new_func; @@ -151,7 +152,6 @@ mod typescript { pub mod no_extra_non_null_assertion; pub mod no_extraneous_class; pub mod no_import_type_side_effects; - pub mod no_magic_numbers; pub mod no_misused_new; pub mod no_namespace; pub mod no_non_null_asserted_nullish_coalescing; @@ -494,24 +494,21 @@ oxc_macros::declare_all_lint_rules! { eslint::max_classes_per_file, eslint::max_lines, eslint::max_params, - eslint::no_ternary, - eslint::no_this_before_super, - eslint::no_template_curly_in_string, eslint::no_alert, eslint::no_array_constructor, eslint::no_async_promise_executor, + eslint::no_await_in_loop, eslint::no_bitwise, eslint::no_caller, eslint::no_case_declarations, eslint::no_class_assign, - eslint::no_label_var, - eslint::require_await, eslint::no_compare_neg_zero, eslint::no_cond_assign, eslint::no_console, eslint::no_const_assign, eslint::no_constant_binary_expression, eslint::no_constant_condition, + eslint::no_constructor_return, eslint::no_continue, eslint::no_control_regex, eslint::no_debugger, @@ -526,21 +523,25 @@ oxc_macros::declare_all_lint_rules! { eslint::no_empty_function, eslint::no_empty_pattern, eslint::no_empty_static_block, + eslint::no_eq_null, eslint::no_eval, eslint::no_ex_assign, eslint::no_extra_boolean_cast, - eslint::no_eq_null, eslint::no_fallthrough, eslint::no_func_assign, eslint::no_global_assign, eslint::no_import_assign, eslint::no_inner_declarations, + eslint::no_invalid_regexp, eslint::no_irregular_whitespace, eslint::no_iterator, + eslint::no_label_var, eslint::no_loss_of_precision, + eslint::no_magic_numbers, eslint::no_multi_str, eslint::no_new, eslint::no_new_func, + eslint::no_new_native_nonconstructor, eslint::no_new_wrappers, eslint::no_nonoctal_decimal_escape, eslint::no_obj_calls, @@ -548,12 +549,16 @@ oxc_macros::declare_all_lint_rules! { eslint::no_prototype_builtins, eslint::no_redeclare, eslint::no_regex_spaces, + eslint::no_restricted_globals, eslint::no_script_url, eslint::no_self_assign, eslint::no_self_compare, eslint::no_setter_return, eslint::no_shadow_restricted_names, eslint::no_sparse_arrays, + eslint::no_template_curly_in_string, + eslint::no_ternary, + eslint::no_this_before_super, eslint::no_undef, eslint::no_undefined, eslint::no_unreachable, @@ -561,31 +566,27 @@ oxc_macros::declare_all_lint_rules! { eslint::no_unsafe_negation, eslint::no_unsafe_optional_chaining, eslint::no_unused_labels, - eslint::no_unused_vars, eslint::no_unused_private_class_members, + eslint::no_unused_vars, eslint::no_useless_catch, - eslint::no_useless_escape, - eslint::no_useless_rename, eslint::no_useless_concat, eslint::no_useless_constructor, + eslint::no_useless_escape, + eslint::no_useless_rename, eslint::no_var, - eslint::no_invalid_regexp, eslint::no_void, eslint::no_with, + eslint::prefer_exponentiation_operator, + eslint::prefer_numeric_literals, eslint::radix, + eslint::require_await, eslint::require_yield, - eslint::symbol_description, eslint::sort_imports, eslint::sort_vars, + eslint::symbol_description, eslint::unicode_bom, eslint::use_isnan, eslint::valid_typeof, - eslint::no_await_in_loop, - eslint::no_new_native_nonconstructor, - eslint::no_restricted_globals, - eslint::prefer_exponentiation_operator, - eslint::prefer_numeric_literals, - eslint::no_constructor_return, typescript::adjacent_overload_signatures, typescript::array_type, typescript::ban_ts_comment, @@ -600,7 +601,6 @@ oxc_macros::declare_all_lint_rules! { typescript::no_explicit_any, typescript::no_extra_non_null_assertion, typescript::no_import_type_side_effects, - typescript::no_magic_numbers, typescript::no_misused_new, typescript::no_namespace, typescript::no_non_null_asserted_optional_chain, diff --git a/crates/oxc_linter/src/rules/typescript/no_magic_numbers.rs b/crates/oxc_linter/src/rules/eslint/no_magic_numbers.rs similarity index 100% rename from crates/oxc_linter/src/rules/typescript/no_magic_numbers.rs rename to crates/oxc_linter/src/rules/eslint/no_magic_numbers.rs diff --git a/crates/oxc_linter/src/snapshots/no_magic_numbers.snap b/crates/oxc_linter/src/snapshots/no_magic_numbers.snap index 30f023c3a3209..9784a5016c9fa 100644 --- a/crates/oxc_linter/src/snapshots/no_magic_numbers.snap +++ b/crates/oxc_linter/src/snapshots/no_magic_numbers.snap @@ -1,517 +1,517 @@ --- source: crates/oxc_linter/src/tester.rs --- - ⚠ typescript-eslint(no-magic-numbers): Number constants declarations must use 'const'. + ⚠ eslint(no-magic-numbers): Number constants declarations must use 'const'. ╭─[no_magic_numbers.tsx:1:11] 1 │ var foo = 42 · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0 + ⚠ eslint(no-magic-numbers): No magic number: 0 ╭─[no_magic_numbers.tsx:1:11] 1 │ var foo = 0 + 1; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:15] 1 │ var foo = 0 + 1; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): Number constants declarations must use 'const'. + ⚠ eslint(no-magic-numbers): Number constants declarations must use 'const'. ╭─[no_magic_numbers.tsx:1:11] 1 │ var foo = 42n · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0n + ⚠ eslint(no-magic-numbers): No magic number: 0n ╭─[no_magic_numbers.tsx:1:11] 1 │ var foo = 0n + 1n; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1n + ⚠ eslint(no-magic-numbers): No magic number: 1n ╭─[no_magic_numbers.tsx:1:16] 1 │ var foo = 0n + 1n; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 5 + ⚠ eslint(no-magic-numbers): No magic number: 5 ╭─[no_magic_numbers.tsx:1:9] 1 │ a = a + 5; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 5 + ⚠ eslint(no-magic-numbers): No magic number: 5 ╭─[no_magic_numbers.tsx:1:6] 1 │ a += 5; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0 + ⚠ eslint(no-magic-numbers): No magic number: 0 ╭─[no_magic_numbers.tsx:1:11] 1 │ var foo = 0 + 1 + -2 + 2; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:15] 1 │ var foo = 0 + 1 + -2 + 2; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -2 + ⚠ eslint(no-magic-numbers): No magic number: -2 ╭─[no_magic_numbers.tsx:1:19] 1 │ var foo = 0 + 1 + -2 + 2; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:24] 1 │ var foo = 0 + 1 + -2 + 2; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:19] 1 │ var foo = 0 + 1 + 2; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 10 + ⚠ eslint(no-magic-numbers): No magic number: 10 ╭─[no_magic_numbers.tsx:1:17] 1 │ var foo = { bar:10 } · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0x1A + ⚠ eslint(no-magic-numbers): No magic number: 0x1A ╭─[no_magic_numbers.tsx:1:13] 1 │ console.log(0x1A + 0x02); console.log(071); · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0x02 + ⚠ eslint(no-magic-numbers): No magic number: 0x02 ╭─[no_magic_numbers.tsx:1:20] 1 │ console.log(0x1A + 0x02); console.log(071); · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 071 + ⚠ eslint(no-magic-numbers): No magic number: 071 ╭─[no_magic_numbers.tsx:1:39] 1 │ console.log(0x1A + 0x02); console.log(071); · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 42 + ⚠ eslint(no-magic-numbers): No magic number: 42 ╭─[no_magic_numbers.tsx:1:19] 1 │ var stats = {avg: 42}; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 4 + ⚠ eslint(no-magic-numbers): No magic number: 4 ╭─[no_magic_numbers.tsx:1:67] 1 │ var colors = {}; colors.RED = 2; colors.YELLOW = 3; colors.BLUE = 4 + 5; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 5 + ⚠ eslint(no-magic-numbers): No magic number: 5 ╭─[no_magic_numbers.tsx:1:71] 1 │ var colors = {}; colors.RED = 2; colors.YELLOW = 3; colors.BLUE = 4 + 5; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 60 + ⚠ eslint(no-magic-numbers): No magic number: 60 ╭─[no_magic_numbers.tsx:1:39] 1 │ function getSecondsInMinute() {return 60;} · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -60 + ⚠ eslint(no-magic-numbers): No magic number: -60 ╭─[no_magic_numbers.tsx:1:47] 1 │ function getNegativeSecondsInMinute() {return -60;} · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:52] 1 │ var data = ['foo', 'bar', 'baz']; var third = data[3]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:52] 1 │ var data = ['foo', 'bar', 'baz']; var third = data[3]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:52] 1 │ var data = ['foo', 'bar', 'baz']; var third = data[3]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -100 + ⚠ eslint(no-magic-numbers): No magic number: -100 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-100] · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1.5 + ⚠ eslint(no-magic-numbers): No magic number: -1.5 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-1.5] · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-1] · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -0.1 + ⚠ eslint(no-magic-numbers): No magic number: -0.1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-0.1] · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -0b110 + ⚠ eslint(no-magic-numbers): No magic number: -0b110 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-0b110] · ────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -0o71 + ⚠ eslint(no-magic-numbers): No magic number: -0o71 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-0o71] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -0x12 + ⚠ eslint(no-magic-numbers): No magic number: -0x12 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-0x12] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -012 + ⚠ eslint(no-magic-numbers): No magic number: -012 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-012] · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0.1 + ⚠ eslint(no-magic-numbers): No magic number: 0.1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[0.1] · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0.12e1 + ⚠ eslint(no-magic-numbers): No magic number: 0.12e1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[0.12e1] · ────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1.5 + ⚠ eslint(no-magic-numbers): No magic number: 1.5 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[1.5] · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1.678e2 + ⚠ eslint(no-magic-numbers): No magic number: 1.678e2 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[1.678e2] · ─────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 56e-1 + ⚠ eslint(no-magic-numbers): No magic number: 56e-1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[56e-1] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 5.000000000000001 + ⚠ eslint(no-magic-numbers): No magic number: 5.000000000000001 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[5.000000000000001] · ───────────────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100.9 + ⚠ eslint(no-magic-numbers): No magic number: 100.9 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[100.9] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 4294967295 + ⚠ eslint(no-magic-numbers): No magic number: 4294967295 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[4294967295] · ────────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1e300 + ⚠ eslint(no-magic-numbers): No magic number: 1e300 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[1e300] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1e310 + ⚠ eslint(no-magic-numbers): No magic number: 1e310 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[1e310] · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1e310 + ⚠ eslint(no-magic-numbers): No magic number: -1e310 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[-1e310] · ────── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0 + ⚠ eslint(no-magic-numbers): No magic number: 0 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[+0] · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:5] 1 │ foo[+1] · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:1:7] 1 │ foo[-(-1)] · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100 + ⚠ eslint(no-magic-numbers): No magic number: 100 ╭─[no_magic_numbers.tsx:1:1] 1 │ 100 .toString() · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 200 + ⚠ eslint(no-magic-numbers): No magic number: 200 ╭─[no_magic_numbers.tsx:1:1] 1 │ 200[100] · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:26] 1 │ var a =
; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:28] 1 │ var a = ; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:30] 1 │ var a = ; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:27] 1 │ var min, max, mean; min = 1; max = 10; mean = 4; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 10 + ⚠ eslint(no-magic-numbers): No magic number: 10 ╭─[no_magic_numbers.tsx:1:36] 1 │ var min, max, mean; min = 1; max = 10; mean = 4; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 4 + ⚠ eslint(no-magic-numbers): No magic number: 4 ╭─[no_magic_numbers.tsx:1:47] 1 │ var min, max, mean; min = 1; max = 10; mean = 4; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100n + ⚠ eslint(no-magic-numbers): No magic number: 100n ╭─[no_magic_numbers.tsx:1:3] 1 │ f(100n) · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -100n + ⚠ eslint(no-magic-numbers): No magic number: -100n ╭─[no_magic_numbers.tsx:1:3] 1 │ f(-100n) · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100n + ⚠ eslint(no-magic-numbers): No magic number: 100n ╭─[no_magic_numbers.tsx:1:3] 1 │ f(100n) · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100 + ⚠ eslint(no-magic-numbers): No magic number: 100 ╭─[no_magic_numbers.tsx:1:3] 1 │ f(100) · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 123 + ⚠ eslint(no-magic-numbers): No magic number: 123 ╭─[no_magic_numbers.tsx:1:23] 1 │ const func = (param = 123) => {} · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 123 + ⚠ eslint(no-magic-numbers): No magic number: 123 ╭─[no_magic_numbers.tsx:1:17] 1 │ const { param = 123 } = sourceObject; · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 123 + ⚠ eslint(no-magic-numbers): No magic number: 123 ╭─[no_magic_numbers.tsx:1:17] 1 │ const { param = 123 } = sourceObject; · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 123 + ⚠ eslint(no-magic-numbers): No magic number: 123 ╭─[no_magic_numbers.tsx:1:17] 1 │ const { param = 123 } = sourceObject; · ─── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:14] 1 │ const [one = 1, two = 2] = [] · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:23] 1 │ const [one = 1, two = 2] = [] · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:22] 1 │ var one, two; [one = 1, two = 2] = [] · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:31] 1 │ var one, two; [one = 1, two = 2] = [] · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:17] 1 │ class C { foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:17] 1 │ class C { foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:17] 1 │ class C { foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -2 + ⚠ eslint(no-magic-numbers): No magic number: -2 ╭─[no_magic_numbers.tsx:1:17] 1 │ class C { foo = -2; } · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:24] 1 │ class C { static foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:18] 1 │ class C { #foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:25] 1 │ class C { static #foo = 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:17] 1 │ class C { foo = 2 + 3; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:21] 1 │ class C { foo = 2 + 3; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:11] 1 │ class C { 2; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:12] 1 │ class C { [2]; } · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:12] 1 │ type Foo = 1; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:1:12] 1 │ type Foo = -1; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:12] 1 │ type Foo = 1 | 2 | 3; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = 1 | 2 | 3; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:20] 1 │ type Foo = 1 | 2 | 3; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:12] 1 │ type Foo = 1 | -1; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = 1 | -1; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:3:11] 2 │ interface Foo { 3 │ bar: 1; @@ -519,7 +519,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ } ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1000 + ⚠ eslint(no-magic-numbers): No magic number: 1000 ╭─[no_magic_numbers.tsx:3:15] 2 │ enum foo { 3 │ SECOND = 1000, @@ -527,7 +527,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ NUM = '0123456789', ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:5:12] 4 │ NUM = '0123456789', 5 │ NEG = -1, @@ -535,7 +535,7 @@ source: crates/oxc_linter/src/tester.rs 6 │ POS = +1, ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:6:12] 5 │ NEG = -1, 6 │ POS = +1, @@ -543,7 +543,7 @@ source: crates/oxc_linter/src/tester.rs 7 │ } ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:3:19] 2 │ class Foo { 3 │ readonly A = 1; @@ -551,7 +551,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ readonly B = 2; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:4:19] 3 │ readonly A = 1; 4 │ readonly B = 2; @@ -559,7 +559,7 @@ source: crates/oxc_linter/src/tester.rs 5 │ public static readonly C = 3; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:5:33] 4 │ readonly B = 2; 5 │ public static readonly C = 3; @@ -567,7 +567,7 @@ source: crates/oxc_linter/src/tester.rs 6 │ static readonly D = 4; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 4 + ⚠ eslint(no-magic-numbers): No magic number: 4 ╭─[no_magic_numbers.tsx:6:26] 5 │ public static readonly C = 3; 6 │ static readonly D = 4; @@ -575,7 +575,7 @@ source: crates/oxc_linter/src/tester.rs 7 │ readonly E = -5; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -5 + ⚠ eslint(no-magic-numbers): No magic number: -5 ╭─[no_magic_numbers.tsx:7:19] 6 │ static readonly D = 4; 7 │ readonly E = -5; @@ -583,7 +583,7 @@ source: crates/oxc_linter/src/tester.rs 8 │ readonly F = +6; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 6 + ⚠ eslint(no-magic-numbers): No magic number: 6 ╭─[no_magic_numbers.tsx:8:19] 7 │ readonly E = -5; 8 │ readonly F = +6; @@ -591,7 +591,7 @@ source: crates/oxc_linter/src/tester.rs 9 │ private readonly G = 100n; ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 100n + ⚠ eslint(no-magic-numbers): No magic number: 100n ╭─[no_magic_numbers.tsx:9:27] 8 │ readonly F = +6; 9 │ private readonly G = 100n; @@ -599,91 +599,91 @@ source: crates/oxc_linter/src/tester.rs 10 │ } ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0 + ⚠ eslint(no-magic-numbers): No magic number: 0 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[0]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -1 + ⚠ eslint(no-magic-numbers): No magic number: -1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[-1]; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 0xab + ⚠ eslint(no-magic-numbers): No magic number: 0xab ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[0xab]; · ──── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 5.6e1 + ⚠ eslint(no-magic-numbers): No magic number: 5.6e1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[5.6e1]; · ───── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[1 | -2]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -2 + ⚠ eslint(no-magic-numbers): No magic number: -2 ╭─[no_magic_numbers.tsx:1:20] 1 │ type Foo = Bar[1 | -2]; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[1 & -2]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -2 + ⚠ eslint(no-magic-numbers): No magic number: -2 ╭─[no_magic_numbers.tsx:1:20] 1 │ type Foo = Bar[1 & -2]; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:16] 1 │ type Foo = Bar[1 & number]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 1 + ⚠ eslint(no-magic-numbers): No magic number: 1 ╭─[no_magic_numbers.tsx:1:18] 1 │ type Foo = Bar[((1 & -2) | 3) | 4]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: -2 + ⚠ eslint(no-magic-numbers): No magic number: -2 ╭─[no_magic_numbers.tsx:1:22] 1 │ type Foo = Bar[((1 & -2) | 3) | 4]; · ── ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 3 + ⚠ eslint(no-magic-numbers): No magic number: 3 ╭─[no_magic_numbers.tsx:1:28] 1 │ type Foo = Bar[((1 & -2) | 3) | 4]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 4 + ⚠ eslint(no-magic-numbers): No magic number: 4 ╭─[no_magic_numbers.tsx:1:33] 1 │ type Foo = Bar[((1 & -2) | 3) | 4]; · ─ ╰──── - ⚠ typescript-eslint(no-magic-numbers): No magic number: 2 + ⚠ eslint(no-magic-numbers): No magic number: 2 ╭─[no_magic_numbers.tsx:1:28] 1 │ type Foo = Parameters