Functions
Give each named operation a declaration and a contract that explains what it consumes and produces.
Declaration and contract
Why
Selection, hashing, and project writes are different jobs. Keeping them separate makes workflows readable without making a caller memorize several positional strings.
Rules
MUST declare named helpers, handlers, factories, components, and exported operations withfunction.[review]
MAY express inline or returned callbacks with arrows.[review]
MAY assign a composition result to aconstbinding.[review]
MUST annotate the return contract of every exported function.[review]
MUST replace two or more authored parameters with one destructured object parameter.[review]
MUST give that object's named type aParamsorOptionssuffix.[review]
MAY use the callback signature required by an external framework.[review]
MUST separate distinct jobs into functions and let the caller coordinate them.[review]
Example
Focused examples leave out JSDoc unless they demonstrate it. The JSDoc contract still applies to authored source.
[review]
Typechecks establish signature use. Review checks declaration style, named inputs, and single responsibility unless a consumer configures additional lint rules.
Enforcement
Typechecks establish signature use. Review checks declaration style, named inputs, and single responsibility unless a consumer configures additional lint rules.