no-static-only-class
March 27, 2026 ยท View on GitHub
๐ Disallow classes that only have static members.
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ง This rule is automatically fixable by the --fix CLI option.
A class with only static members could just be an object instead.
Examples
// โ
class X {
static foo = false;
static bar() {};
}
// โ
const X = {
foo: false,
bar() {},
};
// โ
class X {
static foo = false;
static bar() {}
constructor() {}
}
// โ
class X {
static foo = false;
static bar() {}
unicorn() {}
}
// โ
class X {
static #foo = false;
static bar() {}
}