naming-for-reuse
a name that says where a value is used rather than what it is
Agent checkadvisory by defaultbasecode
The argument
Naming for Reuse
Name things by what they ARE, never by where or how they're currently used. The test: could someone use this elsewhere in the app without the name misleading them?
| Category | ❌ Context-specific | ✅ Generic, reusable |
|---|---|---|
| Value constants | heroMaxWidth | maxContentWidth |
| Utils | formatPricingDate() | formatDate() |
| Named constants | HeroButtonVariant | ButtonVariant |
| Components | PricingPageCard | PlanCard |
| Types | PricingPageProps | PlanCardProps |
Applies to everything you extract or create. A truly feature-specific value may keep a scoped name — but default to generic: narrowing later is free; renaming a widely-used token is expensive.
The proof
failsrc/common/utils/formatPricingDate.ts
// Named for the one screen that happens to call it today.
export const formatPricingDate = ({ date }: { date: Date }): string => date.toISOString();
passsrc/common/utils/formatDate.ts
// Named for what it does, so the pricing page is not the only place it fits.
export const formatDate = ({ date }: { date: Date }): string => date.toISOString();
Turn it down
Both lines go in your lightsout.config.json.
"standards-checks": { "naming-for-reuse": "advisory" }"standards-checks": { "naming-for-reuse": "off" }