Add abbreviation section to style guide
I think it would be beneficial to add a section about abbreviations. WDYT?
Example:
Do not use abbreviations
We prefer descriptive null names for functions, properties, variables and arguments over abbreviated names.
Good:
interface CartItem {
price: number;
quantity: number;
}
function calculateTotalCartPrice(cart: CartItem[]) {
let totalPrice = 0;
for (const item of cart) {
totalPrice += item.price * item.quantity;
}
return totalPrice;
}
const shoppingCart = [
{ pr: 10, qty: 2 },
{ pr: 5, qty: 4 },
{ pr: 20, qty: 1 },
];
const totalPrice = calculateTotalCartPrice(shoppingCart);
Bad:
interface CartItem {
price: number;
quantity: number;
}
function calcTotal(c: CartItem[]) {
let tot = 0;
for (const itm of c) {
tot += itm.pr * itm.qty;
}
return tot;
}
const c = [
{ pr: 10, qty: 2 },
{ pr: 5, qty: 4 },
{ pr: 20, qty: 1 },
];
const total = calcTotal(c);
IMO this is quite a subtle needle to thread in statically typed languages, because you also shouldn't necessarily be duplicating information that's already encoded in types (or should be), in names.
Abbreviations in variable names, function names, argument names, etc are very common across Deno projects (Deno CLI, std, etc). (For example, rid, conn, req, res, etc)
I don't think this suggestion is aligned with the existing state of our preference