Skip to content

Rule suggestion: disallow !a instanceof b #2716

@tornewuff

Description

@tornewuff

As the existing rule no-negated-in-lhs, it seems like it would be good to also disallow

if (!a instanceof b) // do something

since the developer certainly meant to write

if (!(a instanceof b)) // do something

instead. This prevents errors, and there's no legitimate case for the former that I can think of, so I think this could be enabled by default as with no-negated-in-lhs. I've thrown together a quick copy and paste job of no-negated-in-lhs which works; will attach PR.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

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 discussionenhancementThis change enhances an existing feature of ESLintruleRelates 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