diff --git a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap index 7b375b6b0d5b1..0a7fdbf123ba4 100644 --- a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__eslintrc_env__eslintrc_no_env.json fixtures__eslintrc_env__test.js@oxlint.snap @@ -11,6 +11,7 @@ working directory: 1 | console.log('') : ^^^^^^^ `---- + help: Either define 'console' or remove the reference to it. If 'console' is a global variable, add it to the 'globals' configuration. Found 1 warning and 0 errors. Finished in ms on 1 file with 94 rules using 1 threads. diff --git a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap index 517eeb37d304a..d971efbf1c268 100644 --- a/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_-W no-undef -c fixtures__no_undef__eslintrc.json fixtures__no_undef__test.js@oxlint.snap @@ -11,6 +11,7 @@ working directory: 1 | console.log(foo) : ^^^^^^^ `---- + help: Either define 'console' or remove the reference to it. If 'console' is a global variable, add it to the 'globals' configuration. Found 1 warning and 0 errors. Finished in ms on 1 file with 94 rules using 1 threads. diff --git a/crates/oxc_linter/src/rules/eslint/no_setter_return.rs b/crates/oxc_linter/src/rules/eslint/no_setter_return.rs index b7dc351c97d75..8006839d4d6be 100644 --- a/crates/oxc_linter/src/rules/eslint/no_setter_return.rs +++ b/crates/oxc_linter/src/rules/eslint/no_setter_return.rs @@ -6,7 +6,9 @@ use oxc_span::Span; use crate::{AstNode, context::LintContext, rule::Rule}; fn no_setter_return_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Setter cannot return a value").with_label(span) + OxcDiagnostic::warn("Setter cannot return a value") + .with_help("Remove the return statement or ensure it does not return a value.") + .with_label(span) } #[derive(Debug, Default, Clone)] diff --git a/crates/oxc_linter/src/rules/eslint/no_undef.rs b/crates/oxc_linter/src/rules/eslint/no_undef.rs index 065b88ff7d461..a0f611bb5a75d 100644 --- a/crates/oxc_linter/src/rules/eslint/no_undef.rs +++ b/crates/oxc_linter/src/rules/eslint/no_undef.rs @@ -13,7 +13,11 @@ use crate::{ }; fn no_undef_diagnostic(name: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("'{name}' is not defined.")).with_label(span) + OxcDiagnostic::warn(format!("'{name}' is not defined.")) + .with_help(format!( + "Either define '{name}' or remove the reference to it. If '{name}' is a global variable, add it to the 'globals' configuration." + )) + .with_label(span) } #[derive(Debug, Default, Clone, JsonSchema, Deserialize)] diff --git a/crates/oxc_linter/src/rules/eslint/no_unreachable.rs b/crates/oxc_linter/src/rules/eslint/no_unreachable.rs index ff87565cef6e6..036d9fc937998 100644 --- a/crates/oxc_linter/src/rules/eslint/no_unreachable.rs +++ b/crates/oxc_linter/src/rules/eslint/no_unreachable.rs @@ -14,7 +14,9 @@ use oxc_span::{GetSpan, Span}; use crate::{context::LintContext, rule::Rule}; fn no_unreachable_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Unreachable code.").with_label(span) + OxcDiagnostic::warn("Unreachable code.") + .with_help("Remove the unreachable code or fix the control flow to make it reachable.") + .with_label(span) } /// diff --git a/crates/oxc_linter/src/snapshots/eslint_no_setter_return.snap b/crates/oxc_linter/src/snapshots/eslint_no_setter_return.snap index 074e874b1b3dc..3e99877622994 100644 --- a/crates/oxc_linter/src/snapshots/eslint_no_setter_return.snap +++ b/crates/oxc_linter/src/snapshots/eslint_no_setter_return.snap @@ -7,249 +7,291 @@ source: crates/oxc_linter/src/tester.rs 1 │ ({ set a(val){ return val + 1; } }) · ─────────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:17] 1 │ ({ set a(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:24] 1 │ class A { set a(val) { return 1; } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:31] 1 │ class A { static set a(val) { return 1; } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:23] 1 │ (class { set a(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:17] 1 │ ({ set a(val) { return val; } }) · ─────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:24] 1 │ class A { set a(val) { return undefined; } } · ───────────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:23] 1 │ (class { set a(val) { return null; } }) · ──────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:17] 1 │ ({ set a(val) { return x + y; } }) · ───────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:24] 1 │ class A { set a(val) { return foo(); } } · ───────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:23] 1 │ (class { set a(val) { return this._a; } }) · ─────────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:17] 1 │ ({ set a(val) { return this.a; } }) · ────────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:28] 1 │ ({ set a(val) { if (foo) { return 1; }; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:30] 1 │ class A { set a(val) { try { return 1; } catch(e) {} } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:57] 1 │ (class { set a(val) { while (foo){ if (bar) break; else return 1; } } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:17] 1 │ ({ set a(val) { return 1; }, set b(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:43] 1 │ ({ set a(val) { return 1; }, set b(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:24] 1 │ class A { set a(val) { return 1; } set b(val) { return 1; } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:49] 1 │ class A { set a(val) { return 1; } set b(val) { return 1; } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:23] 1 │ (class { set a(val) { return 1; } static set b(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:55] 1 │ (class { set a(val) { return 1; } static set b(val) { return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:27] 1 │ ({ set a(val) { if(val) { return 1; } else { return 2 }; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:46] 1 │ ({ set a(val) { if(val) { return 1; } else { return 2 }; } }) · ──────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:46] 1 │ class A { set a(val) { switch(val) { case 1: return x; case 2: return y; default: return z } } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:64] 1 │ class A { set a(val) { switch(val) { case 1: return x; case 2: return y; default: return z } } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:83] 1 │ class A { set a(val) { switch(val) { case 1: return x; case 2: return y; default: return z } } } · ──────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:62] 1 │ (class { static set a(val) { if (val > 0) { this._val = val; return val; } return false; } }) · ─────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:76] 1 │ (class { static set a(val) { if (val > 0) { this._val = val; return val; } return false; } }) · ───────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:27] 1 │ ({ set a(val) { if(val) { return 1; } else { return; }; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:46] 1 │ class A { set a(val) { switch(val) { case 1: return x; case 2: return; default: return z } } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:81] 1 │ class A { set a(val) { switch(val) { case 1: return x; case 2: return; default: return z } } } · ──────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:72] 1 │ (class { static set a(val) { if (val > 0) { this._val = val; return; } return false; } }) · ───────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:32] 1 │ ({ set a(val) { function b(){} return b(); } }) · ─────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:24] 1 │ class A { set a(val) { return () => {}; } } · ──────────────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:49] 1 │ (class { set a(val) { function b(){ return 1; } return 2; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:41] 1 │ ({ set a(val) { function b(){ return; } return 1; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:58] 1 │ class A { set a(val) { var x = function() { return 1; }; return 2; } } · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:50] 1 │ (class { set a(val) { var x = () => { return; }; return 2; } }) · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:33] 1 │ function f(){}; ({ set a(val) { return 1; } }); · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:44] 1 │ x = function f(){}; class A { set a(val) { return 1; } }; · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:40] 1 │ x = () => {}; A = class { set a(val) { return 1; } }; · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. ⚠ eslint(no-setter-return): Setter cannot return a value ╭─[no_setter_return.js:1:25] 1 │ return; ({ set a(val) { return 1; } }); return 2; · ───────── ╰──── + help: Remove the return statement or ensure it does not return a value. diff --git a/crates/oxc_linter/src/snapshots/eslint_no_undef.snap b/crates/oxc_linter/src/snapshots/eslint_no_undef.snap index b0ea008ef6286..41581043542fe 100644 --- a/crates/oxc_linter/src/snapshots/eslint_no_undef.snap +++ b/crates/oxc_linter/src/snapshots/eslint_no_undef.snap @@ -7,183 +7,214 @@ source: crates/oxc_linter/src/tester.rs 1 │ a = 1; · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'b' is not defined. ╭─[no_undef.tsx:1:9] 1 │ var a = b; · ─ ╰──── + help: Either define 'b' or remove the reference to it. If 'b' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'b' is not defined. ╭─[no_undef.tsx:1:16] 1 │ function f() { b; } · ─ ╰──── + help: Either define 'b' or remove the reference to it. If 'b' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'window' is not defined. ╭─[no_undef.tsx:1:1] 1 │ window; · ────── ╰──── + help: Either define 'window' or remove the reference to it. If 'window' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'require' is not defined. ╭─[no_undef.tsx:1:1] 1 │ require("a"); · ─────── ╰──── + help: Either define 'require' or remove the reference to it. If 'require' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:36] 1 │ var React; React.render(); · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:41] 1 │ var React, App; React.render(); · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:2] 1 │ [a] = [0]; · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:3] 1 │ ({a} = {}); · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:6] 1 │ ({b: a} = {}); · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'obj' is not defined. ╭─[no_undef.tsx:1:2] 1 │ [obj.a, obj.b] = [0, 1]; · ─── ╰──── + help: Either define 'obj' or remove the reference to it. If 'obj' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'obj' is not defined. ╭─[no_undef.tsx:1:9] 1 │ [obj.a, obj.b] = [0, 1]; · ─── ╰──── + help: Either define 'obj' or remove the reference to it. If 'obj' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'b' is not defined. ╭─[no_undef.tsx:1:28] 1 │ const c = 0; const a = {...b, c}; · ─ ╰──── + help: Either define 'b' or remove the reference to it. If 'b' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:20] 1 │ class C { static { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:31] 1 │ class C { static { { let a; } a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:40] 1 │ class C { static { { function a() {} } a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:47] 1 │ class C { static { function foo() { var a; } a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:38] 1 │ class C { static { var a; } static { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:38] 1 │ class C { static { let a; } static { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:46] 1 │ class C { static { function a(){} } static { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:37] 1 │ class C { static { var a; } foo() { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:37] 1 │ class C { static { let a; } foo() { a; } } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:30] 1 │ class C { static { var a; } [a]; } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:30] 1 │ class C { static { let a; } [a]; } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:39] 1 │ class C { static { function a() {} } [a]; } · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'a' is not defined. ╭─[no_undef.tsx:1:31] 1 │ class C { static { var a; } } a; · ─ ╰──── + help: Either define 'a' or remove the reference to it. If 'a' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'toString' is not defined. ╭─[no_undef.tsx:1:1] 1 │ toString() · ──────── ╰──── + help: Either define 'toString' or remove the reference to it. If 'toString' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'hasOwnProperty' is not defined. ╭─[no_undef.tsx:1:1] 1 │ hasOwnProperty() · ────────────── ╰──── + help: Either define 'hasOwnProperty' or remove the reference to it. If 'hasOwnProperty' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'r' is not defined. ╭─[no_undef.tsx:1:49] 1 │ export class Foo{ bar: notDefined; }; const t = r + 1; · ─ ╰──── + help: Either define 'r' or remove the reference to it. If 'r' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'arguments' is not defined. ╭─[no_undef.tsx:1:21] 1 │ const arrow = () => arguments; · ───────── ╰──── + help: Either define 'arguments' or remove the reference to it. If 'arguments' is a global variable, add it to the 'globals' configuration. ⚠ eslint(no-undef): 'arguments' is not defined. ╭─[no_undef.tsx:1:9] 1 │ var a = arguments; · ───────── ╰──── + help: Either define 'arguments' or remove the reference to it. If 'arguments' is a global variable, add it to the 'globals' configuration. diff --git a/crates/oxc_linter/src/snapshots/eslint_no_unreachable.snap b/crates/oxc_linter/src/snapshots/eslint_no_unreachable.snap index 8438db271af8d..0683c93d352f1 100644 --- a/crates/oxc_linter/src/snapshots/eslint_no_unreachable.snap +++ b/crates/oxc_linter/src/snapshots/eslint_no_unreachable.snap @@ -7,129 +7,151 @@ source: crates/oxc_linter/src/tester.rs 1 │ function foo() { return x; var x = 1; } · ────────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:28] 1 │ function foo() { return x; var x, y = 1; } · ───────────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:23] 1 │ while (true) { break; var x = 1; } · ────────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:26] 1 │ while (true) { continue; var x = 1; } · ────────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:26] 1 │ function foo() { return; x = 1; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:31] 1 │ function foo() { throw error; x = 1; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:23] 1 │ while (true) { break; x = 1; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:26] 1 │ while (true) { continue; x = 1; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:49] 1 │ function foo() { switch (foo) { case 1: return; x = 1; } } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:50] 1 │ function foo() { switch (foo) { case 1: throw e; x = 1; } } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:46] 1 │ while (true) { switch (foo) { case 1: break; x = 1; } } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:49] 1 │ while (true) { switch (foo) { case 1: continue; x = 1; } } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:27] 1 │ var x = 1; throw 'uh oh'; var y = 2; · ────────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:66] 1 │ function foo() { var x = 1; if (x) { return; } else { throw e; } x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:59] 1 │ function foo() { var x = 1; if (x) return; else throw -1; x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:56] 1 │ function foo() { var x = 1; try { return; } finally {} x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:57] 1 │ function foo() { var x = 1; try { } finally { return; } x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:55] 1 │ function foo() { var x = 1; do { return; } while (x); x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:70] 1 │ function foo() { var x = 1; while (x) { if (x) break; else continue; x = 2; } } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:59] 1 │ function foo() { var x = 1; for (;;) { if (x) continue; } x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:46] 1 │ function foo() { var x = 1; while (true) { } x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable. ⚠ eslint(no-unreachable): Unreachable code. ╭─[no_unreachable.tsx:1:50] 1 │ function foo() { var x = 1; do { } while (true); x = 2; } · ────── ╰──── + help: Remove the unreachable code or fix the control flow to make it reachable.