diff --git a/crates/oxc_linter/src/rules/eslint/no_ex_assign.rs b/crates/oxc_linter/src/rules/eslint/no_ex_assign.rs index cc5017ed1..8a74c706d 100644 --- a/crates/oxc_linter/src/rules/eslint/no_ex_assign.rs +++ b/crates/oxc_linter/src/rules/eslint/no_ex_assign.rs @@ -10,7 +10,7 @@ use crate::{context::LintContext, rule::Rule}; #[derive(Debug, Error, Diagnostic)] #[error("eslint(no-ex-assign): Do not assign to the exception parameter.")] -#[diagnostic(severity(warning))] +#[diagnostic(severity(warning), help("If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive."))] struct NoExAssignDiagnostic(#[label] pub Span); #[derive(Debug, Default, Clone)] diff --git a/crates/oxc_linter/src/rules/unicorn/no_new_array.rs b/crates/oxc_linter/src/rules/unicorn/no_new_array.rs index 56b112b1c..246ba1b49 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_new_array.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_new_array.rs @@ -37,7 +37,7 @@ declare_oxc_lint!( /// const array = [42]; /// ``` NoNewArray, - correctness + suspicious ); impl Rule for NoNewArray { diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs b/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs index 5ef2ec7c8..58298dfc6 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs @@ -39,7 +39,7 @@ declare_oxc_lint!( /// foo.addEventListener('click', () => {}); /// ``` PreferAddEventListener, - correctness + suspicious ); impl Rule for PreferAddEventListener { diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_date_now.rs b/crates/oxc_linter/src/rules/unicorn/prefer_date_now.rs index 8b79445b2..5f6c24b62 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_date_now.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_date_now.rs @@ -53,7 +53,7 @@ declare_oxc_lint!( /// const ts = Date.now(); /// ``` PreferDateNow, - correctness + pedantic ); impl Rule for PreferDateNow { diff --git a/crates/oxc_linter/src/snapshots/no_ex_assign.snap b/crates/oxc_linter/src/snapshots/no_ex_assign.snap index 61ef66c06..63ada3a46 100644 --- a/crates/oxc_linter/src/snapshots/no_ex_assign.snap +++ b/crates/oxc_linter/src/snapshots/no_ex_assign.snap @@ -7,29 +7,39 @@ expression: no_ex_assign 1 │ try { } catch (e) { e = 10; } · ─ ╰──── + help: If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is + no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive. ⚠ eslint(no-ex-assign): Do not assign to the exception parameter. ╭─[no_ex_assign.tsx:1:1] 1 │ try { } catch (ex) { ex = 10; } · ── ╰──── + help: If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is + no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive. ⚠ eslint(no-ex-assign): Do not assign to the exception parameter. ╭─[no_ex_assign.tsx:1:1] 1 │ try { } catch (ex) { [ex] = []; } · ── ╰──── + help: If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is + no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive. ⚠ eslint(no-ex-assign): Do not assign to the exception parameter. ╭─[no_ex_assign.tsx:1:1] 1 │ try { } catch (ex) { ({x: ex = 0} = {}); } · ── ╰──── + help: If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is + no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive. ⚠ eslint(no-ex-assign): Do not assign to the exception parameter. ╭─[no_ex_assign.tsx:1:1] 1 │ try { } catch ({message}) { message = 10; } · ─────── ╰──── + help: If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it is impossible to refer to the error from that point on. Since there is + no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive.