fix(linter): add help text to more eslint rule diagnostics#19561
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds helpful diagnostic messages to 5 ESLint rules that previously lacked them, partially addressing issue #19121. The changes provide users with actionable guidance on how to fix linting violations.
Changes:
- Added
.with_help()to 5 ESLint rule diagnostics with clear, actionable guidance - Updated corresponding snapshot files to reflect the new help text
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/oxc_linter/src/rules/eslint/no_async_promise_executor.rs |
Added help text instructing users to remove the async keyword |
crates/oxc_linter/src/rules/eslint/no_undefined.rs |
Added help text about avoiding undefined identifier (contains an error) |
crates/oxc_linter/src/rules/eslint/no_class_assign.rs |
Added help text suggesting a different variable name |
crates/oxc_linter/src/rules/eslint/no_global_assign.rs |
Added help text recommending use of local variables |
crates/oxc_linter/src/rules/eslint/no_throw_literal.rs |
Replaced specific fix instructions with generic educational help text (appropriate for conditional_suggestion rules) |
crates/oxc_linter/src/snapshots/eslint_no_async_promise_executor.snap |
Updated snapshot to reflect new help text |
crates/oxc_linter/src/snapshots/eslint_no_undefined.snap |
Updated snapshot to reflect new help text |
crates/oxc_linter/src/snapshots/eslint_no_class_assign.snap |
Updated snapshot to reflect new help text |
crates/oxc_linter/src/snapshots/eslint_no_global_assign.snap |
Updated snapshot to reflect new help text |
crates/oxc_linter/src/snapshots/eslint_no_throw_literal.snap |
Updated snapshot with generic help text replacing specific fix instructions |
Merging this PR will not alter performance
Comparing Footnotes
|
# 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>
PR covers:
Closes #19121 (partially)
Add
.with_help()to 5 more ESLint rule diagnostics:no-async-promise-executor: "Remove theasynckeyword from the Promise executor function."no-undefined: "Avoid usingundefineddirectly as an identifier. Usenullinstead."no-class-assign: "Use a different variable name instead of re-assigning the class declaration."no-global-assign: "Use a local variable instead of modifying the global '{global_name}'."no-throw-literal: "Throwing literals or non-Error objects is not recommended. Use an Errorobject instead."
5 rule files changed + 5 corresponding snapshot updates.