question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`no-useless-undefined`: `undefined` removed from compare functions

See original GitHub issue
test('should be undefined', t => {
	t.is(foo, undefined);
})
if (Object.is(foo, undefined)) {}

We are not breaking things, but removing undefined seems weird

In ava, t.is(foo) is also passed.

Funny thing, Object.is(foo) and Object.is() returns true.

Question: should we ignore them?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

1reaction
papbcommented, May 13, 2020

I personally prefer ignoring calls with 1 or 2 parameters whose name contain is, equal, equals or be as a whole “camelCase section”.

0reactions
fiskercommented, May 13, 2020

That’s why I propose, just remove auto-fix, if you really want, we still have suggestion and you can also eslint-disable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript - removing undefined fields from an object [duplicate]
A one-liner using ES6 arrow function and ternary operator: Object.keys(obj).forEach(key => obj[key] === undefined ? delete obj[key] : {});.
Read more >
eslint-plugin-unicorn - npm
(fixable); consistent-function-scoping - Move function definitions to the highest ... no-useless-undefined - Disallow useless undefined .
Read more >
eslint-plugin-unicorn/readme.md - UNPKG
- [no-unused-properties](docs/rules/no-unused-properties.md) - Disallow unused object properties. 131, - [no-useless-undefined](docs/rules/no-useless-undefined ...
Read more >
eslint-plugin-unicorn - npm Package Health Analysis - Snyk
consistent-function-scoping, Move function definitions to the highest possible scope. ... no-typeof-undefined, Disallow comparing undefined using typeof .
Read more >
eslint-plugin-unicorn | Yarn - Package Manager
Name Description 💼 🚫 🔧 💡 consistent‑destructuring Use destructured variables over properties. ✓ 🔧 💡 custom‑error‑definition Enforce correct Error subclassing. ✓ 🔧 empty‑brace‑spaces Enforce no spaces...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found