noctcore-architecture/index-must-reexport-default
A component folder’s
index.tsmust re-export the sibling default named after the folder.
Recommended preset: error · Autofix: no · Suggestions: no · Type information: not needed
When a component folder’s index.ts re-exports the component default, consumers import the folder
(import Card from '@/components/Card') rather than reaching for the inner file
(.../Card/Card). The barrel becomes the folder’s single public entry point, and the internal file
layout stays free to change.
What it flags
Section titled “What it flags”The rule only activates for an index.ts that sits next to a <Folder>.tsx of the same PascalCase
name on disk (Card/Card.tsx beside Card/index.ts). For those barrels, it reports when the file
never re-exports the sibling’s default export.
export { default as Card } from './Card'; // ✓export { default } from './Card'; // ✓export * from './Card.types'; // ✗ (on its own — no default re-export)What it does not flag
Section titled “What it does not flag”- Non-component
index.tsfiles — those whose folder is not PascalCase, or that have no<Folder>.tsxsibling on disk. - Files other than
index.ts, such asCard/Card.helpers.ts. - A barrel that re-exports the default in either form, alongside any other re-exports.
- Paths matched by
ignorePaths.
Options
Section titled “Options”| Option | Type | Default | Meaning |
|---|---|---|---|
ignorePaths |
string[] |
[] |
Globs (supporting **, *, ?) of paths to skip. |
'noctcore-architecture/index-must-reexport-default': ['error', { ignorePaths: ['**/ui/**'],}]When not to use it
Section titled “When not to use it”If you do not use barrel files, or you export components as named (not default) exports, this rule does not apply.