Open dotrakoun-clearstreet opened 5 months ago
We can add a excludeExternal
config option, it should be easy enough to implement, would you be willing to create a PR for it?
On the other hand, in other rules we have an allowList
to allow an array of bare module specifiers, I think that might be a better option. excludeExternal
kind of seems like the nuclear option tbh, and once you've excluded external packages, you might as well turn the rule off entirely. So it's probably better to take the same approach and reuse an allowList
.
You can reuse the implementation from here: https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/lib/rules/avoid-namespace-import.js
for node_modules, sometimes we only get barrel export possible to ignore node_modules for the new
avoid-importing-barrel-files
rule? e.g. ignore for module:import { DateValue } from 'react-aria';
but error for local only:
import { sometihng } from './my-file';
import { sometihng } from '@/my-file2';
-- ideally regex ignore support so we can error or ignore on custom typescript path aliases as desired