Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
class A {
foo() {
console.log("Hello World"); /* error Expected 'this' to be used by class method 'foo'. */
}
}class A {
foo() {
this.bar = "Hello World"; // OK, `this` is used
}
}
class B {
constructor() {
// OK. constructor is exempt
}
}
class C {
static foo() {
// OK. static methods aren't expected to use this.
}
static {
// OK. static blocks are exempt.
}
}Popular · 1 of 50
Enforce that class methods utilize this
class A {
foo() {
console.log("Hello World"); /* error Expected 'this' to be used by class method 'foo'. */
}
}class A {
foo() {
this.bar = "Hello World"; // OK, `this` is used
}
}
class B {
constructor() {
// OK. constructor is exempt
}
}
class C {
static foo() {
// OK. static methods aren't expected to use this.
}
static {
// OK. static blocks are exempt.
}
}