A note on naming things
Every word of this post was written by a person.
A good name answers the question the reader was about to ask. A bad one makes them open the file.
Three tests
- Could it mean something else? If a name fits two things, it describes neither.
- Does it say what the thing is, not what it is near?
userHelperis near users;formatUserNameis a thing. - Would a stranger place it? Read the name out of context. If it needs the folder to make sense, it is not finished.
// before
const data = await get(id)
// after
const invoice = await fetchInvoice(id)
Renaming is cheap early and expensive late — a published API name is forever.