n/handle-callback-err
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/handle-callback-err": "error",
},
},
];function loadData (err, data) {
doSomething();
}function loadData (err, data) {
if (err) {
console.log(err.stack);
}
doSomething();
}
function generateError (err) {
if (err) {}
}function loadData (error, data) {
if (error) {
console.log(error.stack);
}
doSomething();
}Examples from the ESLint documentation.
n/handle-callback-err
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/handle-callback-err": "error",
},
},
];node/handle-callback-err
node plugin · restriction
{
"plugins": [
"node"
],
"rules": {
"node/handle-callback-err": "error"
}
}Biome does not have this rule.
Disallow new operators with calls to require
Enforce Node.js-style error-first callback pattern is followed
Disallow require() expressions which import private modules
Disallow import declarations which import private modules
Disallow require() expressions which import missing modules