From 5df478840a14926951c8dec54e750c8a2f722646 Mon Sep 17 00:00:00 2001 From: Retsam Date: Fri, 6 Sep 2019 15:49:38 -0400 Subject: [PATCH] test(eslint-plugin): additional cases for generic params --- .../tests/rules/no-unnecessary-condition.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index 03095c3435b..4ce31715106 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -119,6 +119,20 @@ function test(t: T) { }`, errors: [ruleError(3, 10, 'alwaysTruthy')], }, + { + code: ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + errors: [ruleError(3, 10, 'alwaysFalsy')], + }, + { + code: ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + errors: [ruleError(3, 10, 'alwaysTruthy')], + }, // Still errors on in the expected locations when ignoring RHS {