Rule: member-access

Requires explicit visibility declarations for class members.

Rationale

Explicit visibility declarations can make code more readable and accessible for those new to TS.

Config

Two arguments may be optionally provided:

  • "check-accessor" enforces explicit visibility on get/set accessors (can only be public)
  • "check-constructor" enforces explicit visibility on constructors (can only be public)
Examples
"member-access": true
"member-access": [true, "check-accessor"]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-accessor",
      "check-constructor"
    ]
  },
  "minLength": 0,
  "maxLength": 2
}