explicit-member-accessibility
Require accessibility modifiers for class members except `#` private members.
- Rule ID:
tai-kun/explicit-member-accessibility - Auto-fix: No
Requires one of public / protected / private for class members except # private members. Applies to all fields, methods, and accessors, including constructors.
Configuration
Add the rule to lint.rules in vite.config.ts to enable it.
"tai-kun/explicit-member-accessibility": "error",
Examples
Invalid
class Service {
value = 1;
constructor() {}
run() {}
}
Valid
class Service {
public value = 1;
#internal = 0;
public constructor() {}
public run() {}
protected stop() {}
private reset() {}
}
Notes
- This rule reports only; it does not auto-fix.
#private fields and methods are ignored (they cannot have a modifier).staticblocks and index signatures are ignored.- Plain constructor parameters are ignored. Parameter properties with only
readonlyare reported (writepublic readonlyinstead). - Getters, setters, and
accessorproperties are checked.