Skip to content

Commit

Permalink
prefer-prototype-methods: Fix argument of isMethodCall (#2247)
Browse files Browse the repository at this point in the history
  • Loading branch information
haocheng6 authored Jan 3, 2024
1 parent ae84459 commit 3b504fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/prefer-prototype-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function create(context) {
// `[].foo.{apply,bind,call}(…)`
// `({}).foo.{apply,bind,call}(…)`
isMethodCall(callExpression, {
names: ['apply', 'bind', 'call'],
methods: ['apply', 'bind', 'call'],
optionalCall: false,
optionalMember: false,
})
Expand Down
3 changes: 3 additions & 0 deletions test/prefer-prototype-methods.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ test.snapshot({
'foo.bar.bind(bar)',
'foo[{}].call(bar)',
'Object.hasOwn(bar)',
'const foo = [].push.notApply(bar, elements);',
'const push = [].push.notBind(foo)',
'[].forEach.notCall(foo, () => {})',
],
invalid: [
'const foo = [].push.apply(bar, elements);',
Expand Down

0 comments on commit 3b504fa

Please sign in to comment.