Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Don't log data that a later line already shows
Drop summary log lines whose information is already contained in a subsequent, more detailed log output.
Bad example
| 1 | console.log(`Affected paths: ${[...paths].join(', ')}`); |
| 2 | console.log(`Env filter: ${[...envs].join(', ')}`); |
| 3 | // ... |
| 4 | for (const m of matches) { |
| 5 | console.log(` [${m.env}] ${m.title} (${m.path})`); // repeats paths + envs |
| 6 | } |
Explanation (EN)
The per-match loop already prints each path and env, so the upfront summary lines just duplicate that information and clutter the output.
Objašnjenje (HR)
Petlja po podudaranjima vec ispisuje svaki path i env, pa pocetne sazete linije samo dupliciraju te informacije i zatrpavaju ispis.
Good example
| 1 | for (const m of matches) { |
| 2 | console.log(` [${m.env}] ${m.title} (${m.path})`); |
| 3 | } |
Explanation (EN)
Let the detailed output be the single source of that information. Keep only logs that add something the other lines don't.
Objašnjenje (HR)
Neka detaljni ispis bude jedini izvor te informacije. Zadrzi samo logove koji dodaju nesto sto ostale linije ne pokrivaju.