Skip to content

linter: unicorn/catch-error-name #12430

@Viper-Bit

Description

@Viper-Bit

What version of Oxlint are you using?

1.7.0

What command did you run?

oxlint --max-warnings=0

What does your .oxlintrc.json config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "rules": {
    "unicorn/catch-error-name": [
      "error",
      {
        "ignore": [
          "^error\\d*$"
        ]
      }
    ]
  }
}

What happened?

oxlint complains with eslint-plugin-unicorn(catch-error-name): The catch parameter "error2" should be named "error" with code bellow

try {
  // some codes
} catch (error2: unknown) {
  // some codes
}

this makes problem in nested try { } catch { }

try {
  // some codes
} catch (error: unknown) {
  try {
    // some codes
  } catch (error2: unknown) {
    // some codes
  }
}

unicorn in eslint auto fix this by appending _ to the second catch error name (https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md#tip) that still not works in oxlint and erros with eslint-plugin-unicorn(catch-error-name): The catch parameter "error_" should be named "error"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions