Skip to content

[lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping - #9339

Merged
potatowagon merged 1 commit into
mainfrom
devtools-messaging-lint
Oct 13, 2026
Merged

potatowagon merged 1 commit into
mainfrom
devtools-messaging-lint

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

The devtools entrypoints derive their window messaging namespace per page
load and pass it between the two halves of the extension explicitly. Nothing
enforces that, so the earlier form — a shared constant — reads as reasonable
and would come back unnoticed.

Adds @lexical/internal/no-unscoped-window-messaging, which reports:

  • a namespace / allowWindowMessagingForNamespace option on a
    @webext-pegasus transport initializer whose value is fixed at build time.
    A string literal, a template literal with no substitutions, a local const
    holding either, and an imported binding all count — the last is the form
    that most looks like it is doing something.
  • a targetOrigin of '*', as a postMessage argument or an object
    property.

A value the rule cannot resolve statically — a call, a member access, a
parameter — is accepted, which is the shape being asked for.

Enabled for packages/, examples/ and dev-examples/.

Test plan

Before

The rule did not exist; no check covered either pattern.

$ npx eslint packages examples dev-examples
(no findings for these patterns)

After

$ npx vitest --project unit --no-watch run packages/lexical-eslint-plugin-internal
 ✓ packages/lexical-eslint-plugin-internal/src/__tests__/unit/no-unscoped-window-messaging.test.ts (2 tests)
 ✓ packages/lexical-eslint-plugin-internal/src/__tests__/unit/no-pure-annotation.test.ts (2 tests)
 Test Files  2 passed (2)
      Tests  4 passed (4)

$ npx eslint packages examples dev-examples
(clean — the current sources satisfy the rule)

$ npx prettier --check "packages/lexical-eslint-plugin-internal/src/**/*.{js,ts}" "eslint.config.mjs"
All matched files use Prettier code style!

Checked against the previous form of the devtools content script, which the
rule reports as expected:

packages/lexical-devtools/src/entrypoints/content/index.ts
  40:61  error  The `allowWindowMessagingForNamespace` for a window messaging
                channel must be derived at runtime, not from a build-time
                constant  @lexical/internal/no-unscoped-window-messaging

13 RuleTester cases cover the reported forms and the accepted ones.

… scoping

## Description

The devtools entrypoints derive their window messaging namespace per page
load and pass it between the two halves of the extension explicitly. Nothing
enforces that, so the earlier form — a shared constant — reads as reasonable
and would come back unnoticed.

Adds `@lexical/internal/no-unscoped-window-messaging`, which reports:

- a `namespace` / `allowWindowMessagingForNamespace` option on a
  `@webext-pegasus` transport initializer whose value is fixed at build time.
  A string literal, a template literal with no substitutions, a local `const`
  holding either, and an imported binding all count — the last is the form
  that most looks like it is doing something.
- a `targetOrigin` of `'*'`, as a `postMessage` argument or an object
  property.

A value the rule cannot resolve statically — a call, a member access, a
parameter — is accepted, which is the shape being asked for.

Enabled for `packages/`, `examples/` and `dev-examples/`.

## Test plan

### Before

The rule did not exist; no check covered either pattern.

```
$ npx eslint packages examples dev-examples
(no findings for these patterns)
```

### After

```
$ npx vitest --project unit --no-watch run packages/lexical-eslint-plugin-internal
 ✓ packages/lexical-eslint-plugin-internal/src/__tests__/unit/no-unscoped-window-messaging.test.ts (2 tests)
 ✓ packages/lexical-eslint-plugin-internal/src/__tests__/unit/no-pure-annotation.test.ts (2 tests)
 Test Files  2 passed (2)
      Tests  4 passed (4)

$ npx eslint packages examples dev-examples
(clean — the current sources satisfy the rule)

$ npx prettier --check "packages/lexical-eslint-plugin-internal/src/**/*.{js,ts}" "eslint.config.mjs"
All matched files use Prettier code style!
```

Checked against the previous form of the devtools content script, which the
rule reports as expected:

```
packages/lexical-devtools/src/entrypoints/content/index.ts
  40:61  error  The `allowWindowMessagingForNamespace` for a window messaging
                channel must be derived at runtime, not from a build-time
                constant  @lexical/internal/no-unscoped-window-messaging
```

13 RuleTester cases cover the reported forms and the accepted ones.
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 12, 2026 4:43am UTC
lexical-playground Ready Ready Preview Oct 12, 2026 4:43am UTC

Request Review

@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 12, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Oct 13, 2026

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems sufficient for the intended purpose, both claude and codex came up with some ways to trigger false positives and negatives with contrived situations but I think this is probably fine as-is.

Claude review

Review: #9339

[lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping (head 8578c48, one commit on main)

Reviewed from the diff and commit message. The PR description and comments weren't reachable from here.

What it does

It adds @lexical/internal/no-unscoped-window-messaging, which reports two things:

  1. A namespace or allowWindowMessagingForNamespace option on initPegasusTransport({...}) whose value is a build-time constant: a string literal, a template literal with no substitutions, a local variable initialized with one of those, or any imported binding.
  2. A '*' targetOrigin, either as the second argument of postMessage or as a targetOrigin: property.

The rule is turned on twice: in the plugin's all/recommended configs, and in a new block in eslint.config.mjs scoped to packages/, examples/ and dev-examples/.

The aim is to keep #9299's per-page-load devtools namespace from drifting back to a shared constant.

Verdict

The '*' targetOrigin half is a reasonable, cheap, general rule. I'd keep it.

The Pegasus half is a lint rule guarding exactly two call sites in one package, and both are already correct. Those call sites already carry comments explaining why the namespace is runtime-generated (entrypoints/content/index.ts, entrypoints/injected/index.ts, constants.ts). Its message also claims more security than the design gives. I'd accept it only with the fixes below, and with the message reworded. A comment at the call site, which already exists, would be a fine alternative to the rule.

Findings

1. The rule is enabled for every file, so the scoped block does nothing (should fix)

eslint.config.mjs line 99 spreads lexicalInternalPlugin.configs['flat/all'] for the whole repo, and the PR adds the rule to flatAll (and legacyAll). So the rule already runs on scripts/, the website, and everything else. The new files: ['packages/**', 'examples/**', 'dev-examples/**'] block re-enables something that is already on.

index.js sets a precedent right above the change: no-pure-annotation is "deliberately not part of the default configs — it is about how this repository builds its own sources, so the root eslint.config.mjs enables it with its own files scope". This rule is about one third-party library's API inside one package, so it belongs on the same side of that line. Drop it from legacyAll/flatAll and let the scoped block be the only switch. Arguably the scope should be narrowed to packages/lexical-devtools/**, since that is the only Pegasus user.

2. The error message overstates what a per-page namespace protects against (should fix)

The message says a constant "identifies the channel to anything else running in the page. Generate it per page load and pass it to the other side explicitly." The eslint.config comment says the name "has to be specific to that page rather than shared".

The runtime namespace is not hidden from the page, though:

  • injectScript puts it in the src query string of a <script> element appended to the page's own DOM. The element is only removed on onload, so a page MutationObserver sees it.
  • The injected script then runs in the main world, where page code can also hook window.postMessage and addEventListener('message') before or after it.

A per-load name does prevent crosstalk between extensions and between stale and fresh injections, and that is worth having. It does not stop a hostile page from addressing the channel. Wording the lint message and comment as a security boundary invites later readers to rely on it as one. I'd describe it as collision and crosstalk avoidance, and leave trust decisions to validating what arrives over the channel.

3. The initializer is matched by bare name, not by import (should fix, patch attached)

Only callee.type === 'Identifier' && callee.name === 'initPegasusTransport' is checked. I ran the PR's rule through ESLint's Linter and got these misses:

Code PR's rule
import {initPegasusTransport as init} from '@webext-pegasus/transport/window'; init({namespace: 'x'}) no report
import * as t from '@webext-pegasus/transport/window'; t.initPegasusTransport({namespace: 'x'}) no report
a local function initPegasusTransport(o) {} called with {namespace: 'x'} reports

The rule already walks scopes for the argument, so resolving the callee through its ImportDeclaration source (@webext-pegasus/transport or a subpath) costs a few lines and fixes all three.

4. "Build-time constant" misclassifies let and imports (should fix the first, note the second)

  • let ns = 'x'; ns = crypto.randomUUID(); initPegasusTransport({namespace: ns}) is reported. variable.defs.length === 1 doesn't exclude a let with later assignments. Requiring def.parent.kind === 'const' fixes it.
  • Every ImportBinding counts as constant, with the justification that "an import is resolved when the bundle is built, so it is the same value everywhere". That conflates the binding with its value. import {namespace} from './runtimeNamespace', where that module exports crypto.randomUUID(), is reported even though it is exactly the per-load value the rule asks for. I'd keep the import case, since it is the regression the PR is most worried about, but fix the doc comment and say that eslint-disable is the escape hatch for a runtime-valued export.
  • The rule also lets through constants hidden behind other syntax: `${CONST}`, 'a' + 'b', and initPegasusTransport(opts) with opts a const object. That's acceptable for a heuristic, but then the claim that it "would come back unnoticed" is only partly addressed.

5. '*' has one legitimate use (minor)

Posting to a sandboxed iframe without allow-same-origin (opaque null origin) requires '*'. The repo has no such call today; I grepped packages, examples and dev-examples. If one appears, it will need an eslint-disable with a reason. The message could mention that so the next person doesn't hunt for an origin that doesn't exist.

6. Tests (minor)

  • The RuleTester structure mirrors no-pure-annotation.test.ts, which is good.
  • The commit message says "13 RuleTester cases", but there are 16 (8 invalid, 8 valid).
  • No case covers an aliased import, a namespace import, a same-named local function, or a reassigned let. Those are exactly the gaps in 3 and 4. The attached patch adds them.

Suggested patch

lexical-9339-scope-and-resolve-import.patch applies on the PR head (8578c48). It:

  • removes the rule from legacyAll/flatAll and extends the existing note, so the eslint.config.mjs block is the only place it is enabled;
  • resolves the callee through an @webext-pegasus/transport import, covering aliases and namespace imports and ignoring same-named locals;
  • treats only const declarators as constant;
  • adds the four RuleTester cases above.

I checked it by running the test file's RuleTester cases against the patched rule (all pass) and by re-running the probe table above (aliased and namespace calls now report; the let case and the local function don't). It is formatted with the repo's prettier settings. It doesn't reword the messages from finding 2, since that wording is the author's call.

Codex review

All finding locations below refer to no-unscoped-window-messaging.js at the reviewed head.

  1. P2 — Match Pegasus import bindings, rather than the local function name (lines 124–131).
    import {initPegasusTransport as init} …; init({namespace: 'fixed'}) escapes detection, while an unrelated local function named initPegasusTransport is reported. Aliasing the initializer in the actual historical content script restored its static namespace with zero errors under the full repository ESLint configuration.
  2. P2 — Unwrap TypeScript assertions before classifying namespaces (lines 37–63).
    Both 'fixed' as const and an imported constant as string escape detection. Adding only as string to the historical devtools namespace makes the previously detected regression lint clean. These assertions change no runtime behavior. satisfies also escapes detection.
  3. P2 — Resolve statically known wildcard origins (lines 102–105).
    The check recognizes only an ESTree string Literal. A template literal containing , '' as const, and const targetOrigin = '*'; window.postMessage(data, targetOrigin) all receive no warning. All three passed the full repository ESLint configuration.
  4. P2 — Resolve initializer references in their declaration scope (lines 62–63).
    Recursive resolution retains the callsite’s scope. For const NAME = 'fixed'; const namespace = NAME; function start(NAME) { initPegasusTransport({namespace}); }, the parameter incorrectly shadows the initializer’s module binding, hiding a fixed namespace. The inverse arrangement falsely reports a runtime namespace. Reassigned let bindings are also classified solely from their initializers.
  5. P2 — Imported values are not necessarily build-time constants (lines 57–59).
    A module exporting const namespace = crypto.randomUUID() generates its value at runtime, yet importing that value is always reported. Independent module evaluations produced different UUIDs in the reproduction. This makes extracting a valid page-scoped namespace into a module fail lint. The PR intentionally rejects every import, but its stated reasoning about module evaluation is incorrect.
    A P3 scope mismatch also exists: index.js:56 enables the rule globally through flat/all. The later files block does not narrow that scope; configuration inspection confirmed it also runs on scripts/build.mjs and eslint.config.mjs.
    Validation completed:
  • Focused Vitest: 5 files, 18 tests passed, including the supplied RuleTester cases.
  • Supplemental RuleTester: 31 cases exercised; 12 passed and 19 expected-behavior assertions failed, covering the findings and additional property-syntax limitations.
  • Current content/injected callsites passed; both historical static namespace callsites were detected.
  • ESLint on packages examples dev-examples, formatting, and diff whitespace checks passed.
  • Root lint passed after excluding the preexisting, Git-ignored playwright.local.config.mjs, whose missing header caused the unfiltered run to fail.
    Reproduction script and results remain local. Tests used the saved dependencies, including ESLint 10.10.0 and Vitest 5.0.0. No runtime regression was found in current callsites. Pegasus 0.3.6’s dependency handshake still uses wildcard postMessage; node_modules is excluded from lint.
    Separately, PR workflow status shows 12 successful checks, 3 skipped extended-test jobs, and 2 successful Vercel statuses. CLA passed; the PR is ready for review and conflict-free. Required review remains outstanding: the gate logged REVIEW_REQUIRED, and GitHub reports merge status blocked. There are no submitted reviews or inline discussions. The checkout remains clean at the reviewed head.

@potatowagon
potatowagon added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 80b6fb2 Oct 13, 2026
56 checks passed
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -7
3:### Breaking changes
28:### Features
36:### Fixes
98:### Performance
102:### Other
106:### Contributors
110:### All changes
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
@zurfyx zurfyx mentioned this pull request Oct 27, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 8578c481 Deployed Oct 12, 2026 by vercel[bot]
Preview – lexical-playground — 8578c481 Deployed Oct 12, 2026 by vercel[bot]
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. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants