eslint-plugin-monorepo
eslint-plugin-monorepo copied to clipboard
monorepo/no-internal-import prevents some safe imports
My understanding of this rule is that it's meant to prevent packages in the monorepo from importing files that exist locally, but would not be present after publishing to NPM.
It's also preventing valid internal imports of files that we know do get published to NPM, e.g. anything that is listed in the files
array of package.json. For example if we know that package-a
has files: ["lib"]
in it's package.json, we should be able to tell that an import like import foo from 'package-a/lib/foo.js'
is safe.
Would you be open to a flag that allowed these sort of internal imports?
@azz hey, we have a similar use-case in https://github.com/spotify/backstage, basically we want to allow everything included in files
field inside package.json
to be allowed by the rule:
Example of rule error that we want to avoid - https://github.com/spotify/backstage/blob/108ce379493e8a7a805b1501a696dd79ebe1dadd/packages/app/src/index.tsx#L17-L18
Please let me know if this is something you are interested in and happy to contribute!
@shmidt-i Absolutely! Go wild.