no-catch-shadow
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-catch-shadow": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
Disallow catch clause parameters from shadowing variables in the outer scope
var err = "x";
try {
throw "problem";
} catch (err) {
}
function error() {
// ...
};
try {
throw "problem";
} catch (error) {
}var err = "x";
try {
throw "problem";
} catch (e) {
}
function error() {
// ...
};
try {
throw "problem";
} catch (e) {
}Examples from the ESLint documentation.
no-catch-shadow
eslint
export default [
{
rules: {
"no-catch-shadow": "error",
},
},
];Oxlint does not have this rule.
suspicious/noShadow
suspicious · since 2.0.0
{
"linter": {
"rules": {
"suspicious": {
"noShadow": "error"
}
}
}
}Disallow equal signs explicitly at the beginning of regular expressions
Disallow calls to the Object constructor without an argument
Enforce a maximum depth that callbacks can be nested
Enforce a maximum cyclomatic complexity allowed in a program
Enforce the use of u or v flag on regular expressions
Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn()