Why this matters
Reduces redundant computation and churn.
For pure functions called repeatedly with the same inputs, memoize results; avoid recreating identical callbacks in hot paths.
Reduces redundant computation and churn.
Side-by-side examples engineers can pattern-match during review.
list.forEach(x => expensive(x));const memo=(fn)=>{const m=new Map();return (x)=>m.has(x)?m.get(x):(m.set(x,fn(x)),m.get(x))}; const f=memo(expensive); list.forEach(f);arr.map(expensive)const f=memo(expensive); arr.map(f)From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.