]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/lib/rules/consistent-return.js
import 7.12.1 upstream release
[pve-eslint.git] / eslint / lib / rules / consistent-return.js
index 22667fa47077247f8ab5d42c0598a2b943d1db02..94db253d25bacb654e2f4cb67102f3d8321a7d27 100644 (file)
@@ -9,23 +9,12 @@
 //------------------------------------------------------------------------------
 
 const lodash = require("lodash");
-
 const astUtils = require("./utils/ast-utils");
 
 //------------------------------------------------------------------------------
 // Helpers
 //------------------------------------------------------------------------------
 
-/**
- * Checks whether or not a given node is an `Identifier` node which was named a given name.
- * @param {ASTNode} node A node to check.
- * @param {string} name An expected name of the node.
- * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected.
- */
-function isIdentifier(node, name) {
-    return node.type === "Identifier" && node.name === name;
-}
-
 /**
  * Checks whether or not a given code path segment is unreachable.
  * @param {CodePathSegment} segment A CodePathSegment to check.
@@ -165,7 +154,7 @@ module.exports = {
                 let hasReturnValue = Boolean(argument);
 
                 if (treatUndefinedAsUnspecified && hasReturnValue) {
-                    hasReturnValue = !isIdentifier(argument, "undefined") && argument.operator !== "void";
+                    hasReturnValue = !astUtils.isSpecificId(argument, "undefined") && argument.operator !== "void";
                 }
 
                 if (!funcInfo.hasReturn) {