Skip to content

fix(linter): add help guidance to eslint diagnostic messages#19562

Merged
camc314 merged 3 commits intooxc-project:mainfrom
anthonyamaro15:fix/eslint-add-help-diagnostics
Feb 20, 2026
Merged

fix(linter): add help guidance to eslint diagnostic messages#19562
camc314 merged 3 commits intooxc-project:mainfrom
anthonyamaro15:fix/eslint-add-help-diagnostics

Conversation

@anthonyamaro15
Copy link
Contributor

@anthonyamaro15 anthonyamaro15 commented Feb 20, 2026

PR covers:

Closes #19121 (partially)

Add .with_help() to 4 ESLint rule diagnostics to help developers understand how to resolve warnings:

  • no-undef: "Either define '{name}' or remove the reference to it. If '{name}' is a global
    variable, add it to the 'globals' configuration."

  • no-setter-return: "Remove the return statement or ensure it does not return a value."

  • no-unreachable: "Remove the unreachable code or fix the control flow to make it reachable."

    3 rule files changed + 3 corresponding snapshot updates.

Copilot AI review requested due to automatic review settings February 20, 2026 01:59
@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Feb 20, 2026
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 pull request adds .with_help() to 4 ESLint rule diagnostics to address issue #19121, which identified lint diagnostics that were missing help text or notes. The changes add helpful guidance messages to help developers understand how to resolve the warnings for the following rules:

Changes:

  • Added help text to no-undef, no-setter-return, no-unreachable, and prefer-numeric-literals diagnostic messages
  • Updated corresponding snapshot files to reflect the new help messages

Reviewed changes

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

Show a summary per file
File Description
crates/oxc_linter/src/rules/eslint/no_undef.rs Added help message guiding developers to define the variable, remove the reference, or add it to globals configuration
crates/oxc_linter/src/rules/eslint/no_setter_return.rs Added help message to remove return statement or ensure it doesn't return a value
crates/oxc_linter/src/rules/eslint/no_unreachable.rs Added help message to remove unreachable code or fix control flow
crates/oxc_linter/src/rules/eslint/prefer_numeric_literals.rs Added generic help message to use numeric literal syntax instead of parseInt()
crates/oxc_linter/src/snapshots/eslint_no_undef.snap Updated snapshot with new help messages
crates/oxc_linter/src/snapshots/eslint_no_setter_return.snap Updated snapshot with new help messages
crates/oxc_linter/src/snapshots/eslint_no_unreachable.snap Updated snapshot with new help messages
crates/oxc_linter/src/snapshots/eslint_prefer_numeric_literals.snap Updated snapshot with new help messages

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 20, 2026

Merging this PR will not alter performance

✅ 47 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing anthonyamaro15:fix/eslint-add-help-diagnostics (d467b42) with main (89b58d0)

Open in CodSpeed

Footnotes

  1. 3 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.

@anthonyamaro15 anthonyamaro15 force-pushed the fix/eslint-add-help-diagnostics branch from 8c6fc71 to d2088d4 Compare February 20, 2026 02:14
@github-actions github-actions bot added the A-cli Area - CLI label Feb 20, 2026
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

Thank you!

@camc314 camc314 self-assigned this Feb 20, 2026
@camc314 camc314 merged commit 421a99c into oxc-project:main Feb 20, 2026
29 checks passed
camc314 pushed a commit that referenced this pull request Feb 23, 2026
# Oxlint
### 🚀 Features

- 46177dd linter: Implement unicorn/prefer-module (#19603) (camc314)
- 42f78bb linter: Implement unicorn/prefer-ternary (#19605) (camc314)

### 🐛 Bug Fixes

- 43df857 react/exhaustive-deps: Normalize .current callback deps
(#19610) (camc314)
- 574f48f linter/no-throw-literal: Close warning block (#19612)
(camc314)
- 79fe3b4 linter/prefer-mock-return-shorthand: Avoid unsafe autofixes
for call-like returns (#19581) (camc314)
- 85045e8 linter: Check protected members in
explicit-module-boundary-types (#19594) (camc314)
- e38115e linter: Catch missing return type on exported arrow/function
expressions (#19587) (Peter Wagenet)
- 419d3fd linter: Fix false negatives in typescript/no-require-imports
(#19589) (Peter Wagenet)
- 7958b56 linter: Fix syntax error reporting in some output formatters.
(#19590) (connorshea)
- 024f51c linter: Add help text to more eslint diagnostics (#19591)
(Anthony Amaro)
- a8489a1 linter: Warning `eslint/no-throw-literal` rule to be
deprecated, better use `typescript/only-throw-error` (#19593) (Said
Atrahouch)
- 50fc70d linter/type-aware: Use correct span for disable directives
(#19576) (camc314)
- 421a99c linter: Add help guidance to eslint diagnostic messages
(#19562) (Anthony Amaro)
- e81364a linter: Add help text to eslint rule diagnostics (#19560)
(Anthony Amaro)
- 89b58d0 linter: Add help text to more eslint rule diagnostics (#19561)
(Anthony Amaro)
- 74f7833 linter/jest/prefer-mock-return-shorthand: Preserve typed arrow
returns (#19556) (camc314)
- bdd6f34 linter: Restrict prefer-import-in-mock to mock calls (#19555)
(camc314)

### 📚 Documentation

- a331993 linter: Improve docs for `eslint/radix` rule. (#19611)
(connorshea)

### 🛡️ Security

- c67f9dc linter: Update ajv version. (#19613) (connorshea)
# Oxfmt
### 🚀 Features

- 984dc07 oxfmt: Strip `"experimental"SortXxx` prefix (#19567)
(leaysgur)

### 🐛 Bug Fixes

- d7b63a4 oxfmt: Update API types for `sortPackageJsonOptions` (#19569)
(leaysgur)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
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.

linter: Add help or notes to diagnostics only containing a message

3 participants