denoland / deno_lint

Blazing fast linter for JavaScript and TypeScript written in Rust
https://lint.deno.land/
MIT License
1.53k stars 172 forks source link

Rule suggestion: no-compare-to-new #1185

Open rotu opened 1 year ago

rotu commented 1 year ago

Using ===, ==, or switch with an object or array literal is always false.

The below are all examples of erroneous comparisons that could be flagged:

Additionally, if the type of x is known, the following could be flagged:

Similar to this suggested eslint rule: https://github.com/eslint/eslint/issues/15222

bartlomieju commented 4 months ago

Seems reasonable 👍 contributions are welcome