Skip to content

refactor(linter): remove MessageRule - #25031

Open
Sysix wants to merge 1 commit into
07-28-refactor_oxc_linter_remove_message.section_offset_propertyfrom
07-28-refactor_linter_remove_messagerule_
Open

refactor(linter): remove MessageRule#25031
Sysix wants to merge 1 commit into
07-28-refactor_oxc_linter_remove_message.section_offset_propertyfrom
07-28-refactor_linter_remove_messagerule_

Conversation

@Sysix

@Sysix Sysix commented Jul 28, 2026

Copy link
Copy Markdown
Member

This struct was introduced by Bulk-Suppressions (#19328).
OxcDiagnostic already contains OxcCode with the relevant information.

Downside: The oxc_parser diagnostics can be included now in the suppression file.

Sysix commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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.

@codspeed-hq

codspeed-hq Bot commented Jul 28, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 3.56%

⚡ 3 improved benchmarks
✅ 2 untouched benchmarks
⏩ 71 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation linter[react.development.js] 12.5 ms 12.1 ms +3.73%
Simulation linter[App.tsx] 63.7 ms 61.6 ms +3.51%
Simulation linter[binder.ts] 25.5 ms 24.6 ms +3.43%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing 07-28-refactor_linter_remove_messagerule_ (8c16760) with 07-28-refactor_oxc_linter_remove_message.section_offset_property (6c962d2)2

Open in CodSpeed

Footnotes

  1. 71 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 07-28-refactor_oxc_linter_remove_message.section_offset_property (0929b81) during the generation of this report, so 3372b69 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 refactors oxc_linter diagnostics by removing the dedicated MessageRule metadata and relying on OxcDiagnostic’s error code (scope + number) as the single source of truth for identifying the producing rule.

Changes:

  • Remove MessageRule and the Message::rule field, and stop attaching rule metadata via with_rule.
  • Introduce oxc_code_short_canonical_name(&OxcCode) and switch suppression tracking + ignore-fix generation to derive rule keys from message.error.code.
  • Update TypeScript Go-lint (tsgolint) message construction and core linter diagnostic emission to work without MessageRule.

Reviewed changes

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

Show a summary per file
File Description
crates/oxc_linter/src/tsgolint.rs Stop attaching MessageRule to TS Go-lint messages; rely on diagnostic error codes.
crates/oxc_linter/src/suppression/diff.rs Compute suppression keys from message.error.code via oxc_code_short_canonical_name.
crates/oxc_linter/src/lib.rs Remove MessageRule from re-exports; re-export new helper; adjust diagnostic ordering/emission accordingly.
crates/oxc_linter/src/fixer/mod.rs Delete MessageRule type and Message::rule; add oxc_code_short_canonical_name helper.
crates/oxc_linter/src/fixer/disable_fix.rs Generate ignore-disable directive rule names from the diagnostic error code.
crates/oxc_linter/src/context/mod.rs Stop populating Message::rule in LintContext::add_diagnostic (error code remains the rule identifier).
Comments suppressed due to low confidence (1)

crates/oxc_linter/src/suppression/diff.rs:111

  • The suppression key is now derived from message.error.code rather than MessageRule, which changes the canonicalization source (notably it will follow the diagnostic scope/display-name mapping like jsx-a11y, react-perf, next). There don’t appear to be suppression fixtures covering plugins whose internal name differs from the display name, so this behavior is currently untested and could regress silently.
            for message in diagnostics {
                // Only consider error severity messages for suppression tracking
                if message.error.severity != Severity::Error {
                    continue;
                }

                let Some(key) = oxc_code_short_canonical_name(&message.error.code) else {
                    continue;
                };

                suppression_tracking.entry(key).or_insert(DiagnosticCounts { count: 0 }).count += 1;
            }

Comment thread crates/oxc_linter/src/lib.rs
@Sysix
Sysix force-pushed the 07-28-refactor_linter_remove_messagerule_ branch from a95ecd6 to 8c16760 Compare July 28, 2026 20:52
@Sysix
Sysix force-pushed the 07-28-refactor_oxc_linter_remove_message.section_offset_property branch from 6c962d2 to 0929b81 Compare July 28, 2026 20:52
@Sysix
Sysix marked this pull request as ready for review July 28, 2026 21:00
@Sysix
Sysix requested a review from camc314 as a code owner July 28, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants