Skip to content

Naming ​

Casing (@typescript-eslint/naming-convention) ​

ElementFormExample
function, local variable, parametercamelCasefilletSetback, interiorAngle
module constant (top-level const)UPPER_CASESVG_DECIMALS, CLOSE_PATH
type, aliasPascalCasePoint, ViewBox
boolean (variable, parameter)prefix + PascalCaseisClosed, hasPorts, canConnect

Boolean prefixes: is, has, can, should, are, was, will, did, does.

Length (id-length) ​

2 to 40 characters. Single letters are reserved for standard mathematical variables: a b c d h i j k n p q r s t u v w x y z.

Denied names (id-denylist) ​

tmp, temp, info, obj, val, res, ret, stuff, thing, util(s), helper(s), manager, foo, bar, baz: they name no concept.

Per kind (local/kind-naming) ​

@kindRuleGoodRejected
procedurestarts with a verb from eslint/settings/verbs.tsrenderShape, mountPlaygroundshapeRenderer
formatreads as a conversion: xToY, toX, fromX, parseX, formatX, serializeX…polygonToPathDatasvgPath
math, geometry, domainnames the concept, without vague verb (get, compute, calculate, calc, make, do, handle, process, perform)dot, filletSetbackcomputeDot, getSetback
allreturns a boolean ⇔ starts with a predicate word (is, has, can, should, are, contains, includes, intersects, equals)canConnectconnectable(): boolean, isPort(): Port

To add a procedure verb: insert it (sorted) in eslint/settings/verbs.ts rather than bending a name.

Files ​

The file is named like its export (see files.md).