Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
My proposal is suitable for this project
- My proposal specifically checks TypeScript syntax, or it proposes a check that requires type information to be accurate.
- My proposal is not a "formatting rule"; meaning it does not just enforce how code is formatted (whitespace, brace placement, etc).
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
Many developers mistakenly use===
or!==
to compare objects whereas they intend to useisEqual
or.equals
. The same for strings where most will want to uselocaleCompare
instead of operators<
,<=
,>=
,>
.
I would like to port strict-comparisons rule from TSLint to here:https://palantir.github.io/tslint/rules/strict-comparisons/
Fail Cases
consts1='a'consts2='b'if(a<b){}consto1={}consto2={}if(o1===o2){}
Pass Cases
consts1='a'consts2='b'if(a.localeCompare(b)<0){}consto1={}consto2={}if(o1===o2){}
Additional Info
No response