-
Notifications
You must be signed in to change notification settings - Fork 70
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
Enforce use of "strict equality" #14
Closed
wincent opened this issue
Mar 10, 2020
· 0 comments
· Fixed by #707 · May be fixed by liferay/eslint-config-liferay#171
Closed
Enforce use of "strict equality" #14
wincent opened this issue
Mar 10, 2020
· 0 comments
· Fixed by #707 · May be fixed by liferay/eslint-config-liferay#171
Labels
Comments
wincent
referenced
this issue
in liferay/eslint-config-liferay
Apr 8, 2020
ESLint can enforce this for us with the built-in "eqeqeq" rule, which you might not know about if you'd search for "strict", "equality" or "equal" in the rules list. Idea is to avoid coercion due to `==`/`!=` which can be a source of bugs, except in the case of `null`, where `x == null` is a convenient and idiomatic shorthand for `x === null || x === undefined` (you can still do an explicit `x === null` check if that's what you want). Docs: https://eslint.org/docs/rules/eqeqeq Closes: https://github.com/liferay/eslint-config-liferay/issues/158
This was referenced Nov 23, 2020
wincent
pushed a commit
that referenced
this issue
Dec 18, 2020
docs: Add branch structure guidelines (#9)
This was referenced Feb 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For safety, as I recommended in this PR, we should just use
===
/!==
everywhere instead of==
/!=
. The single exception I'd make to this rule is thatx == null
is ok (convenient short-hand forx == null || x == undefined
, and it should come up pretty rarely).The text was updated successfully, but these errors were encountered: