Skip to content

fix(linter): handle variable references in replaceOverride (#34026)#35306

Closed
llwt wants to merge 7 commits into
21.6.xfrom
backport-34026-to-21.6.x
Closed

fix(linter): handle variable references in replaceOverride (#34026)#35306
llwt wants to merge 7 commits into
21.6.xfrom
backport-34026-to-21.6.x

Conversation

@llwt
Copy link
Copy Markdown
Member

@llwt llwt commented Apr 15, 2026

#32881)

This PR fixes an issue with new docs where graph or PDV tag with inner
JSON content will cause formatting issues with other code blocks on the
page.

Rather than using <slot/> to render the inner code fence, which seems
to not play well with the rest of the page, we instead skip rendering
the inner content altogether, and pass the data as astroRawData to the
underlying React component. This removes the need to handle
HTML/attribute parsing, so it is much cleaner in addition to resolving
conflicts.

Note: Also fixed some of the previous JSON content as they were invalid.

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #
Flat config overrides util may fail when it isn't a plain JS object.
This PR makes the hasOverrides function more robust against these
cases.

Fixes #31796

(cherry picked from commit 05bd3a4)

jaysoo and others added 2 commits April 15, 2026 14:23
Flat config overrides util may fail when it isn't a plain JS object.
This PR makes the `hasOverrides` function more robust against these
cases.

Fixes #31796

(cherry picked from commit 05bd3a4)
The migration generator (`@nx/plugin:migration`) fails when due to
ESLint flat config not being parsed correctly, leading to an error.

This happens because `replaceOverride` uses `parseTextToJson` to parse
the config, which fails for non-JSON-serializable JavaScript
expressions.

This PR fixes the issue by using AST parsing, like we did for
`hasOverrides` here #33548.

Fixes #34010

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 9fb5a6c)
@llwt llwt requested a review from a team as a code owner April 15, 2026 20:19
@llwt llwt requested a review from meeroslav April 15, 2026 20:19
@llwt llwt changed the title fix(linter): handle various flat config override structures (#33548) fix(linter): handle variable references in replaceOverride (#34026) Apr 15, 2026
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 15, 2026

View your CI Pipeline Execution ↗ for commit cf4fc13

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ❌ Failed 13m 50s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 19s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 6s View ↗
nx documentation ✅ Succeeded 1m 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-17 19:20:42 UTC

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

ktfmt... is supposed to be pinned

ktfmt is now actually pinned

(cherry picked from commit 537543e)

chore: formatting

chore(linter): format ast-utils.ts

Co-authored-by: llwt <llwt@users.noreply.github.com>

chore(eslint): format ast-utils.ts

Co-authored-by: llwt <llwt@users.noreply.github.com>

fix(eslint): restore generic type arguments

Co-authored-by: llwt <llwt@users.noreply.github.com>
@llwt llwt force-pushed the backport-34026-to-21.6.x branch from bdba10a to 433ef1e Compare April 17, 2026 16:09
nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud has identified a possible root cause for your failed CI:

We determined this failure is unrelated to the PR changes, which only touch ktfmt version pinning and ESLint flat config utilities — neither of which could affect React library build output or JSX transform behavior. The failing tests in e2e-react appear to stem from a pre-existing environment issue with rollup-plugin-typescript2 and JSX development transforms, as e2e-react is not among the touched projects in this PR.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants