Skip to content

fix(tsgolint): use primary span for the disable directive#20436

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive
Mar 16, 2026
Merged

fix(tsgolint): use primary span for the disable directive#20436
graphite-app[bot] merged 1 commit intomainfrom
c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 16, 2026


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 changes, fast-track this PR to the front of the merge queue

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-bug Category - Bug labels Mar 16, 2026
@camc314 camc314 marked this pull request as ready for review March 16, 2026 19:02
Copilot AI review requested due to automatic review settings March 16, 2026 19:02
@pullfrog
Copy link
Copy Markdown

pullfrog bot commented Mar 16, 2026

This run croaked 😵

The workflow encountered an error before any progress could be reported. Please check the link below for details.

Pullfrog  | Rerun failed job ➔View workflow run | Triggered by Pullfrogpullfrog.com𝕏

Copy link
Copy Markdown
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 improves how oxlint applies oxlint-disable-* directives to type-aware (tsgolint) diagnostics when those diagnostics include labeled ranges, and extends the CLI fixture coverage for that case.

Changes:

  • Update tsgolint disable-directive span selection to prefer the diagnostic’s main span when present, falling back to the first labeled range only when the main span is unspanned.
  • Extend the existing CLI snapshot test to lint an additional fixture file that exercises the labeled-ranges disable-directive scenario.
  • Add a new TypeScript fixture file covering typescript/no-unnecessary-type-parameters with an oxlint-disable-next-line directive.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/tsgolint.rs Adjusts which span is used when checking whether a tsgolint diagnostic should be suppressed by disable directives.
apps/oxlint/src/lint.rs Updates the CLI snapshot test arguments to include a new fixture file in the run.
apps/oxlint/fixtures/cli/tsgolint_disable_directives/no-unnecessary-type-parameters-disable.ts Adds fixture content to validate disable directives for a labeled-ranges tsgolint diagnostic.

You can also share your feedback on Copilot code review. Take the survey.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 16, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive (0c57312) with main (5c104ff)2

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (b82d37c) during the generation of this report, so 5c104ff was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 force-pushed the c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive branch from 561fb48 to f5c50a3 Compare March 16, 2026 19:12
@camc314 camc314 requested a review from Copilot March 16, 2026 19:50
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Mar 16, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive branch from f5c50a3 to 0c57312 Compare March 16, 2026 19:52
Copy link
Copy Markdown
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 adjusts how type-aware (tsgolint) diagnostics are matched against inline disable directives, and adds a regression fixture to ensure disable directives still work when tsgolint emits labeled ranges.

Changes:

  • Update should_skip_diagnostic to prefer the main diagnostic span, falling back to the first labeled range only when the main span is unspanned.
  • Update the CLI snapshot test invocation for tsgolint disable-directive behavior.
  • Add a new fixture file covering a labeled-ranges disable-directive scenario.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/tsgolint.rs Refines span selection used to decide whether a tsgolint diagnostic should be suppressed by disable directives.
apps/oxlint/src/lint.rs Adjusts the tsgolint disable-directives snapshot test arguments.
apps/oxlint/fixtures/cli/tsgolint_disable_directives/no-unnecessary-type-parameters-disable.ts Adds a regression fixture demonstrating disable directives with labeled-range diagnostics.

You can also share your feedback on Copilot code review. Take the survey.

@graphite-app graphite-app bot merged commit 0c57312 into main Mar 16, 2026
22 checks passed
@graphite-app graphite-app bot deleted the c/03-16-fix_tsgolint_use_primary_span_for_the_disable_directive branch March 16, 2026 20:03
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 C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Disable for this line" code action puts the comment on the wrong line (typescript/no-unnecessary-type-parameters)

2 participants