Skip to content

Commit

Permalink
Chore: adjust ES6 syntax in no-new-func
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Aug 2, 2021
1 parent d20c16e commit 8e4f5cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rules/no-new-func.js
Expand Up @@ -38,7 +38,7 @@ module.exports = {
variable.references.forEach(ref => {
const node = ref.identifier;
const { parent } = node;
var isEval = false;
let isEval = false;

if (parent) {
if (node === parent.callee && (
Expand All @@ -47,14 +47,15 @@ module.exports = {
)) {
isEval = true;
} else if (parent.type === "MemberExpression") {
var gParent = parent.parent;
const gParent = parent.parent;

if (gParent && gParent.type === "CallExpression") {
isEval = true;
}
}
}

if(isEval) {
if (isEval) {
context.report({
node: parent,
messageId: "noFunctionConstructor"
Expand Down

0 comments on commit 8e4f5cf

Please sign in to comment.