Conversation
🦋 Changeset detectedLatest commit: f61619d The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c89f59e to
f44d1d9
Compare
bc5a66c to
e4d5b11
Compare
f44d1d9 to
c7d48f7
Compare
e4d5b11 to
f61619d
Compare
WalkthroughThis pull request enhances diagnostic output for three JavaScript linting rules: Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fair-snails-applaud.md:
- Line 5: Edit the changeset entry to link the rule documentation for
noGlobalObjectCalls: update the sentence that names `noGlobalObjectCalls` to
include a markdown link to the rule docs (e.g.,
`[noGlobalObjectCalls](https://biomejs.dev/linter/rules/no-global-object-calls/)`)
so the changeset references the rule page directly; ensure the link text uses
the exact rule name `noGlobalObjectCalls` and the URL points to the linter/rules
page for that rule.
In @.changeset/famous-zebras-end.md:
- Line 5: Update the changeset entry to hyperlink the rule name "noMultiStr" to
its documentation URL and, if this change corresponds to a tracked GitHub issue,
prepend the entry with "Fixed [`#NUMBER`](issue link)" using the issue number and
URL; edit the text in the changeset entry that currently mentions `noMultiStr`
so the rule name is an actual markdown link to the rule docs and add the Fixed
prefix only when a matching issue exists.
In @.changeset/wise-frogs-pretend.md:
- Line 5: Update the changeset text to include a clickable link to the rule
documentation for noInvalidUseBeforeDeclaration; edit the sentence "Improved the
`noInvalidUseBeforeDeclaration` diagnostic..." to replace the plain inline code
with a markdown link pointing to the rule docs (e.g.,
[noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration/))
so release notes directly navigate to the rule page while preserving the rest of
the description.
In `@crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs`:
- Around line 120-126: The diagnostic message created in RuleDiagnostic::new
using the variable non_callable currently reads "... cannot be called as a
function." and misses the `new` (constructor) case; update the message to a
neutral phrasing that covers both function calls and constructor calls (for
example, use wording like "cannot be invoked as a function or constructor" or
"cannot be called or constructed") so the diagnostic produced by
no_global_object_calls.rs correctly reflects both call and new usages.
In
`@crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs`:
- Around line 206-208: The sentence in the markup uses the incorrect article "a"
before declaration_kind_text, producing awkward grammar for types like "enum";
update the message in no_invalid_use_before_declaration.rs where the note is
constructed (the markup! block that references declaration_kind_text) to use
"this" instead of "a" (e.g., "Using this "{declaration_kind_text}" before it is
declared...") so the wording reads correctly for "enum"/"enum member".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 98569580-e4a2-40ed-8ea1-073ad609699f
⛔ Files ignored due to path filters (5)
crates/biome_js_analyze/tests/specs/correctness/noGlobalObjectCalls/invalid.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noInvalidUseBeforeDeclaration/invalid.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noInvalidUseBeforeDeclaration/invalid.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noInvalidUseBeforeDeclaration/invalidBindingPattern.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noMultiStr/invalid.js.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (6)
.changeset/fair-snails-applaud.md.changeset/famous-zebras-end.md.changeset/wise-frogs-pretend.mdcrates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rscrates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rscrates/biome_js_analyze/src/lint/nursery/no_multi_str.rs
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Improved the `noGlobalObjectCalls` diagnostic to better explain why calling global objects like `Math` or `JSON` is invalid and how to fix it. |
There was a problem hiding this comment.
Please link the rule docs in the changeset entry.
The text names noGlobalObjectCalls but does not link to the rule documentation, which makes release notes less actionable.
Suggested edit
-Improved the `noGlobalObjectCalls` diagnostic to better explain why calling global objects like `Math` or `JSON` is invalid and how to fix it.
+Improved the [`noGlobalObjectCalls`](https://biomejs.dev/linter/rules/no-global-object-calls/) diagnostic to better explain why calling global objects like `Math` or `JSON` is invalid and how to fix it.As per coding guidelines, "For changeset descriptions of bug fixes, reference the issue with a link (e.g., 'Fixed #4444'); for rule references, include links to the rule documentation (e.g., 'useAwesomeThing')".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Improved the `noGlobalObjectCalls` diagnostic to better explain why calling global objects like `Math` or `JSON` is invalid and how to fix it. | |
| Improved the [`noGlobalObjectCalls`](https://biomejs.dev/linter/rules/no-global-object-calls/) diagnostic to better explain why calling global objects like `Math` or `JSON` is invalid and how to fix it. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/fair-snails-applaud.md at line 5, Edit the changeset entry to
link the rule documentation for noGlobalObjectCalls: update the sentence that
names `noGlobalObjectCalls` to include a markdown link to the rule docs (e.g.,
`[noGlobalObjectCalls](https://biomejs.dev/linter/rules/no-global-object-calls/)`)
so the changeset references the rule page directly; ensure the link text uses
the exact rule name `noGlobalObjectCalls` and the URL points to the linter/rules
page for that rule.
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Improved the `noMultiStr` diagnostic to explain why escaped multiline strings are discouraged and what to use instead. |
There was a problem hiding this comment.
Please hyperlink the rule name in the changeset entry.
This is user-facing release text, so noMultiStr should link to its rule docs; if there is a tracked issue, use the Fixed [#NUMBER](...) prefix too.
Suggested wording.
-Improved the `noMultiStr` diagnostic to explain why escaped multiline strings are discouraged and what to use instead.
+Improved the [`noMultiStr`](https://biomejs.dev/linter/rules/no-multi-str/) diagnostic to explain why escaped multiline strings are discouraged and what to use instead.As per coding guidelines: “For changeset descriptions of bug fixes, reference the issue with a link …; for rule references, include links to the rule documentation …”. Based on learnings: use the Fixed [#NUMBER](issue link) prefix only when a corresponding GitHub issue exists.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Improved the `noMultiStr` diagnostic to explain why escaped multiline strings are discouraged and what to use instead. | |
| Improved the [`noMultiStr`](https://biomejs.dev/linter/rules/no-multi-str/) diagnostic to explain why escaped multiline strings are discouraged and what to use instead. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/famous-zebras-end.md at line 5, Update the changeset entry to
hyperlink the rule name "noMultiStr" to its documentation URL and, if this
change corresponds to a tracked GitHub issue, prepend the entry with "Fixed
[`#NUMBER`](issue link)" using the issue number and URL; edit the text in the
changeset entry that currently mentions `noMultiStr` so the rule name is an
actual markdown link to the rule docs and add the Fixed prefix only when a
matching issue exists.
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Improved the `noInvalidUseBeforeDeclaration` diagnostic to better explain why using a declaration too early is problematic and how to fix it. |
There was a problem hiding this comment.
Link the rule name in the changeset text.
Nice summary, but this should link the rule docs so release notes are directly navigable.
✍️ Suggested tweak
-Improved the `noInvalidUseBeforeDeclaration` diagnostic to better explain why using a declaration too early is problematic and how to fix it.
+Improved the [`noInvalidUseBeforeDeclaration`](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration/) diagnostic to better explain why using a declaration too early is problematic and how to fix it.As per coding guidelines: "For changeset descriptions of bug fixes, reference the issue with a link (e.g., 'Fixed #4444'); for rule references, include links to the rule documentation (e.g., 'useAwesomeThing')".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Improved the `noInvalidUseBeforeDeclaration` diagnostic to better explain why using a declaration too early is problematic and how to fix it. | |
| Improved the [`noInvalidUseBeforeDeclaration`](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration/) diagnostic to better explain why using a declaration too early is problematic and how to fix it. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/wise-frogs-pretend.md at line 5, Update the changeset text to
include a clickable link to the rule documentation for
noInvalidUseBeforeDeclaration; edit the sentence "Improved the
`noInvalidUseBeforeDeclaration` diagnostic..." to replace the plain inline code
with a markdown link pointing to the rule docs (e.g.,
[noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration/))
so release notes directly navigate to the rule page while preserving the rest of
the description.
| Some( | ||
| RuleDiagnostic::new( | ||
| rule_category!(), | ||
| range, | ||
| markup! { | ||
| <Emphasis>{non_callable}</Emphasis>" cannot be called as a function." | ||
| }, |
There was a problem hiding this comment.
Diagnostic headline misses the new case.
At Line [125], the message says “called as a function”, but this rule also reports new <global>(). A neutral phrasing avoids mismatch.
Suggested tweak
- <Emphasis>{non_callable}</Emphasis>" cannot be called as a function."
+ <Emphasis>{non_callable}</Emphasis>" cannot be called or constructed."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@crates/biome_js_analyze/src/lint/correctness/no_global_object_calls.rs`
around lines 120 - 126, The diagnostic message created in RuleDiagnostic::new
using the variable non_callable currently reads "... cannot be called as a
function." and misses the `new` (constructor) case; update the message to a
neutral phrasing that covers both function calls and constructor calls (for
example, use wording like "cannot be invoked as a function or constructor" or
"cannot be called or constructed") so the diagnostic produced by
no_global_object_calls.rs correctly reflects both call and new usages.
| .note(markup! { | ||
| "Using a "{declaration_kind_text}" before it is declared makes the code depend on declaration order and hoisting behavior." | ||
| }) |
There was a problem hiding this comment.
Tidy the article to avoid a enum grammar.
This string reads awkwardly for enum/enum member. Using “this” avoids article agreement issues cleanly.
🛠️ Suggested fix
.note(markup! {
- "Using a "{declaration_kind_text}" before it is declared makes the code depend on declaration order and hoisting behavior."
+ "Using this "{declaration_kind_text}" before it is declared makes the code depend on declaration order and hoisting behavior."
})📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .note(markup! { | |
| "Using a "{declaration_kind_text}" before it is declared makes the code depend on declaration order and hoisting behavior." | |
| }) | |
| .note(markup! { | |
| "Using this "{declaration_kind_text}" before it is declared makes the code depend on declaration order and hoisting behavior." | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs`
around lines 206 - 208, The sentence in the markup uses the incorrect article
"a" before declaration_kind_text, producing awkward grammar for types like
"enum"; update the message in no_invalid_use_before_declaration.rs where the
note is constructed (the markup! block that references declaration_kind_text) to
use "this" instead of "a" (e.g., "Using this "{declaration_kind_text}" before it
is declared...") so the wording reads correctly for "enum"/"enum member".
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Improved the diagnostics for these rules. Split into separate PRs to hopefully make it a little more reviewable.
Generated by gpt 5.4, but I heavily guided the agent and reviewed all the new diagnostics myself.
Test Plan
snapshots
Docs