Skip to content

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

Closed
robhogan wants to merge 1 commit into
mainfrom
pr2118
Closed

robhogan wants to merge 1 commit into
mainfrom
pr2118

Conversation

@robhogan

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/
  • 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.

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.
@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

Copy link
Copy Markdown
Collaborator Author

Duplicate of #2116 (opened by mistake while linking the stack)

@robhogan robhogan closed this Oct 26, 2026
@robhogan
robhogan deleted the pr2118 branch October 26, 2026 16:14
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant