Skip to content

fix(linter): add help text to more eslint diagnostics#19591

Merged
camc314 merged 4 commits into
oxc-project:mainfrom
anthonyamaro15:fix/eslint-diagnostics-help-text-5
Feb 21, 2026
Merged

fix(linter): add help text to more eslint diagnostics#19591
camc314 merged 4 commits into
oxc-project:mainfrom
anthonyamaro15:fix/eslint-diagnostics-help-text-5

Conversation

@anthonyamaro15

Copy link
Copy Markdown
Contributor

…sion, no_self_assign,

PR covers:

Add .with_help() to diagnostics that only provide a warning message, giving developers actionable guidance on how to resolve each issue.

Part of #19121

  • no_loss_of_precision: Use a number literal that fits 64-bit floating-point precision
  • no_self_assign: Remove the self-assignment or assign to a different variable
  • prefer_promise_reject_errors: Pass an Error object to reject()
  • no_labels: Refactor code to eliminate the need for labels
  • no_useless_catch: Remove unnecessary try/catch wrapper or catch clause

Copilot AI review requested due to automatic review settings February 21, 2026 05:10
@github-actions github-actions Bot added A-linter Area - Linter C-bug Category - Bug labels Feb 21, 2026

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 adds help text to five ESLint linter diagnostics that previously only provided warning messages, making them more actionable for developers. This is part of a broader effort (issue #19121) to ensure all linter diagnostics include helpful guidance.

Changes:

  • Added .with_help() to diagnostic functions for five ESLint rules: no_loss_of_precision, no_self_assign, prefer_promise_reject_errors, no_labels, and no_useless_catch
  • Updated all corresponding snapshot test files to reflect the new help text in diagnostic output

Reviewed changes

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

Show a summary per file
File Description
crates/oxc_linter/src/rules/eslint/prefer_promise_reject_errors.rs Added help text advising to pass Error objects to reject()
crates/oxc_linter/src/rules/eslint/no_useless_catch.rs Added help text for both diagnostic functions (wrapper and finalizer cases)
crates/oxc_linter/src/rules/eslint/no_self_assign.rs Added help text advising to remove self-assignment or use different variable
crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs Added help text advising to use 64-bit floating-point compatible literals
crates/oxc_linter/src/rules/eslint/no_labels.rs Added help text advising to refactor code to eliminate labels
crates/oxc_linter/src/snapshots/eslint_prefer_promise_reject_errors.snap Updated snapshot with new help text for all test cases
crates/oxc_linter/src/snapshots/eslint_no_useless_catch.snap Updated snapshot with new help text for all test cases
crates/oxc_linter/src/snapshots/eslint_no_self_assign.snap Updated snapshot with new help text for all test cases
crates/oxc_linter/src/snapshots/eslint_no_loss_of_precision.snap Updated snapshot with new help text for all test cases
crates/oxc_linter/src/snapshots/eslint_no_labels.snap Updated snapshot with new help text for all test cases

@codspeed-hq

codspeed-hq Bot commented Feb 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 47 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing anthonyamaro15:fix/eslint-diagnostics-help-text-5 (54db0e8) with main (429d064)

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.

@github-actions github-actions Bot added the A-cli Area - CLI label Feb 21, 2026

@camc314 camc314 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.

Thank you!

@camc314 camc314 changed the title fix(linter): add help text to eslint diagnostics for no_loss_of_preci… fix(linter): add help text to more eslint diagnostics Feb 21, 2026
@camc314 camc314 self-assigned this Feb 21, 2026
@camc314 camc314 merged commit 024f51c into oxc-project:main Feb 21, 2026
30 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.

3 participants