Rule Matrix
This page maps each enforced selector to the naming format.
| Area | Selector | What it targets | Enforced |
|---|---|---|---|
| Variables | variable | locals/consts/etc | varies by modifiers/types |
| Abbreviations | variable / function / parameter | all identifiers | bans common abbreviations (e.g., str, arr, obj) |
| Types | class / interface / typeAlias / enum | type names | PascalCase (+ extra rules) |
| Type Parameters | typeParameter | generic type parameters | Single letters (T, U, V) or prefixed (TData, KKey) |
| Functions | function | function declarations | final camelCase enforcement |
| Parameters | parameter | function params | camelCase, snake_case, _ allowed |
| Members | memberLike | class fields/methods/accessors | varies by modifiers |
| Enums | enumMember | members | UPPER_CASE |
| Object literals | objectLiteralProperty | { fooBar: 1 } | camelCase, snake_case, PascalCase, UPPER_CASE |
| Quoted keys | requiresQuotes | "Content-Type" etc | ignored (format: null) |
Jump to details:
- Variables
- Abbreviation Restrictions
- Types
- Functions
- Parameters
- Member-like overview
- Object literal properties
- Quoted members
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) {}