chore(linter) convert catch error name to a warning (#1700)

This commit is contained in:
Cameron 2023-12-16 17:52:26 +00:00 committed by GitHub
parent c61ea76b73
commit f4f0bdf74a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 15 deletions

View file

@ -14,6 +14,7 @@ use crate::{context::LintContext, rule::Rule, AstNode};
#[derive(Debug, Error, Diagnostic)]
#[error("eslint-plugin-unicorn(catch-error-name): The catch parameter {0:?} should be named {1:?}")]
#[diagnostic(severity(warning))]
struct CatchErrorNameDiagnostic(Atom, Atom, #[label] pub Span);
#[derive(Debug, Clone)]

View file

@ -2,91 +2,91 @@
source: crates/oxc_linter/src/tester.rs
expression: catch_error_name
---
× eslint-plugin-unicorn(catch-error-name): The catch parameter "descriptiveError" should be named "exception"
eslint-plugin-unicorn(catch-error-name): The catch parameter "descriptiveError" should be named "exception"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (descriptiveError) { }
· ────────────────
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "has_space_after "
eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "has_space_after "
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (e) { }
· ─
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "1_start_with_a_number"
eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "1_start_with_a_number"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (e) { }
· ─
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "_){ } evilCode; if(false"
eslint-plugin-unicorn(catch-error-name): The catch parameter "e" should be named "_){ } evilCode; if(false"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (e) { }
· ─
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (notMatching) { }
· ───────────
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (notMatching) { }
· ───────────
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (notMatching) { }
· ───────────
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "_" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "_" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ try { } catch (_) { console.log(_) }
· ─
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "notMatching" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.catch(notMatching => { })
· ───────────
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.catch((foo) => { })
· ───
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.catch(function (foo) { })
· ───
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.catch((function (foo) { }))
· ───
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.then(function (foo) { }).catch((foo) => { })
· ───
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.then(undefined, function (foo) { })
· ───
╰────
× eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
eslint-plugin-unicorn(catch-error-name): The catch parameter "foo" should be named "error"
╭─[catch_error_name.tsx:1:1]
1 │ promise.then(undefined, (foo) => { })
· ───