You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would oxc(prefer-direct-imports) make sense as a new rule?
I have a PR in progress with an autofix, which would greatly simplify enabling oxc(no-barrel-file) on large codebases.
I figured a fix on oxc(no-barrel-file) would be too opinionated, hence the new rule suggestion.
⚠ oxc(prefer-direct-imports): Barrel import detected, loading 6 additional modules.
╭─[index.js:1:22]
1 │ import { User } from './barrel';
· ──────────
╰────
help: Consider importing directly from the specific modules instead of the barrel file.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Would
oxc(prefer-direct-imports)make sense as a new rule?I have a PR in progress with an autofix, which would greatly simplify enabling oxc(no-barrel-file) on large codebases.
I figured a fix on
oxc(no-barrel-file)would be too opinionated, hence the new rule suggestion.The only alternative I found was to run this custom script when enabling
no-barrel-filein a legacy codebase instead: https://mmazzarolo.com/blog/2024-11-10-removing-barrel-file-references-with-a-codemod/Related issue: #18776
PR: #18790
Example:
⚠ oxc(prefer-direct-imports): Barrel import detected, loading 6 additional modules. ╭─[index.js:1:22] 1 │ import { User } from './barrel'; · ────────── ╰──── help: Consider importing directly from the specific modules instead of the barrel file.Beta Was this translation helpful? Give feedback.
All reactions