diff --git a/lib/rules/no-new-func.js b/lib/rules/no-new-func.js index 9af4e31cabf6..bfe845c470b3 100644 --- a/lib/rules/no-new-func.js +++ b/lib/rules/no-new-func.js @@ -38,12 +38,23 @@ module.exports = { variable.references.forEach(ref => { const node = ref.identifier; const { parent } = node; + var isEval = false; - if ( - parent && - (parent.type === "NewExpression" || parent.type === "CallExpression") && - node === parent.callee - ) { + if (parent) { + if (node === parent.callee && ( + parent.type === "NewExpression" || + parent.type === "CallExpression" + )) { + isEval = true; + } else if (parent.type === "MemberExpression") { + var gParent = parent.parent; + if (gParent && gParent.type === "CallExpression") { + isEval = true; + } + } + } + + if(isEval) { context.report({ node: parent, messageId: "noFunctionConstructor"