Skip to content

Commit 7f1a942

Browse files
BridgeARrvagg
authored andcommittedAug 16, 2018
tools: fix eslint isRequired
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent 4eca50a commit 7f1a942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎tools/eslint-rules/rules-utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* require calls.
99
*/
1010
module.exports.isRequired = function(node, modules) {
11-
return node.callee.name === 'require' &&
11+
return node.callee.name === 'require' && node.arguments.length !== 0 &&
1212
modules.includes(node.arguments[0].value);
1313
};
1414

0 commit comments

Comments
 (0)
Please sign in to comment.