Skip to content

Declare root dev dependencies that Yarn hoisting was hiding - #2116

Merged
robhogan merged 2 commits into
mainfrom
pr2116
Nov 2, 2026
Merged

robhogan merged 2 commits into
mainfrom
pr2116

Conversation

@robhogan

@robhogan robhogan commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Our root scripts use several packages that the root package.json doesn't declare. They work under Yarn only because hoisting happens to put them in the root node_modules:

  • @babel/register and nullthrows, used by build and the other scripts under scripts/
  • @babel/traverse, used by update-babel-flow-lib-defs
  • flow-estree, used by our lint rules
  • @types/babel__core, @types/babel__traverse and @types/connect, needed by typecheck-ts
  • source-map@^0.6.1. Our packages depend on 0.5, which ships no types, so typecheck-ts has been picking up the hoisted 0.6 typings instead. This keeps that behaviour explicit.

Each range matches what's already locked, so yarn.lock doesn't change. This is needed for any package manager that doesn't hoist, in particular pnpm.

Changelog: Internal

Test plan:
yarn install --frozen-lockfile passes with the unchanged yarn.lock.

Under pnpm 11.28.8 and 12.15.0, before this change build, lint and typecheck-ts fail on missing modules or declarations. After it, build, lint, format-check, verify-api-snapshots, typecheck-ts and test-smoke all pass.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 26, 2026
@robhogan
robhogan added this pull request to stack #2119 October 26, 2026 16:14
@robhogan
robhogan marked this pull request as ready for review October 26, 2026 16:17
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Metro review: Changes suggested

Risk: low · Commit: f854586 · 6 commands run

The PR declares seven root dev dependencies that Yarn hoisting was providing, so that root scripts also work under pnpm. Each range matches what yarn.lock already has. Yarn's frozen install still passes, and build and typecheck-ts pass under pnpm. One root script still depends on an undeclared package (@babel/traverse), which my previous review reported, and it still fails under pnpm.

Findings

  • should fix · @babel/traverse is also used by a root script but still undeclared — package.json:11 · 2433b705
Verified
  • ✅ pnpm@12.15.0 import && pnpm install --frozen-lockfile (head scratch copy, with pnpm-workspace.yaml)
  • ✅ pnpm@12.15.0 run build (head) — Matches the test plan's claim.
  • ✅ pnpm@12.15.0 run typecheck-ts (head) — Matches the test plan's claim.
  • ❌ pnpm@12.15.0 run update-babel-flow-lib-defs (head) — Cannot find module '@‍babel/traverse/lib/path/lib/virtual-types'.
  • ✅ yarn@1.22.22 install --frozen-lockfile --ignore-scripts (fresh head copy) — yarn.lock is unchanged and still valid.
  • ✅ node script: compare bare imports in scripts/ with root package.json deps — Only @‍babel/traverse is missing.

Not run: I didn't re-run lint, format-check, verify-api-snapshots, test-smoke or pnpm 11.28.8 under pnpm. This is a manifest-only change with no runtime code, so there was nothing to benchmark. No Windows machine was available, and nothing here is platform-specific.

Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call.

Comment thread package.json Resolved
robhogan and others added 2 commits October 28, 2026 19:57
Our root scripts use several packages that the root `package.json` doesn't declare. They work under Yarn only because hoisting happens to put them in the root `node_modules`:

 - `@babel/register` and `nullthrows`, used by `build` and the other scripts under `scripts/`
 - `flow-estree`, used by our lint rules
 - `@types/babel__core`, `@types/babel__traverse` and `@types/connect`, needed by `typecheck-ts`
 - `source-map@^0.6.1`. Our packages depend on 0.5, which ships no types, so `typecheck-ts` has been picking up the hoisted 0.6 typings instead. This keeps that behaviour explicit.

Each range matches what's already locked, so `yarn.lock` doesn't change. This is needed for any package manager that doesn't hoist, in particular pnpm.

Changelog: Internal

Test plan:
`yarn install --frozen-lockfile` passes with the unchanged `yarn.lock`.

Under pnpm 11.28.8 and 12.15.0, before this change `build`, `lint` and `typecheck-ts` fail on missing modules or declarations. After it, `build`, `lint`, `format-check`, `verify-api-snapshots`, `typecheck-ts` and `test-smoke` all pass.
@robhogan
robhogan merged commit 8797cd7 into main Nov 2, 2026
16 checks passed
robhogan added a commit that referenced this pull request Nov 20, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 21, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 23, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
meta-codesync Bot pushed a commit that referenced this pull request Nov 25, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 25, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 25, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
robhogan added a commit that referenced this pull request Nov 25, 2026
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.

This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.

Changelog: Internal

Test plan:
`actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests).

CI on this PR runs the new job.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. needs-meta-import

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants