Skip to content

Upgrade the Flow parser tooling to 0.340.0 - #2224

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
export-D131489493
Nov 13, 2026
Merged

meta-codesync[bot] merged 1 commit into
mainfrom
export-D131489493

Conversation

@gkz

@gkz gkz commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary:
@public
Upgrade flow-parser, flow-estree, flow-eslint, flow-transform and flow-api-translator to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

  • Generic type annotations carry their arguments in typeArguments instead of typeParameters, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is null, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
  • Enum declarations expose a single EnumBody carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
  • JSXAttribute.name widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
  • Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the jscodeshift/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493

@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 Nov 12, 2026
@meta-codesync

meta-codesync Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@gkz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131489493.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Metro review: Looks good

Risk: low · Commit: ddbfa1b · 8 commands run

This PR bumps flow-parser, flow-estree, flow-eslint, flow-transform and flow-api-translator from 0.336.0 to 0.340.0. It also strips a leading hashbang before the TypeScript definition generator runs files through flow-api-translator, because translator 0.340.0 throws on hashbang files such as metro-symbolicate/src/index.js. Generated .d.ts files, API snapshots and the hermes-parser path in metro-babel-transformer all behave the same as on the base. Most of the adaptation work the description lists (lint rules, enum readers, codemods) isn't in this OSS diff, and the description doesn't mention the hashbang workaround, which is the only code change here.

No findings.

Verified
  • ✅ yarn jest --no-watchman scripts/__tests__/declaration-input-test.js — 4/4 new tests pass
  • ✅ node bench/hb.js <head|base> (translateFlowToFlowDef on raw packages/metro-symbolicate/src/index.js) (failed as expected) — Head 0.340.0 throws "Cannot read properties of undefined (reading '1')"; base 0.336.0 succeeds. This confirms the hashbang strip is needed.
  • ✅ yarn build-ts-defs && git status --short — The generator ran without errors and left the working tree clean, so the committed .d.ts files match 0.340.0 output. The lint messages it printed are part of its normal unused-declaration pruning.
  • ✅ node bench/babelparse.js on head and base (flow-parser babel:true + Babel transform: hashbang, enum, generics, JSX namespace, import type) — Head and base output is identical for every sample
  • ✅ yarn jest --no-watchman scripts packages/metro-babel-transformer packages/metro-babel-register packages/metro/src/ModuleGraph packages/metro-transform-worker — 16 suites, 382 passed, 1 skipped
  • ✅ yarn typecheck
  • ✅ yarn lint scripts/generateTypeScriptDefinitions.js scripts/__tests__/declaration-input-test.js — 0 errors. The 1 warning is in an unchanged test file and predates this PR.
  • ✅ yarn verify-api-snapshots — 18 snapshots verified

Not run: No benchmark: this is a parser version bump plus a script-only change, with no performance claim. The full Jest suite and the integration bundles weren't run; only the suites that touch the parser and the scripts were. Windows wasn't checked; the hashbang regex already handles CRLF and is covered by a test.

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

Summary:
@public
Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform` and `flow-api-translator` to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

- Generic type annotations carry their arguments in `typeArguments` instead of `typeParameters`, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is `null`, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
- Enum declarations expose a single `EnumBody` carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
- `JSXAttribute.name` widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
- Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the `jscodeshift`/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493
gkz added a commit to gkz/react-native that referenced this pull request Nov 13, 2026
Summary:
X-link: react/metro#2224

@public
Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform` and `flow-api-translator` to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

- Generic type annotations carry their arguments in `typeArguments` instead of `typeParameters`, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is `null`, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
- Enum declarations expose a single `EnumBody` carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
- `JSXAttribute.name` widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
- Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the `jscodeshift`/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493
@gkz
gkz requested review from SamChou19815 and robhogan November 13, 2026 05:57
@meta-codesync
meta-codesync Bot merged commit 5f44aa0 into main Nov 13, 2026
18 of 19 checks passed
meta-codesync Bot pushed a commit to react/react-native that referenced this pull request Nov 13, 2026
Summary:
X-link: react/metro#2224

@public
Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform` and `flow-api-translator` to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

- Generic type annotations carry their arguments in `typeArguments` instead of `typeParameters`, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is `null`, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
- Enum declarations expose a single `EnumBody` carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
- `JSXAttribute.name` widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
- Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the `jscodeshift`/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493

Pull Request resolved: #59983
meta-codesync Bot pushed a commit to meta/relay that referenced this pull request Nov 13, 2026
Summary:
X-link: react/react-native#59983

X-link: react/metro#2224

Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform` and `flow-api-translator` to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

- Generic type annotations carry their arguments in `typeArguments` instead of `typeParameters`, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is `null`, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
- Enum declarations expose a single `EnumBody` carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
- `JSXAttribute.name` widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
- Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the `jscodeshift`/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493

fbshipit-source-id: 9c6a582207ecd8757da780276cd864665feb8020
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. meta-exported needs-meta-import

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants