oxc/branches-sharing-code
oxc plugin · pedantic
{
"rules": {
"oxc/branches-sharing-code": "error"
}
}Checks if the if and else blocks contain shared code that can be moved out of the blocks.
if (condition) {
console.log("Hello");
return 13;
} else {
console.log("Hello");
return 42;
};
if (condition) {
doSomething();
cleanup();
} else {
doSomethingElse();
cleanup();
}console.log("Hello");
if (condition) {
return 13;
} else {
return 42;
};
if (condition) {
doSomething();
} else {
doSomethingElse();
}
cleanup();Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/branches-sharing-code
oxc plugin · pedantic
{
"rules": {
"oxc/branches-sharing-code": "error"
}
}nursery/noSharedBranchCode
nursery · since 2.6.6
{
"linter": {
"rules": {
"nursery": {
"noSharedBranchCode": "error"
}
}
}
}This rule applies when bitwise operators are used where logical operators are expected.
Disallows the use of approximate constants, instead preferring the use of the constants in the Math object.
Https://rust-lang.github.io/rust-clippy/master/#/misrefactored_assign_op
Prevents using object or array spreads on accumulators in Array.prototype.reduce() and in loops.
Disallows the use of async functions as Express endpoint handlers.
Disallow the use of barrel files where the file contains export * statements, and the total number of modules exceeds a threshold.