+
Skip to content

Conversation

Conaclos
Copy link
Member

Summary

Implements #7174

useConst no longer reports variables read before to be written.

Previously, useConst reported uninitialised variables that were read in an inner function before being written, as shown in the following example::

let v;
function f() {
    return v;
}
v = 0;

This can produce false positives in the case where f is called before v has be written as in the following code:

let v;
function f() {
    return v;
}
console.log(f()); // print `undefined`
v = 0;

Although this is an expected behavior of the original implementation, we consider it problematic since the rule fix is marked as safe.
To avoid false positives like this, the rule now ignores the previous examples.
However, this has the disadvantage of resulting in false negatives, such as reporting the first code.

Test Plan

I updated the rule's test snapshots.

Docs

Not applicable.

Copy link

changeset-bot bot commented Aug 13, 2025

🦋 Changeset detected

Latest commit: 6322891

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

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

Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Walkthrough

Adds a changeset for a minor release of @biomejs/biome and modifies the useConst lint: it no longer reports bindings whose very first reference is a read from an inner function before a later write. The lint logic is simplified to bail out when the first reference is a read; AnyJsControlFlowRoot import removed and Semantic path switched to crate::services::semantic::Semantic. A Caveats docs note about potential false negatives was added, a comment typo fixed, and no public API signatures were changed.

Suggested labels

A-Linter, L-JavaScript


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 176ef1b and 6322891.

📒 Files selected for processing (1)
  • .changeset/tired-results-knock.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/tired-results-knock.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch useConst-7174

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Aug 13, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
.changeset/tired-results-knock.md (5)

5-5: Grammar: “read before to be written” → “read before being written”.

Clearer and idiomatic phrasing; keeps intent intact.

Apply this diff:

-Implemented [#7174](https://github.com/biomejs/biome/issues/7174). [`useConst`](https://biomejs.dev/linter/rules/use-const/) no longer reports variables read before to be written.
+Implemented [#7174](https://github.com/biomejs/biome/issues/7174). [`useConst`](https://biomejs.dev/linter/rules/use-const/) no longer reports variables that are read before being written.

7-7: Typo and punctuation: remove double colon.

Single colon reads better here.

-Previously, `useConst` reported uninitialised variables that were read in an inner function before being written, as shown in the following example::
+Previously, `useConst` reported uninitialised variables that were read in an inner function before being written, as shown in the following example:

17-17: Grammar: “has be written” → “has been written”; optional comma.

Polishes the sentence and matches the style guide.

-This can produce false positives in the case where `f` is called before `v` has be written as in the following code:
+This can produce false positives in the case where `f` is called before `v` has been written, as in the following code:

28-28: Possessive fix: “rule fix” → “rule’s fix”.

Small readability improvement.

-Although this is an expected behavior of the original implementation, we consider it problematic since the rule fix is marked as safe.
+Although this is an expected behavior of the original implementation, we consider it problematic since the rule’s fix is marked as safe.

30-31: Clarify the false-negative statement.

Make the example explicit.

-However, this has the disadvantage of resulting in false negatives, such as reporting the first code.
+However, this has the disadvantage of resulting in false negatives, such as not reporting the first example.
crates/biome_js_analyze/src/lint/style/use_const.rs (1)

219-221: Nit: pluralise comment and tighten wording.

Minor doc fix for clarity.

-    // If there are multiple assignment or the write is not in the same scope
+    // If there are multiple assignments, or if the write is not in the same scope
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62b7814 and 51bab34.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/style/useConst/invalid.jsonc.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (2)
  • .changeset/tired-results-knock.md (1 hunks)
  • crates/biome_js_analyze/src/lint/style/use_const.rs (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
.changeset/*.md

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

.changeset/*.md: Create changesets with just new-changeset; store them in .changeset/ with correct frontmatter (package keys and change type).
In changeset descriptions, follow content conventions: user-facing changes only; past tense for what you did; present tense for current behavior; link issues for fixes; link rules/assists; include representative code blocks; end every sentence with a period.
When adding headers in a changeset, only use #### or ##### levels.

Files:

  • .changeset/tired-results-knock.md
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Set version: "next" in declare_lint_rule! for new or changing rules
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When banning globals (e.g., console.log), consult the semantic model to avoid flagging locally shadowed bindings

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use the Semantic<> query and ctx.model() when semantic information is required; ensure the query runs in the phase where services are available

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When returning a code action, construct JsRuleAction with ctx.action_category(ctx.category(), ctx.group()) and ctx.metadata().applicability()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : If a rule provides code actions, add fix_kind to declare_lint_rule! and pass category and applicability in action()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When porting a lint rule, specify sources in declare_lint_rule! (e.g., RuleSource::Eslint(...).same() or .inspired())

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use meaningful, cross-language-capable rule names when appropriate; use language/framework-specific names when constrained

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use the declare_lint_rule! macro to declare each rule

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : If multiple services are needed, retrieve them via ctx.get_service::<Type>() and ensure the rule runs in a phase where they exist

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Set the language field in declare_lint_rule! to the primary language/dialect (js, jsx, ts, tsx)

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Access rule options within a rule via ctx.options()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
🪛 LanguageTool
.changeset/tired-results-knock.md

[grammar] ~17-~17: The verb form ‘be’ does not seem to be suitable in this context.
Context: ...case where f is called before v has be written as in the following code: ```j...

(HAVE_VB)


[uncategorized] ~17-~17: Possible missing comma found.
Context: ...e where f is called before v has be written as in the following code: ```js let v;...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
  • GitHub Check: autofix
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_formatter)
🔇 Additional comments (1)
crates/biome_js_analyze/src/lint/style/use_const.rs (1)

1-1: Import change looks correct.

Switching to crate::services::semantic::Semantic aligns with current services usage in this crate.

@ematipico
Copy link
Member

@Conaclos are you sure that the docs don't need to be updated? I mean we're changing the behaviour of the rule...

@Conaclos
Copy link
Member Author

@coderabbitai Please apply nitpick comments.

@Conaclos
Copy link
Member Author

@ematipico

are you sure that the docs don't need to be updated? I mean we're changing the behaviour of the rule...

This is an edge case. The previous behavior was not documented. Do you think it is worth to document a such case?

This comment was marked as resolved.

This comment was marked as resolved.

@ematipico
Copy link
Member

@ematipico

are you sure that the docs don't need to be updated? I mean we're changing the behaviour of the rule...

This is an edge case. The previous behavior was not documented. Do you think it is worth to document a such case?

I think we could just add a small paragraph saying "The rule doesn't detect...". This might prevent users from filing an issue regarding the past behaviour

@Conaclos
Copy link
Member Author

@ematipico fixed in aa779e9

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
crates/biome_js_analyze/src/lint/style/use_const.rs (1)

244-246: Don’t assume iterator yields source order; pick earliest by position.

Using next() on all_references(model) risks misclassifying the “first” reference unless the API guarantees source order. Select the minimum by text range start.

-    // If a read occurs before a write.
-    if binding.all_references(model).next()?.is_read() {
+    // If the first source-ordered reference is a read, skip reporting.
+    let first_is_read = binding
+        .all_references(model)
+        .min_by_key(|r| r.syntax().text_range().start())?
+        .is_read();
+    if first_is_read {
         return None;
     }

If the iterator order is guaranteed by contract, keep next() but add a brief comment citing that guarantee.

🧹 Nitpick comments (6)
.changeset/tired-results-knock.md (4)

5-5: Grammar: “before being written”.

Tweak the phrasing for clarity.

-Implemented [#7174](https://github.com/biomejs/biome/issues/7174). [`useConst`](https://biomejs.dev/linter/rules/use-const/) no longer reports variables read before to be written.
+Implemented [#7174](https://github.com/biomejs/biome/issues/7174). [`useConst`](https://biomejs.dev/linter/rules/use-const/) no longer reports variables read before being written.

7-8: Typos: double colon and inconsistent spelling.

  • Single colon after “example”.
  • Prefer “uninitialized” to stay consistent with the rest of the docs.
-Previously, `useConst` reported uninitialised variables that were read in an inner function before being written, as shown in the following example::
+Previously, `useConst` reported uninitialized variables that were read in an inner function before being written, as shown in the following example:

17-17: Grammar: “has been written, …”.

Fix verb form and add a comma for the subordinate clause.

-This can produce false positives in the case where `f` is called before `v` has be written as in the following code:
+This can produce false positives when `f` is called before `v` has been written, as in the following code:

28-31: Wording: clarify rationale and consequence.

  • “rule’s fix” reads better.
  • Spell out the false-negative example.
-Although this is an expected behavior of the original implementation, we consider it problematic since the rule fix is marked as safe.
-To avoid false positives like this, the rule now ignores the previous examples.
-However, this has the disadvantage of resulting in false negatives, such as reporting the first code.
+Although this was expected behavior of the original implementation, we consider it problematic because the rule's fix is marked as safe.
+To avoid false positives like this, the rule now ignores this pattern.
+However, this has the disadvantage of resulting in false negatives, such as not reporting the first example.
crates/biome_js_analyze/src/lint/style/use_const.rs (2)

74-86: Nice “Caveats” addition; confirm or avoid hard-coding the version.

The note is helpful. If “v2.2” isn’t final, either confirm it or remove the version to prevent staleness.

Proposed version-agnostic wording:

-    /// Since v2.2, the rule no longer reports variables that are read in an inner function before being written.
+    /// The rule no longer reports variables that are read in an inner function before being written.

232-233: Tiny typo in comment.

Plural noun.

-    // If there are multiple assignment or the write is not in the same scope
+    // If there are multiple assignments or the write is not in the same scope
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51bab34 and 176ef1b.

📒 Files selected for processing (2)
  • .changeset/tired-results-knock.md (1 hunks)
  • crates/biome_js_analyze/src/lint/style/use_const.rs (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
.changeset/*.md

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

.changeset/*.md: Create changesets with just new-changeset; store them in .changeset/ with correct frontmatter (package keys and change type).
In changeset descriptions, follow content conventions: user-facing changes only; past tense for what you did; present tense for current behavior; link issues for fixes; link rules/assists; include representative code blocks; end every sentence with a period.
When adding headers in a changeset, only use #### or ##### levels.

Files:

  • .changeset/tired-results-knock.md
🧠 Learnings (11)
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When banning globals (e.g., console.log), consult the semantic model to avoid flagging locally shadowed bindings

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When returning a code action, construct JsRuleAction with ctx.action_category(ctx.category(), ctx.group()) and ctx.metadata().applicability()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : If a rule provides code actions, add fix_kind to declare_lint_rule! and pass category and applicability in action()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When porting a lint rule, specify sources in declare_lint_rule! (e.g., RuleSource::Eslint(...).same() or .inspired())

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use meaningful, cross-language-capable rule names when appropriate; use language/framework-specific names when constrained

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use the declare_lint_rule! macro to declare each rule

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use the Semantic<> query and ctx.model() when semantic information is required; ensure the query runs in the phase where services are available

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : If multiple services are needed, retrieve them via ctx.get_service::<Type>() and ensure the rule runs in a phase where they exist

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Set the language field in declare_lint_rule! to the primary language/dialect (js, jsx, ts, tsx)

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Access rule options within a rule via ctx.options()

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_const.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • .changeset/tired-results-knock.md
🪛 LanguageTool
.changeset/tired-results-knock.md

[grammar] ~17-~17: The verb form ‘be’ does not seem to be suitable in this context.
Context: ...case where f is called before v has be written as in the following code: ```j...

(HAVE_VB)


[uncategorized] ~17-~17: Possible missing comma found.
Context: ...e where f is called before v has be written as in the following code: ```js let v;...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: autofix
🔇 Additional comments (2)
.changeset/tired-results-knock.md (1)

1-3: Frontmatter looks correct for a minor bump.

Package and change type are set as expected.

crates/biome_js_analyze/src/lint/style/use_const.rs (1)

1-1: Import path change looks good.

Switching to crate::services::semantic::Semantic is consistent with the crate layout.

@Conaclos Conaclos merged commit 2afaa49 into main Aug 13, 2025
29 checks passed
@Conaclos Conaclos deleted the useConst-7174 branch August 13, 2025 10:09
@github-actions github-actions bot mentioned this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载