コンテンツにスキップ

noMultiAssign

このコンテンツはまだ日本語訳がありません。

biome.json
{
"linter": {
"rules": {
"nursery": {
"noMultiAssign": "error"
}
}
}
}

Disallow use of chained assignment expressions

Chaining the assignment of variables can lead to unexpected results and be difficult to read.

const foo = bar = "baz";
code-block.js:1:7 lint/nursery/noMultiAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected chained assignment.

> 1 │ const foo = bar = “baz”;
^^^^^^^^^^^^^^^^^
2 │

Variables with chained assignments in declarations may cause unintended implicit globals or unexpected scoping.

Split into separate assignments.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

const foo = "baz";
const bar = "baz";