Skip to content

Commit

Permalink
fix(eslint-plugin): [no-unsafe-call] allow import expressions (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Mar 26, 2020
1 parent b1b8284 commit 4fa7107
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/eslint-plugin/src/rules/no-unsafe-call.ts
Expand Up @@ -41,10 +41,10 @@ export default util.createRule<[], MessageIds>({
}

return {
'CallExpression, OptionalCallExpression'(
node: TSESTree.CallExpression | TSESTree.OptionalCallExpression,
':matches(CallExpression, OptionalCallExpression) > :not(Import)'(
node: Exclude<TSESTree.LeftHandSideExpression, TSESTree.Import>,
): void {
checkCall(node.callee, node.callee, 'unsafeCall');
checkCall(node, node, 'unsafeCall');
},
NewExpression(node): void {
checkCall(node.callee, node, 'unsafeNew');
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts
Expand Up @@ -20,6 +20,7 @@ ruleTester.run('no-unsafe-call', rule, {
'function foo(x: { a?: () => void }) { x.a?.() }',
'new Map()',
'String.raw`foo`',
'const x = import("./foo");',
],
invalid: [
...batchedSingleLineTests({
Expand Down

0 comments on commit 4fa7107

Please sign in to comment.