react-doctor/no-barrel-import
Import from the direct path: `import { Button } from './components/Button'` instead of `./components`
- Category: Performance
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
- Tags: test-noise
- Default: Enabled
Validate the diagnostic
Confirm the reported code matches this rule before you edit it.
Confirm the import source is a relative path (starts with ".") that resolves to an index.{js,ts,jsx,tsx,mjs,cjs} file containing only re-export declarations — the rule's resolver inspects the file and only fires when isBarrel is true, and it reports at most once per importing file. False positive: bundlers like Vite or Next.js with optimizePackageImports already tree-shake barrels well in production.
How to fix
Follow the rule guidance while preserving unrelated behavior.
Copyable fix prompt
Copy this self-contained prompt into your coding agent after you confirm the diagnostic.
Related rules
More Performance rules from the rules reference:
react-doctor/no-create-object-url-without-revoke: createObjectURL without revokeObjectURLreact-doctor/no-document-write: document.write/writelnreact-doctor/no-dynamic-import-path: Use a string-literal path: `import('./feature/heavy.js')` so the bundler can split this chunkreact-doctor/no-eager-new-in-use-state-initializer: Eager constructor in useState initializerreact-doctor/no-ease-in-motion: UI motion starts with ease-in