Skip to content

test(linter/plugins): use @typescript-eslint/typescript-estree package directly in conformance build#16774

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-12-test_linter_plugins_use_typescript-eslint_typescript-estree_package_directly_in_conformance_build
Dec 12, 2025
Merged

test(linter/plugins): use @typescript-eslint/typescript-estree package directly in conformance build#16774
graphite-app[bot] merged 1 commit intomainfrom
12-12-test_linter_plugins_use_typescript-eslint_typescript-estree_package_directly_in_conformance_build

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 12, 2025

In build for conformance tests, use @typescript-eslint/typescript-estree package directly instead of the ts_eslint.cjs, to get stack traces for parsing failures.

Only affects conformance build - release and debug (tests) builds both use ts_eslint.cjs bundle, same as before.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them labels Dec 12, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review December 12, 2025 11:48
Copilot AI review requested due to automatic review settings December 12, 2025 11:48
@overlookmotel overlookmotel self-assigned this Dec 12, 2025
Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

The biggest concern is snapshot brittleness: embedding pnpm’s full virtual-store paths (with exact versions) will cause frequent, noisy churn on dependency updates. In tokens.ts, the conformance-only conditional require() should have a more actionable failure mode (and optionally a fallback) to reduce confusing runtime breakage. The TODO comment could be clarified to reflect whether the long-term goal is “back to bundle” or “bundle with good stack traces.”

Additional notes (2)
  • Readability | apps/oxlint/src-js/plugins/tokens.ts:153-163
    This branch relies on a build-time CONFORMANCE flag to decide which module to load. Two risks to watch:
  1. If CONFORMANCE is ever true in an environment where @typescript-eslint/typescript-estree isn’t installed/available (e.g., different dependency set for that build), initialization will fail at runtime.
  2. The direct package vs bundled ts_eslint.cjs may not be perfectly behaviorally identical (transitive deps, parser defaults, patching/shims in the bundle). That’s acceptable for stack traces, but it increases the chance of conformance-only divergence.

At minimum, it’d be good to make the failure mode actionable by catching the require() error and rethrowing with a message that explains how to fix the build/deps.

  • Maintainability | apps/oxlint/src-js/plugins/tokens.ts:156-157
    The TODO says to switch conformance back to the bundle once parse errors are fixed, but the change rationale in the PR description is to get stack traces for parsing failures. If the long-term goal is improved debug-ability, switching back later would regress stack trace quality.

If the actual long-term plan is “bundle should preserve readable stack traces,” capture that explicitly (e.g., TODO to generate source maps / preserve function names in the bundle), otherwise the TODO is likely to be misleading and get removed/ignored.

Summary of changes

Summary

Conformance snapshots

  • Updated apps/oxlint/conformance/snapshot.md to reflect improved stack traces coming from @typescript-eslint/typescript-estree internals (e.g. createError, convertError, parser.js) instead of the bundled apps/oxlint/dist/ts_eslint.cjs frames.

TS-ESLint token initialization

  • Updated apps/oxlint/src-js/plugins/tokens.ts to conditionally require() either the direct @typescript-eslint/typescript-estree package (for conformance builds) or the local ./ts_eslint.cjs bundle (for other builds), and then set tsEslintParse = mod.parse.
  • Added comments documenting the conformance-only behavior and a TODO to revert once parse errors are addressed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the conformance build to use the @typescript-eslint/typescript-estree package directly instead of the bundled ts_eslint.cjs file. This change provides detailed stack traces for parsing failures, making it easier to debug issues during conformance testing. The change only affects the conformance build (gated by the CONFORMANCE flag), while release and debug builds continue to use the bundled version as before.

Key Changes

  • Modified token initialization to conditionally require either the direct package or the bundle based on the CONFORMANCE flag
  • Updated conformance test snapshots to reflect the more detailed stack traces from the unbundled parser

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/oxlint/src-js/plugins/tokens.ts Added conditional logic to load @typescript-eslint/typescript-estree directly in conformance builds instead of the bundled ts_eslint.cjs
apps/oxlint/conformance/snapshot.md Updated stack traces in test snapshots to show detailed paths from the unbundled parser instead of minified bundle references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
Copy link
Member Author

overlookmotel commented Dec 12, 2025

Merge activity

…age directly in conformance build (#16774)

In build for conformance tests, use `@typescript-eslint/typescript-estree` package directly instead of the `ts_eslint.cjs`, to get stack traces for parsing failures.

Only affects conformance build - release and debug (tests) builds both use `ts_eslint.cjs` bundle, same as before.
@graphite-app graphite-app bot force-pushed the 12-12-test_linter_plugins_use_typescript-eslint_typescript-estree_package_directly_in_conformance_build branch from 7b951e8 to daa3866 Compare December 12, 2025 11:55
@graphite-app graphite-app bot merged commit daa3866 into main Dec 12, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-12-test_linter_plugins_use_typescript-eslint_typescript-estree_package_directly_in_conformance_build branch December 12, 2025 12:01
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants