コンテンツにスキップ

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.

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