no-constructor-return
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-constructor-return": "error",
},
},
];class A {
constructor(a) {
this.a = a;
return a;
}
}
class B {
constructor(f) {
if (!f) {
return 'falsy';
}
}
}class C {
constructor(c) {
this.c = c;
}
}
class D {
constructor(f) {
if (!f) {
return; // Flow control.
}
f();
}
}
class E {
constructor() {
return;
}
}Examples from the ESLint documentation.
no-constructor-return
eslint
export default [
{
rules: {
"no-constructor-return": "error",
},
},
];no-constructor-return
eslint plugin · pedantic
{
"rules": {
"no-constructor-return": "error"
}
}correctness/noConstructorReturn
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"noConstructorReturn": "error"
}
}
}
}Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
Disallow variable or function declarations in nested blocks
Require template literals instead of string concatenation
Disallow the use of Math.pow in favor of the ** operator
Disallow unnecessary calls to .call() and .apply()
Enforce the use of the radix argument when using parseInt()