Rule for banning `export {} from '...'`
Opened this issue · 2 comments
A new rule that allows you to ban the creation of export {} from '...'
.
This will help enforce a policy to not create barrel files, which are index.js
/ index.ts
files that only serves to export parts of other modules.
This is not a commentary on the good or bad for this way of organizing modules and packages, I'd just like to be able to set up linting rules over its usage.
With eslint's own settings we can already control the file patterns any individual rule applies to.
Perhaps having a flag to distinguish between export-only files and files that mix re-exported elements and exports of locally defined elements. Although that could also be achieved with lint-ignore comments.
Barrel files are incredibly bad, and commentary on that is welcome.
You can already ban this form with no-restricted-syntax
, so it doesn't really make sense to make a full-blown rule for it.
If you want a "no barrel files" rule, that would have more merit.
I didn't know about no-restricted-syntax
; thanks for pointing it out.
Then this issue can become a direct feature request for a no-barrel-exports
rule.