Skip to content

Commit

Permalink
fix: 馃悰 Throwig error if parent is CallExpression
Browse files Browse the repository at this point in the history
Throwing error if the parent is CallExpression in no-var-requires plugin

Closes: typescript-eslint#665
  • Loading branch information
JayaKrishnaNamburu committed Jul 19, 2019
1 parent 807bc2d commit 8df30ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/rules/no-var-requires.ts
Expand Up @@ -27,7 +27,8 @@ export default util.createRule<Options, MessageIds>({
node.callee.type === AST_NODE_TYPES.Identifier &&
node.callee.name === 'require' &&
node.parent &&
node.parent.type === AST_NODE_TYPES.VariableDeclarator
(node.parent.type === AST_NODE_TYPES.VariableDeclarator ||
node.parent.type === AST_NODE_TYPES.CallExpression)
) {
context.report({
node,
Expand Down

0 comments on commit 8df30ae

Please sign in to comment.