Skip to content

TCS-11: Add eslint-plugin-no-barrel-files rule to react config#68

Open
brettcutt-aligent wants to merge 2 commits into
mainfrom
feature/TCS-11_add-no-barrel-imports-eslint-rule
Open

TCS-11: Add eslint-plugin-no-barrel-files rule to react config#68
brettcutt-aligent wants to merge 2 commits into
mainfrom
feature/TCS-11_add-no-barrel-imports-eslint-rule

Conversation

@brettcutt-aligent
Copy link
Copy Markdown
Contributor

Description of the proposed changes
Adds eslint-plugin-no-barrel-files to the shared react ESLint config so every consuming project picks up barrel-file enforcement without configuring it locally.

  • Before: projects using eslintConfigs.react had no rule against barrel files; export * from … and re-exports of imported variables were silently allowed.

    // components/AddressForm/index.ts — passed lint
    export * from './AddressFields';
    export { default } from './AddressFields';
  • After: any such file errors with no-barrel-files/no-barrel-files (Do not use export all or Do not re-export imported variable), via the plugin's flat/recommended config.

    // components/AddressForm/index.ts — now fails lint
    export * from './AddressFields';
    // ^ 1:1  error  Do not use export all (`export * from ...`)         no-barrel-files/no-barrel-files
    export { default } from './AddressFields';
    // ^ 2:1  error  Do not re-export imported variable (`./AddressFields`)  no-barrel-files/no-barrel-files

    Consumers should import from the source file directly instead:

    import AddressFields, { type AddressFieldsClassNames } from './AddressFields';

Screenshots (if applicable)
Symlinked and tested on the Takeflight project
image

Other solutions considered (if any)

Notes to PR author

⚠️ Please make sure the changes adhere to the guidelines mentioned in our contribution guide.

Notes to reviewers

ℹ️ When you've finished leaving feedback, please add a final comment to the PR tagging the author, letting them know that you have finished leaving feedback

@brettcutt-aligent brettcutt-aligent marked this pull request as ready for review May 22, 2026 01:36
@brettcutt-aligent brettcutt-aligent requested review from a team as code owners May 22, 2026 01:36
The repo's prettier.config.js is a deliberate two-line passthrough that
imports prettierConfig from src and re-exports it as default. This is
the recommended consumer pattern documented in the README, not a real
barrel.

Scope the override to prettier.config.js only so the rule still applies
to every other file in this repo's self-lint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant