Skip to content

Commit

Permalink
Merge branch 'master' into feature/brace-style
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Aug 29, 2019
2 parents 363eeda + 29a01b8 commit 475cfda
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/eslint-plugin/src/rules/unbound-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ function isSafeUse(node: TSESTree.Node): boolean {
case AST_NODE_TYPES.UnaryExpression:
return parent.operator === 'typeof';

case AST_NODE_TYPES.BinaryExpression:
return ['instanceof', '==', '!=', '===', '!=='].includes(parent.operator);

case AST_NODE_TYPES.TSNonNullExpression:
case AST_NODE_TYPES.TSAsExpression:
case AST_NODE_TYPES.TSTypeAssertion:
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-plugin/tests/rules/unbound-method.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,27 @@ instance.unbound\`\`;
if (instance.bound) { }
if (instance.unbound) { }
if (instance.bound !== undefined) { }
if (instance.unbound !== undefined) { }
if (ContainsMethods.boundStatic) { }
if (ContainsMethods.unboundStatic) { }
if (ContainsMethods.boundStatic !== undefined) { }
if (ContainsMethods.unboundStatic !== undefined) { }
while (instance.bound) { }
while (instance.unbound) { }
while (instance.bound !== undefined) { }
while (instance.unbound !== undefined) { }
while (ContainsMethods.boundStatic) { }
while (ContainsMethods.unboundStatic) { }
while (ContainsMethods.boundStatic !== undefined) { }
while (ContainsMethods.unboundStatic !== undefined) { }
instance.bound as any;
ContainsMethods.boundStatic as any;
Expand Down

0 comments on commit 475cfda

Please sign in to comment.