Skip to content

Commit 82118fb

Browse files
committed
use-true-false: Fix Object.hasOwn() not being flagged
1 parent e4ce630 commit 82118fb

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

rules/use-true-false.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const knownBooleanSignatures = [
3030
'Object.isExtensible()',
3131
'Object.isFrozen()',
3232
'Object.isSealed()',
33+
'Object.hasOwn()',
3334
'Boolean()',
3435
'Number.isNaN()',
3536
'Number.isFinite()',

test/use-true-false.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ ruleTester.run('use-true-false', rule, {
122122
output: testCase('t.true(isFinite(3))'),
123123
errors: trueErrors,
124124
},
125+
{
126+
code: testCase('t.truthy(Object.hasOwn(obj, \'key\'))'),
127+
output: testCase('t.true(Object.hasOwn(obj, \'key\'))'),
128+
errors: trueErrors,
129+
},
125130
{
126131
code: testCase('t.falsy(value === 1)'),
127132
output: testCase('t.false(value === 1)'),

0 commit comments

Comments
 (0)