named-constant-boundaries
an incoming string cast into the union at a boundary instead of validated into it
Agent checkadvisory by defaultbasecode
The argument
Boundaries
At boundaries (JSON payloads, query params, DB values) incoming strings are not yet the union — convert with a small validation function (e.g., parseAction), never with an as cast.
The proof
failsrc/actions/readAction.ts
import type { Action } from '../common/constants/Action';
// The query string is not the union yet, and the cast says it is — an unknown
// value now travels as a checked one.
export const readAction = ({ query }: { query: Record<string, string> }): Action => query.action as Action;
passsrc/actions/parseAction.ts
import { Action } from '../common/constants/Action';
// The boundary is where the string becomes the union, and a validation function
// is what makes that true.
export const parseAction = ({ value }: { value: string }): Action | undefined =>
Object.values(Action).find((member) => member === value);
Turn it down
Both lines go in your lightsout.config.json.
"standards-checks": { "named-constant-boundaries": "advisory" }"standards-checks": { "named-constant-boundaries": "off" }