props-union-exemption
a domain value claiming the props exemption while it also appears in domain logic
Agent checkadvisory by defaultbasecode
The argument
Exemption — component prop unions. A UI component's discriminated Props union may use raw string-literal discriminants (status: 'notInstalled' | 'connected'): the caller writes the literal once as a JSX attribute, which is idiomatic React and reads better than a constant import. The rule above targets domain values that cross module boundaries and get narrowed at many call sites. If the same discriminant values also appear in domain logic, they are domain values — use the const object everywhere, props included.
The proof
fail
// The literals cross a module boundary and get narrowed here as well, which is
// what makes them domain values rather than a prop vocabulary.
export const getInstallState = ({ token }: { token: string | null }): 'notInstalled' | 'connected' => (token === null ? 'notInstalled' : 'connected');
passsrc/install/InstallPanel.tsx
interface Props {
tone: 'quiet' | 'loud';
}
// The values exist only as this component's prop vocabulary — written once as a
// JSX attribute and narrowed nowhere else.
export const InstallPanel = ({ tone }: Props) => <p className={tone}>Install</p>;
Turn it down
Both lines go in your lightsout.config.json.
"standards-checks": { "props-union-exemption": "advisory" }"standards-checks": { "props-union-exemption": "off" }