diff options
author | Rich Trott <rtrott@gmail.com> | 2018-03-21 22:44:47 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-03-24 04:11:48 -0700 |
commit | 0863a0e528ba9ee01f960dce7ffebe8fff3a774c (patch) | |
tree | 37990f3af668c242ec1c4a9e24afd31b720ad96d /tools/node_modules/eslint/lib/rules/no-eval.js | |
parent | 5e00a013eb219716d952cb8eb29a134c00f5db54 (diff) | |
download | android-node-v8-0863a0e528ba9ee01f960dce7ffebe8fff3a774c.tar.gz android-node-v8-0863a0e528ba9ee01f960dce7ffebe8fff3a774c.tar.bz2 android-node-v8-0863a0e528ba9ee01f960dce7ffebe8fff3a774c.zip |
tools: update ESLint to 4.19.1
A few bug fixes result in more stringent linting rules.
PR-URL: https://github.com/nodejs/node/pull/19528
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/no-eval.js')
-rw-r--r-- | tools/node_modules/eslint/lib/rules/no-eval.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js index 8cf4aa307b..68ed086a3d 100644 --- a/tools/node_modules/eslint/lib/rules/no-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-eval.js @@ -91,7 +91,11 @@ module.exports = { }, additionalProperties: false } - ] + ], + + messages: { + unexpected: "eval can be harmful." + } }, create(context) { @@ -147,20 +151,19 @@ module.exports = { * @returns {void} */ function report(node) { - let locationNode = node; const parent = node.parent; + const locationNode = node.type === "MemberExpression" + ? node.property + : node; - if (node.type === "MemberExpression") { - locationNode = node.property; - } - if (parent.type === "CallExpression" && parent.callee === node) { - node = parent; - } + const reportNode = parent.type === "CallExpression" && parent.callee === node + ? parent + : node; context.report({ - node, + node: reportNode, loc: locationNode.loc.start, - message: "eval can be harmful." + messageId: "unexpected" }); } |