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.

Notes:
TS Only Has Fixer

Config

These arguments may be optionally provided:

  • "no-public" forbids public accessibility to be specified, because this is the default.
  • "check-accessor" enforces explicit visibility on get/set accessors
  • "check-constructor" enforces explicit visibility on constructors
Examples
"member-access": true
"member-access": [true, "no-public"]
"member-access": [true, "check-accessor"]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "no-public",
      "check-accessor",
      "check-constructor"
    ]
  },
  "minLength": 0,
  "maxLength": 3
}