Skip to content

Rule Matrix

This page maps each enforced selector to the naming format.

AreaSelectorWhat it targetsEnforced
Variablesvariablelocals/consts/etcvaries by modifiers/types
Abbreviationsvariable / function / parameterall identifiersbans common abbreviations (e.g., str, arr, obj)
Typesclass / interface / typeAlias / enumtype namesPascalCase (+ extra rules)
Type ParameterstypeParametergeneric type parametersSingle letters (T, U, V) or prefixed (TData, KKey)
Functionsfunctionfunction declarationsfinal camelCase enforcement
Parametersparameterfunction paramscamelCase, snake_case, _ allowed
MembersmemberLikeclass fields/methods/accessorsvaries by modifiers
EnumsenumMembermembersUPPER_CASE
Object literalsobjectLiteralProperty{ fooBar: 1 }camelCase, snake_case, PascalCase, UPPER_CASE
Quoted keysrequiresQuotes"Content-Type" etcignored (format: null)

Jump to details:

Quick Examples

Here are some quick examples of correct and incorrect naming according to the eslint-config-naming rules.

✅ Good

ts
// Types
class User {}
interface ApiResponse {}
enum Status {
  ACTIVE,
  INACTIVE,
}

// Members
class Example {
  public myProperty: string;
  private myPrivateProperty: string;
  protected myProtectedProperty: string;
  public static MyStaticProperty: number;
  private static myStaticPrivate: string;
  public readonly myReadonly: boolean;
  private readonly MY_READONLY_CONSTANT: number;
}

// Variables
const myVariable = 'value';
const MY_CONSTANT = 'constant';
const isReady = true;

// Functions
function myFunction() {}

// Parameters
function example(param1: string, param2: number, callback: () => void) {}

export type Cache<TKey, TValue> = Map<TKey, TValue>;

// Abbreviation examples - descriptive names
const errorMessage = 'Failed to connect';

function processUserData() {}

function handleRequest(requestData: Request, onComplete: () => void) {}

❌ Bad

ts
// Types - should be PascalCase, no I/T prefixes
class user {}
interface IApiResponse {}
enum status {
  active,
  inactive,
}

// Members - various violations
class Example {
  public MyProperty: string; // should be camelCase or snake_case
  private _myPrivateProperty: string; // no leading _ for private
  protected myProtectedProperty: string; // protected needs leading _
  public static myStaticProperty: number; // can be camelCase, PascalCase, or UPPER_CASE
  private static _myStaticPrivate: string; // no leading _ for private static
  public readonly MyReadonly: boolean; // should be camelCase or UPPER_CASE
  private readonly my_readonly_constant: number; // should be camelCase or UPPER_CASE
}

// Variables - case and boolean prefix violations
const Myvariable = 'value'; // should be camelCase or UPPER_CASE
const my_constant = 'constant'; // should be UPPER_CASE
const ready = true; // booleans should start with is|should|has|can|did|will

// Functions - case violations
function MyFunction() {
} // should be camelCase

// Parameters - case violations
function example(Param1: string, Param2: number, Callback: () => void) {
} // should be camelCase

export type Cache<Key, val> = Map<Key, val>; // generics should follow T, U, V, TItem, TValue, etc.

// Abbreviation examples - banned abbreviations
const str = 'Failed to connect';

function processStr() {}

function process(req: Request, res: Response) {}