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: react
reactkeyslintlists
Compute list keys into a variable when the inline expression trips lint
Pull a templated React key into a named variable so the key is stable/clear and you avoid the lint warning about inline keys.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | {items.map((_, i) => <Skeleton key={`skeleton-reply-${i}`} />)} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | {items.map((_, i) => { |
| 2 | const key = `skeleton-reply-${i}`; |
| 3 | return <Skeleton key={key} />; |
| 4 | })} |
Explanation (EN)
Objašnjenje (HR)