-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere 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 discussionThis issue has been archived; please open a new issue for any further discussionfeatureThis change adds a new feature to ESLintThis change adds a new feature to ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
Please describe what the rule should do:
Suggest the use of logical assignment operators.
What new ECMAScript feature does this rule relate to?
What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem)
[x] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
Bad:
opts.foo = opts.foo ?? 'bar'
Good:
opts.foo ??= 'bar'
(same for ||=
and &&=
)
-- Optional extras --
Bad:
if (!a) {
a = 'foo';
}
Good:
a ||= 'foo';
Bad:
opts.baz ?? (opts.baz = 'qux');
Good:
opts.baz ??= 'qux';
Why should this rule be included in ESLint (instead of a plugin)?
It's a general syntax suggestion.
Are you willing to submit a pull request to implement this rule?
Not at this time.
JoshuaKGoldberg, anikethsaha, vegerot, g-plane, alexander-akait and 18 more
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere 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 discussionThis issue has been archived; please open a new issue for any further discussionfeatureThis change adds a new feature to ESLintThis change adds a new feature to ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete