Repository navigation
Conversation
…ate imports Package sources are published, so their imports have to resolve from the package's own `dependencies`, not from the monorepo's hoisted `node_modules`. `import/no-extraneous-dependencies` already runs everywhere, but it allows `devDependencies`, and it silently skips imports it can't resolve, which includes every `metro*/private/*` import, since those exist only through `package.json#exports`. This adds an override for `packages/*/src` (excluding tests, mocks and fixtures) that disallows `devDependencies` and resolves through `package.json#exports`. The five guarded `metro-babel-register` requires, which only run in the monorepo, are annotated as exceptions, along with the entry point template that enforces them. New dev dependency: `eslint-import-resolver-node@^0.4.0`, the first version that reads `package.json#exports`. `eslint-plugin-import` still depends on `^0.3.9`, so `.eslintrc.js` points at this one by path until the plugin catches up. Changelog: Internal
Metro review: Looks goodRisk: low · Commit: This adds an ESLint override for published No findings. Verified
Not run: I didn't benchmark: this only changes lint and dev tooling, with no runtime effect. I didn't measure install size for the new root devDependency. It's small, published from the eslint-plugin-import repo, and the lockfile bumps Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call. |
import/no-extraneous-dependenciesmisses two kinds of bad import in published package sources: imports fromdevDependencies, which it allows, andmetro*/private/*imports, which it can't resolve (they only exist throughpackage.json#exports) and so skips. Both work in the monorepo thanks to hoisting, but can break for users.This adds an override for
packages/*/srcthat disallowsdevDependenciesand resolves throughexports, usingeslint-import-resolver-node@^0.4.0as a new root dev dependency.eslint-plugin-importstill depends on^0.3.9, hence the path reference in.eslintrc.js. The guardedmetro-babel-registerrequires, which only run in the monorepo, are marked as exceptions.Changelog: Internal
Test plan:
yarn lintpasses. A value import ofmetro/private/*from a package that doesn't depend onmetro, or only dev-depends on it, now fails lint.