Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: JavaScript
dependenciesbundle-sizedatesmodernization
Prefer a modern lightweight date library over heavy legacy ones
Avoid large legacy date libraries like moment for new code; choose a small modern alternative (e.g. dayjs/date-fns) to keep bundles lean.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | import moment from 'moment'; |
| 2 | const label = moment(date).format('LL'); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | import dayjs from 'dayjs'; |
| 2 | const label = dayjs(date).format('LL'); |
Explanation (EN)
Objašnjenje (HR)