Skip to content

Rule Change: add suggestions for eqeqeq #19638

@rakleed

Description

@rakleed

What rule do you want to change?

eqeqeq

What change do you want to make?

Implement suggestions

How do you think the change should be implemented?

A new default behavior

Example code

if (x == 42) { }
if ("" == text) { }
if (obj.getStuff() != undefined) { }

a == b
foo == true
bananas != 1
value == undefined
foo == null

What does the rule currently do for this code?

Reporting an error.

What will the rule do after it's changed?

Suggests changing to strict comparison.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

There was an earlier discussion at #4578, and at that time you decided to disable auto-fix for eqeqeq altogether.

Then, for some cases, you did bring it back; for those cases in the documentation, the auto-fix works:

typeof foo == 'undefined'
'hello' != 'world'
0 == 0
true == true

The last time there was a discussion about this, I understand there were no suggestions back then, but it seems that for the other cases, the suggestions would have worked fine.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions