no-unsafe-finally
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-unsafe-finally": "error",
},
},
];let foo = function() {
try {
return 1;
} catch(err) {
return 2;
} finally {
return 3;
}
};let foo = function() {
try {
return 1;
} catch(err) {
return 2;
} finally {
throw new Error;
}
};let foo = function() {
try {
return 1;
} catch(err) {
return 2;
} finally {
console.log("hola!");
}
};let foo = function() {
try {
return 1;
} catch(err) {
return 2;
} finally {
let a = function() {
return "hola!";
}
}
};let foo = function(a) {
try {
return 1;
} catch(err) {
return 2;
} finally {
switch(a) {
case 1: {
console.log("hola!")
break;
}
}
}
};Examples from the ESLint documentation.
no-unsafe-finally
eslint
export default [
{
rules: {
"no-unsafe-finally": "error",
},
},
];no-unsafe-finally
eslint plugin · correctness
{
"rules": {
"no-unsafe-finally": "error"
}
}correctness/noUnsafeFinally
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"noUnsafeFinally": "error"
}
}
}
}Disallow characters which are made with multiple code points in character class syntax
Disallow unnecessary catch clauses
Disallow comparing against -0
Require generator functions to contain yield
Disallow using an async function as a Promise executor