-
-
Notifications
You must be signed in to change notification settings - Fork 780
feat(lint): ported noMultiAssign from eslint
#8316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 68a711d 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 |
WalkthroughAdds a new JavaScript lint rule Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1).changeset/**/*.md📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
🧠 Learnings (14)📓 Common learnings📚 Learning: 2025-11-28T09:08:10.077ZApplied to files:
📚 Learning: 2025-11-28T09:08:10.077ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-28T09:08:10.077ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
📚 Learning: 2025-11-27T23:04:02.022ZApplied to files:
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this 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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (6)
.changeset/calm-spies-say.md(1 hunks)crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/no_multi_assign.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
.changeset/**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/**/*.md: Create changesets for user-facing changes usingjust new-changeset; use headers with####or#####only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use adiffcode block
Files:
.changeset/calm-spies-say.md
🧠 Learnings (33)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rs.changeset/calm-spies-say.mdcrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noConstant` prefix for rules that report computations always evaluated to the same value (e.g., `noConstantMathMinMaxClamp`)
Applied to files:
crates/biome_rule_options/src/lib.rs.changeset/calm-spies-say.mdcrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : No module may copy or clone data from another module in the module graph, not even behind an `Arc`
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_multi_assign.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.jscrates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.jscrates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.jscrates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.jscrates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization
Applied to files:
crates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_rule_options/src/no_multi_assign.rs
📚 Learning: 2025-11-28T09:08:10.077Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.077Z
Learning: Applies to .changeset/**/*.md : For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use a `diff` code block
Applied to files:
.changeset/calm-spies-say.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Applied to files:
.changeset/calm-spies-say.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
.changeset/calm-spies-say.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useShorthand` prefix for rules that report syntax rewritable using equivalent compact syntax (e.g., `useShorthandAssign`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Deprecate rules by adding a `deprecated` field to the `declare_lint_rule!` macro with a message explaining the reason for deprecation (e.g., 'Use the rule noAnotherVar')
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs
🧬 Code graph analysis (3)
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js (1)
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js (10)
a(18-18)a(19-19)a(23-23)a(24-24)a(25-25)a(25-25)a(26-27)a(26-27)b(20-20)c(21-21)
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js (1)
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js (3)
a(20-20)a(22-22)foo(4-4)
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs (1)
crates/biome_analyze/src/rule.rs (3)
recommended(602-605)sources(617-620)inspired(254-259)
🔇 Additional comments (5)
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/valid.js (1)
1-28: LGTM!The valid test cases provide good coverage of scenarios that shouldn't trigger the rule, including multiple declarators, for loops, and the edge case with computed property names.
.changeset/calm-spies-say.md (1)
1-11: LGTM!The changeset follows the guidelines: concise description, past tense for the addition, and includes a clear invalid example in a code block.
crates/biome_rule_options/src/lib.rs (1)
133-133: LGTM!The module export is correctly placed in alphabetical order and follows the project's pattern. The codegen header indicates this was properly generated.
crates/biome_rule_options/src/no_multi_assign.rs (1)
1-6: LGTM!The options struct correctly implements all required traits and follows the project's conventions. The empty struct is appropriate for a rule without configurable options.
crates/biome_js_analyze/src/lint/nursery/no_multi_assign.rs (1)
1-93: LGTM!The rule implementation is well-structured and correctly identifies chained assignments across variable declarations, class fields, and assignment expressions. The diagnostic message is clear and provides helpful guidance to users.
crates/biome_js_analyze/tests/specs/nursery/noMultiAssign/invalid.js
Outdated
Show resolved
Hide resolved
| name: "noMultiAssign", | ||
| language: "js", | ||
| recommended: false, | ||
| sources: &[RuleSource::Eslint("no-multi-assign").inspired()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sources: &[RuleSource::Eslint("no-multi-assign").inspired()], | |
| sources: &[RuleSource::Eslint("no-multi-assign").same()], |
I think it's the same, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used inspired, as there was an config option in the equivalent eslint rule, but I am yet to implement an option over here.
CodSpeed Performance ReportMerging #8316 will not alter performanceComparing Summary
Footnotes
|
Co-authored-by: Maikel van Dort <[email protected]>
| i Unexpected chained assignment. | ||
|
|
||
| 1 │ /* should generate diagnostics */ | ||
| 2 │ {var a = b = c;} | ||
| > 3 │ {var a = b = c = d;} | ||
| │ ^^^^^^^^^^^^^ | ||
| 4 │ {let foo = bar = cee = 100;} | ||
| 5 │ {a=b=c=d=e} | ||
|
|
||
| i Variables with chained assignments in declarations may cause unintended implicit globals or unexpected scoping. | ||
|
|
||
| i Split into separate assignments. | ||
|
|
||
|
|
||
| ``` | ||
|
|
||
| ``` | ||
| invalid.js:3:10 lint/nursery/noMultiAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| i Unexpected chained assignment. | ||
|
|
||
| 1 │ /* should generate diagnostics */ | ||
| 2 │ {var a = b = c;} | ||
| > 3 │ {var a = b = c = d;} | ||
| │ ^^^^^^^^^ | ||
| 4 │ {let foo = bar = cee = 100;} | ||
| 5 │ {a=b=c=d=e} | ||
|
|
||
| i Variables with chained assignments in declarations may cause unintended implicit globals or unexpected scoping. | ||
|
|
||
| i Split into separate assignments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to get rid of some of these duplicate diagnostics. I mean, technically they aren't duplicates, but they still flag the same lines.
Let's have it so we keep the diagnostic with the largest range. For this example, that would be the first diagnostic.
Summary
I wrote the code myself but used AI to get some insights on the code
Fixes #8194
Test Plan
Docs