-
-
Notifications
You must be signed in to change notification settings - Fork 27k
[ESLint] Enable != for comparing null #4807
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
Comments
This approach is not recommended for new developers who might not be aware of != null and !== null. |
@bugzpodder Developers need to learn lots of things, including lots about the syntax of the language they use. The Lint rules should guide them to the right practices. A novice developer seeing this warning will go ahead and change What do I need to do to make this change? Does it only require consensus here, or do we need to change ESLint defaults? |
In fact, now that I see the code, this is a bug. The config is using a deprecated option that no longer works. |
!= null
is the correct and safer way to compare against optional values. I suggest we configure ESLint with["warn", "always", {"null": "ignore"}]
.The text was updated successfully, but these errors were encountered: