Choose names that clearly and unambiguously describe their purpose rather than being overly generic or technical. Names should be self-documenting and immediately convey what the entity does or represents.
Key principles:
MAX_ANIMATION_DURATION
instead of ANIMATION_TIMEOUT
IgnoreUnknownProps
instead of DeepStripStringIndexUnknown
trackClasses
instead of addClasses
(which implies DOM manipulation)Examples:
// ❌ Generic or misleading names
const ANIMATION_TIMEOUT = 4000;
export type DeepStripStringIndexUnknown<T> = ...;
addClasses(details: AnimationDetails, classes: string[]): void;
// ✅ Descriptive and clear names
const MAX_ANIMATION_DURATION = 4000;
export type IgnoreUnknownProps<T> = ...;
trackClasses(details: AnimationDetails, classes: string[]): void;
Avoid names that could confuse developers about the actual functionality. When in doubt, err on the side of being more descriptive rather than more concise.
Enter the URL of a public GitHub repository