consistent-this
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"consistent-this": "error",
},
},
];Enforce consistent naming when capturing the current execution context
let that = 42;
let self = this;
that = 42;
self = this;let that;
function f() {
that = this;
}let that = this;
const self = 42;
let foo;
that = this;
foo.bar = this;let that;
that = this;let foo = 42, that;
that = this;Examples from the ESLint documentation.
consistent-this
eslint
export default [
{
rules: {
"consistent-this": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow use of this in contexts where the value of this is undefined
Enforce a maximum depth that blocks can be nested
Enforce a maximum number of lines per file
Enforce a maximum number of parameters in function definitions
Require variables within the same declaration block to be sorted
Disallow shorthand type conversions