Choose names that clearly reveal the purpose and behavior of variables, functions, and methods. Names should be self-documenting and follow these patterns:
is
, has
, or should
prefixes (e.g., isInitialBuildSuccessful
instead of diagnostics
)loadStorybookInfo()
instead of storybookInfo
)before, after
instead of a, b
)"initializes"
instead of "should initialize"
)Example improvements:
// Before
const diagnostics: boolean
async get storybookInfo()
function percentageDiff(a: number, b: number)
// After
const diagnosticsEnabled: boolean
async loadStorybookInfo()
function percentageDiff(before: number, after: number)
Well-named code reduces the need for comments and makes the codebase more maintainable by clearly communicating intent to other developers.
Enter the URL of a public GitHub repository