unicorn/catch-error-name
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/catch-error-name": "error",
},
},
];try {} catch (badName) {}promise.catch(badName => {});promise.then(undefined, badName => {});try {} catch (error) {}promise.catch(error => {});promise.then(undefined, error => {});Examples from the ESLint documentation.
unicorn/catch-error-name
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/catch-error-name": "error",
},
},
];unicorn/catch-error-name
unicorn plugin · style
{
"rules": {
"unicorn/catch-error-name": "error"
}
}nursery/useCatchErrorName
nursery · since 2.6.7
{
"linter": {
"rules": {
"nursery": {
"useCatchErrorName": "error"
}
}
}
}Enforce consistent case for text encoding identifiers.
Disallow immediate mutation after assignment and initialization immediately after declaration.
Require non-empty specifier list in import and export statements.
Enforce consistent assertion style with node:assert.
Require non-empty module attributes for imports and exports
Enforce consistent style for escaping ${ in template literals.