Repository navigation
[*] Bug Fix: Keep modern Flow variance keywords in the www Flow stubs - #9154
Merged
Merged
Conversation
## Description `scripts/www/transformFlowFileContents.mjs` reprints every `packages/*/flow/*.js.flow` stub through `hermes-transform`, which prints via prettier. Since meta#9143 bumped hermes-transform to 0.37.0 while the `prettier` override in `pnpm-workspace.yaml` held prettier at 3.8.1, that pairing prints the modern variance keywords as the deprecated sigil, and inverts them: `readonly` and `out` both come out as `-`, which Flow reads as contravariant. The www copies are `@flow strict` and land in a Flow-checked tree, so every affected property fails the `unsupported-syntax` lint: ``` Error -------------------------------- html/shared/lexical/Lexical.js.flow:1528:3 The `-` variance sigil is deprecated. Use `writeonly` instead. [unsupported-syntax] 1528| -type: 'node-caret-range'; ^ ``` 80 properties across `Lexical`, `LexicalHtml`, `LexicalUtils` and `LexicalExtension` are affected — every `readonly`/`out`/`in` annotation the stubs declare. prettier 3.8.5 prints the keywords correctly, so this raises the override (and the matching devDependency floor) from 3.8.1 to 3.8.5, and adds a `transformFlowFileContents` case asserting that variance syntax round-trips unchanged. Note that `prettier-plugin-hermes-parser` is no longer a peer dependency of hermes-transform as of 0.37.0 and does not affect this either way — 0.36.1 and 0.37.0 of the plugin, and no plugin at all, all print the same. ## Test plan Reprinting the four real stubs through the repo's own transform, counting lines that come out with a `-` sigil: ### Before ``` $ node check.mjs packages/lexical/flow/Lexical.js.flow: 62 bad lines -__isInlineFormattable: true; declare export class DOMSlot<-T extends HTMLElement> { -element: T; packages/lexical-html/flow/LexicalHtml.js.flow: 12 bad lines -cfg: ContextConfig<Ctx, V>, -updater: (prev: V) => V, -nodes: '*' | ReadonlyArray<NodeMatch<T>>, packages/lexical-utils/flow/LexicalUtils.js.flow: 4 bad lines -stateConfig: StateConfig<K, V>, -$get: <T extends LexicalNode>(node: T) => V, -$set: <T extends LexicalNode>( packages/lexical-extension/flow/LexicalExtension.js.flow: 2 bad lines -value: T; -data: {[string]: unknown}, prettier resolved: 3.8.1 ``` ``` $ npx vitest run scripts/www/__tests__/unit/transformFlowFileContents.test.ts FAIL |scripts-unit| scripts/www/__tests__/unit/transformFlowFileContents.test.ts > transformFlowFileContents > transforms variance keywords AssertionError: expected '/**\n * Copyright (c) Meta Platforms,…' to be '/**\n * Copyright (c) Meta Platforms,…' // Object.is equality - Expected + Received export interface InlineFormattableNode { - readonly __isInlineFormattable: true; + -__isInlineFormattable: true; } - declare export class DOMSlot<out T extends HTMLElement> { + declare export class DOMSlot<-T extends HTMLElement> { - readonly element: T; + -element: T; - readonly before: Node | null; + -before: Node | null; } - export type ContextRecord = {readonly [string | symbol]: unknown}; + export type ContextRecord = {-[string | symbol]: unknown}; - declare export function $setState<in T>(value: T): void; + declare export function $setState<-T>(value: T): void; Test Files 1 failed (1) Tests 1 failed | 4 passed (5) ``` ### After ``` $ node check.mjs packages/lexical/flow/Lexical.js.flow: 0 bad lines packages/lexical-html/flow/LexicalHtml.js.flow: 0 bad lines packages/lexical-utils/flow/LexicalUtils.js.flow: 0 bad lines packages/lexical-extension/flow/LexicalExtension.js.flow: 0 bad lines prettier resolved: 3.8.5 ``` ``` $ npx vitest run scripts/www/__tests__/unit/transformFlowFileContents.test.ts ✓ |scripts-unit| scripts/www/__tests__/unit/transformFlowFileContents.test.ts (5 tests) 142ms Test Files 1 passed (1) Tests 5 passed (5) ``` `npx prettier --list-different` reports no change on the files this PR touches.
potatowagon
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7 and
zurfyx
as code owners
September 11, 2026 09:05
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zurfyx
approved these changes
Sep 11, 2026
etrepum
pushed a commit
to etrepum/lexical
that referenced
this pull request
Sep 11, 2026
Conflicts came from meta#9154, which bumped prettier to 3.8.5 (both the root devDependency and the pnpm-workspace.yaml override) so the www Flow stubs keep modern variance keywords, while this branch bumps its neighbouring prettier-plugin-* entries. - package.json: prettier ^3.8.5 from main, prettier-plugin-hermes-parser ^0.37.0 from the dependency group bump. - pnpm-lock.yaml: regenerated with `pnpm install --lockfile-only` instead of resolving the generated file by hand. The only delta against this branch is prettier 3.8.1 -> 3.8.5, with the same integrity hash main resolved. Verified with `pnpm run ci-check` (exit 0) and `pnpm run test-unit` (324 files, 7317 passed | 1 skipped), which covers the transformFlowFileContents cases meta#9154 added against prettier 3.8.5 and prettier-plugin-hermes-parser 0.37.0. Co-Authored-By: Claude Opus 5 <[email protected]>
etrepum
pushed a commit
to etrepum/lexical
that referenced
this pull request
Sep 11, 2026
## Description The dev-dependencies group bump raised `@types/node` to `^26.4.1` in the root package.json, but `pnpm-workspace.yaml` pins the whole workspace to `'@types/node': '25.9.1'` through `overrides`, so the bump never took effect: the lockfile still recorded `specifier: 25.9.1` for the root importer and every package kept resolving 25.x while the manifest advertised 26.x. The override has to move with the dependency — the same way meta#9154 bumped prettier in both places — so this sets it to `26.4.1`. `@types/node` 26 pulls `undici-types` 8.3.0 in place of 7.24.6; nothing else in the lockfile changes. ## Test plan ### Before ``` $ grep -n "@types/node" package.json pnpm-workspace.yaml package.json:144: "@types/node": "^26.4.1", pnpm-workspace.yaml:22: '@types/node': '25.9.1' $ grep -A2 "'@types/node':" pnpm-lock.yaml # root importer '@types/node': specifier: 25.9.1 version: 25.9.1 ``` ### After ``` $ grep -A2 "'@types/node':" pnpm-lock.yaml # root importer '@types/node': specifier: 26.4.1 version: 26.4.1 $ pnpm install - @types/node 25.9.1 + @types/node 26.4.1 $ pnpm run ci-check $ npm-run-all --parallel tsc tsc-scripts tsc-extension tsc-website flow prettier lint No errors! (exit 0) $ pnpm run build-types $ tsc -p ./tsconfig.build.json && node ./scripts/validate-tsc-types.mjs (exit 0) ``` Co-Authored-By: Claude Opus 5 <[email protected]>
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
scripts/www/transformFlowFileContents.mjsreprints everypackages/*/flow/*.js.flowstub through
hermes-transform, which prints via prettier. Since #9143 bumpedhermes-transform to 0.37.0 while the
prettieroverride inpnpm-workspace.yamlheld prettier at 3.8.1, that pairing prints the modern variance keywords as the
deprecated sigil, and inverts them:
readonlyandoutboth come out as-,which Flow reads as contravariant.
The www copies are
@flow strictand land in a Flow-checked tree, so everyaffected property fails the
unsupported-syntaxlint:80 properties across
Lexical,LexicalHtml,LexicalUtilsandLexicalExtensionare affected — everyreadonly/out/inannotation thestubs declare.
prettier 3.8.5 prints the keywords correctly, so this raises the override (and
the matching devDependency floor) from 3.8.1 to 3.8.5, and adds a
transformFlowFileContentscase asserting that variance syntax round-tripsunchanged.
Note that
prettier-plugin-hermes-parseris no longer a peer dependency ofhermes-transform as of 0.37.0 and does not affect this either way — 0.36.1 and
0.37.0 of the plugin, and no plugin at all, all print the same.
Test plan
Reprinting the four real stubs through the repo's own transform, counting lines
that come out with a
-sigil:Before
After
npx prettier --list-differentreports no change on the files this PR touches.