Skip to content

linter: check for confusing nullish coalescing #19825

Description

@Miodec

When using nullish coalescing (??) it is possible to create bugs by not using parenthesis. For example:

const shouldShowStreak = profile.streak ?? 0 > 1

The intention here is to default the optional streak property to 0, but JS will run default it to false, because 0 is not greater than 1.

Metadata

Metadata

Assignees

Labels

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions