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 ruleP2project specificStack: react
reacttypescriptcomponentsconventions
Give every component a typed props interface and index barrel
Each component should declare a typed props interface (no implicit any), use it on React.FC, and ship an index.ts barrel where the project convention requires it.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | const TableHeader = ({ headers, sortField, onSortChange }) => { /* ... */ }; |
| 2 | // no interface, no index.ts |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | interface TableHeaderProps { headers: Header[]; sortField: string; onSortChange: (f: string) => void; } |
| 2 | const TableHeader: React.FC<TableHeaderProps> = ({ headers, sortField, onSortChange }) => { /* ... */ }; |
| 3 | // index.ts: export { default } from './TableHeader'; |
Explanation (EN)
Objašnjenje (HR)