Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 493 Bytes

no-static-only-class.md

File metadata and controls

48 lines (37 loc) · 493 Bytes

Forbid classes that only have static members

A class with only static members could just be an object instead.

This rule is partly fixable.

Fail

class X {
	static foo = false;
	static bar() {};
}

Pass

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() {}
}