Skip to content

Rule idea: no-multi-assign #6424

@silverwind

Description

@silverwind

Proposing a new rule which forbids multiple assignments in a single expression.

Code that should trigger a warning:

a = b = c;

Code that should not trigger a warning:

b = c;
a = c;

They're hard to read and it's not immediately clear what is assigned to what. In above example, one could think that the order of evaluation is left-to-right, while it actually is right-to-left.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionfeatureThis change adds a new feature to ESLinthelp wantedThe team would welcome a contribution from the community for this issueruleRelates to ESLint's core rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions