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

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
Assignees

Comments

@wincent
Copy link
Contributor

wincent commented Mar 10, 2020

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 that x == null is ok (convenient short-hand for x == null || x == undefined, and it should come up pretty rarely).

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
@wincent wincent transferred this issue from liferay/eslint-config-liferay Sep 24, 2020
wincent pushed a commit that referenced this issue Dec 18, 2020
docs: Add branch structure guidelines (#9)
@bryceosterhaus bryceosterhaus self-assigned this Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants