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 ruleP2stack specificStack: javascript
bundle-sizelodashimportsperformance
Import individual lodash functions rather than the whole library
Import only the lodash functions you use so bundlers can tree-shake instead of pulling in all of lodash.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codejavascript
| 1 | import _ from 'lodash'; |
| 2 | _.debounce(fn, 200); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | import debounce from 'lodash/debounce'; |
| 2 | debounce(fn, 200); |
Explanation (EN)
Objašnjenje (HR)