ESLint Plugin for TypeScript

Explicit Access
Modifiers

Enforce explicit public, protected, and private modifiers on all TypeScript class members.

UserService.ts
// Intent is always clear
class UserService {
  public getCurrentUser() { }    // Public API
  protected validateUser() { }  // For subclasses
  private cache: Map;           // Implementation detail
}

Two Powerful Rules

Catch accessibility issues before they become problems

explicit-member-accessibility

Requires explicit accessibility modifiers on all class members. No more accidentally public APIs.

// ❌ Error: Missing accessibility
name: string;

// ✅ Explicit and clear
public name: string;

member-accessibility-order

Enforces consistent ordering: public → protected → private. Makes classes easier to navigate.

// ✅ Correct order
public api() { }
protected hook() { }
private impl() { }

Quick Installation

Get up and running in under a minute

1

Install the package

pnpm add -D @pegasusheavy/eslint-typescript-access
2

Add to your ESLint config

// eslint.config.js
import tsAccess from "@pegasusheavy/eslint-typescript-access";

export default [
  tsAccess.configs.recommended,
  // ... your other configs
];

You're all set!

ESLint will now enforce explicit access modifiers and proper ordering on all your TypeScript classes.

Why Explicit Modifiers?

TypeScript defaults to public, but implicit isn't always better

Clear Intent

Is a member public intentionally or by accident? Explicit modifiers make intent obvious.

API Safety

Prevent private implementation details from accidentally becoming part of your public API.

Better Reviews

Code reviewers can immediately see accessibility intent without checking surrounding context.