unicorn/no-accessor-recursion
eslint-plugin-unicorn
No autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-accessor-recursion": "error",
},
},
];Disallow recursive access to this within getters and setters.
const foo = {
get bar() {
return this.bar;
}
};class Foo {
get bar() {
return this.bar;
}
}const foo = {
set bar(value) {
this.bar = value;
}
};const foo = {
get bar() {
return this.baz;
}
};class Foo {
get bar() {
return this.baz;
}
}const foo = {
set bar(value) {
this._bar = value;
}
};Examples from the ESLint documentation.
unicorn/no-accessor-recursion
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-accessor-recursion": "error",
},
},
];unicorn/no-accessor-recursion
unicorn plugin · suspicious
{
"rules": {
"unicorn/no-accessor-recursion": "error"
}
}Biome does not have this rule.
Enforce specifying rules to disable in eslint-disable comments.
Disallow anonymous functions and classes as the default export.
Enforce or disallow explicit delay argument for setTimeout() and setInterval().
Disallow using reference values as Array#fill() values.
Enforce consistent style for element existence checks with indexOf(), lastIndexOf(), findIndex(), and findLastIndex().
Disallow using the this argument in array methods.