docs(linter): Improve the diagnostics for jest/no-confusing-set-timeout rule.#16815
docs(linter): Improve the diagnostics for jest/no-confusing-set-timeout rule.#16815graphite-app[bot] merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Diagnostics are improved overall, but the new helper name is slightly unclear and the new message has a small grammar nit (“in a global scope” vs “in the global scope”). These are minor, user-facing polish items and don’t affect correctness.
Additional notes (1)
- Readability |
crates/oxc_linter/src/rules/jest/no_confusing_set_timeout.rs:15-17
The function namenon_global_set_timeout_diagnosticreads a bit awkwardly and is slightly ambiguous (it could be interpreted as “a diagnostic about non-global setTimeout” vs “diagnostic for setTimeout not in global scope”). Since the message is specifically about scope, a name that encodes that intent tends to be easier to scan and maintain.
Summary of changes
Summary
- Renamed the diagnostic helper from
no_global_set_timeout_diagnostictonon_global_set_timeout_diagnostic. - Improved the warning message for non-global
jest.setTimeoutusage to be clearer and grammatically correct. - Added a trailing period to the “placed before any other jest methods” warning message.
- Updated the snapshot file
crates/oxc_linter/src/snapshots/jest_no_confusing_set_timeout.snapto match the revised diagnostics.
There was a problem hiding this comment.
Pull request overview
This PR improves the diagnostic messages for the jest/no-confusing-set-timeout linter rule by fixing grammatical errors and improving clarity. The changes make the error messages more readable and professional.
Key changes:
- Fixed grammatical error: "should be call" → "should only be called"
- Improved clarity: "call in
globalscope" → "called in a global scope" - Renamed function from
no_global_set_timeout_diagnostictonon_global_set_timeout_diagnosticfor better semantic accuracy - Added period to one diagnostic message for consistency (though this creates inconsistency within the file)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/oxc_linter/src/rules/jest/no_confusing_set_timeout.rs |
Updated diagnostic message text to fix grammar, improved function naming, and added punctuation |
crates/oxc_linter/src/snapshots/jest_no_confusing_set_timeout.snap |
Updated snapshot file to reflect the improved diagnostic messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #16815 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
…ut rule. (#16815) Minor improvements for the diagnostics used in this rule.
182fba2 to
bbafba5
Compare
Minor improvements for the diagnostics used in this rule.