fix(tsgolint): use primary span for the disable directive#20436
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
|
This run croaked 😵 The workflow encountered an error before any progress could be reported. Please check the link below for details. |
There was a problem hiding this comment.
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-parameterswith anoxlint-disable-next-linedirective.
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.
Merging this PR will not alter performance
Comparing Footnotes
|
561fb48 to
f5c50a3
Compare
Merge activity
|
f5c50a3 to
0c57312
Compare
There was a problem hiding this comment.
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_diagnosticto 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.


fixes oxc-project/tsgolint#769