Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Design hook inputs for semantics and lintability
Design hook inputs for their semantics and lintability; expose dependency arrays only for intentional low-level wrappers.
Bad example
| 1 | function usePaginatedOptions({ resetKey }: { resetKey: string }) { ... } |
Explanation (EN)
A single reset key can obscure several independent triggers when the hook is deliberately a low-level effect wrapper.
Objašnjenje (HR)
Good example
| 1 | function usePaginatedOptions(params: UsePaginatedOptionsParams, deps?: DependencyList) { ... } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Prefer explicit semantic inputs for a domain hook. Accept a dependency list only when the hook intentionally wraps a dependency-driven primitive and tooling can inspect it.
Exceptions / Tradeoffs (EN)
An opaque dependency array can hide stale closures and make linting harder. A named reset input can be a valid domain contract; neither API shape is universally superior.