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: typescript
importsbarrelproject-structurereadability
Re-export through an index barrel to keep imports clean
Provide an index barrel that re-exports default and named members so consumers import once from the directory.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | import MillistreamComponent from 'components/MillistreamComponent/MillistreamComponent'; |
| 2 | import { MillistreamProps } from 'components/MillistreamComponent/MillistreamComponent'; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // components/MillistreamComponent/index.ts |
| 2 | import MillistreamComponent from './MillistreamComponent'; |
| 3 | export * from './MillistreamComponent'; |
| 4 | export default MillistreamComponent; |
| 5 |
|
| 6 | // consumer |
| 7 | import MillistreamComponent, { MillistreamProps } from 'components/MillistreamComponent'; |
Explanation (EN)
Objašnjenje (HR)