Skip to content

Commit ae3398a

Browse files
BridgeARMylesBorins
authored andcommitted
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 8e39c3b commit ae3398a

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)