Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.02 KB

no-incorrect-deep-equal.md

File metadata and controls

33 lines (23 loc) · 1.02 KB

Disallow using deepEqual with primitives (ava/no-incorrect-deep-equal)

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

Translations: Français

The deepEqual and notDeepEqual assertions are unnecessary when comparing primitives. Use is or not instead.

Fail

t.deepEqual(expression, 'foo');
t.deepEqual(expression, 1);
t.deepEqual(expression, `foo${bar}`);
t.deepEqual(expression, null);
t.deepEqual(expression, undefined);
t.notDeepEqual(expression, undefined);

Pass

t.is(expression, 'foo');

t.deepEqual(expression, otherExpression);
t.deepEqual(expression, {});
t.deepEqual(expression, []);
t.notDeepEqual(expression, []);