Skip to content
Permalink
Browse files
Docs: add class fields in no-multi-assign documentation (refs #14857) (
  • Loading branch information
mdjermanovic committed Aug 9, 2021
1 parent d234d89 commit 5c3a47072aeb5cfda40a1eb20b43a10c5ca7aab3
Showing 1 changed file with 20 additions and 1 deletion.
@@ -26,12 +26,19 @@ const foo = bar = "baz";
let a =
b =
c;
class Foo {
a = b = 10;
}
a = b = "quux";
```

Examples of **correct** code for this rule:

```js
/*eslint no-multi-assign: "error"*/
var a = 5;
var b = 5;
var c = 5;
@@ -41,13 +48,21 @@ const bar = "baz";
let a = c;
let b = c;
class Foo {
a = 10;
b = 10;
}
a = "quux";
b = "quux";
```

## Options

This rule has an object option:

* `"ignoreNonDeclaration"`: When set to `true`, the rule allows chains that don't include initializing a variable in a declaration. Default is `false`.
* `"ignoreNonDeclaration"`: When set to `true`, the rule allows chains that don't include initializing a variable in a declaration or initializing a class field. Default is `false`.

### ignoreNonDeclaration

@@ -73,6 +88,10 @@ Examples of **incorrect** code for the `{ "ignoreNonDeclaration": true }` option
let a = b = "baz";
const foo = bar = 1;
class Foo {
a = b = 10;
}
```

## Related Rules

0 comments on commit 5c3a470

Please sign in to comment.