Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eqeqeq null check relaxation #669

Closed
jonathanKingston opened this issue Mar 9, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@jonathanKingston
Copy link
Contributor

commented Mar 9, 2014

In JSHint and JSLint, the ability to turn on eqnull to supress warnings about comparisons against double equals is possible:

if (varname == null) {
}

However in eslint the ability is only to turn warnings on for this use not the other way round.

What I am suggesting is the ability to specify eqeqeq behaviour without warning for null comparison.

Much in the same way there is the smart option for eqeqeq I am suggesting the same for null comparison.

@jonathanKingston

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2014

The main advantages for this is that the strict ability for all comparisons still to exist however, checking for undefined and null is still possible in one statement.

This is as mentioned in this pull request: eslint/doctrine#36

@nzakas

This comment has been minimized.

Copy link
Member

commented Mar 9, 2014

@michaelficarra what do you think about adding this as part of the "smart" option?

@nzakas

This comment has been minimized.

Copy link
Member

commented Mar 15, 2014

Okay, I think I convinced myself that this should be part of the "smart" option.

@nzakas nzakas added the rule label Mar 22, 2014

@btmills

This comment has been minimized.

Copy link
Member

commented Mar 26, 2014

Working on this.

btmills added a commit to btmills/eslint that referenced this issue Mar 26, 2014

Relax eqeqeq null check (fixes eslint#669)
When the "smart" option is enabled, eqeqeq will now allow double-
equals comparisons to null to check for null or undefined in a
single expression.

btmills added a commit to btmills/eslint that referenced this issue Mar 26, 2014

Relax eqeqeq null check (fixes eslint#669)
When the "smart" option is enabled, eqeqeq will now allow double-
equals comparisons to null to check for null or undefined in a
single expression.

@nzakas nzakas closed this in 19cc7e2 Mar 26, 2014

nzakas added a commit that referenced this issue Mar 26, 2014

Merge pull request #713 from btmills/eqeqeq-null
Relax eqeqeq null check (fixes #669)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.