diff options
author | Rich Trott <rtrott@gmail.com> | 2017-04-01 22:57:53 -0700 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-05-02 20:01:06 +0200 |
commit | 736a736ed5d5cf054456a74cea56a00904c33f4a (patch) | |
tree | d5c43f9d55289ed675c8ac8df81eff8ee6167305 /tools/eslint/lib/internal-rules/internal-no-invalid-meta.js | |
parent | 312091a1968856a86512ec5819b52568d0f5aa8a (diff) | |
download | node-new-736a736ed5d5cf054456a74cea56a00904c33f4a.tar.gz |
tools: update ESLint to 3.19.0
Backport-PR-URL: https://github.com/nodejs/node/pull/12504
PR-URL: https://github.com/nodejs/node/pull/12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'tools/eslint/lib/internal-rules/internal-no-invalid-meta.js')
-rw-r--r-- | tools/eslint/lib/internal-rules/internal-no-invalid-meta.js | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/tools/eslint/lib/internal-rules/internal-no-invalid-meta.js b/tools/eslint/lib/internal-rules/internal-no-invalid-meta.js index d1c78efa61..d13df358bf 100644 --- a/tools/eslint/lib/internal-rules/internal-no-invalid-meta.js +++ b/tools/eslint/lib/internal-rules/internal-no-invalid-meta.js @@ -95,16 +95,6 @@ function hasMetaSchema(metaPropertyNode) { } /** - * Whether this `meta` ObjectExpression has a `fixable` property defined or not. - * - * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. - * @returns {boolean} `true` if a `fixable` property exists. - */ -function hasMetaFixable(metaPropertyNode) { - return getPropertyFromObject("fixable", metaPropertyNode.value); -} - -/** * Checks the validity of the meta definition of this rule and reports any errors found. * * @param {RuleContext} context The ESLint rule context. @@ -112,7 +102,7 @@ function hasMetaFixable(metaPropertyNode) { * @param {boolean} ruleIsFixable whether the rule is fixable or not. * @returns {void} */ -function checkMetaValidity(context, exportsNode, ruleIsFixable) { +function checkMetaValidity(context, exportsNode) { const metaProperty = getMetaPropertyFromExportsNode(exportsNode); if (!metaProperty) { @@ -142,11 +132,6 @@ function checkMetaValidity(context, exportsNode, ruleIsFixable) { if (!hasMetaSchema(metaProperty)) { context.report(metaProperty, "Rule is missing a meta.schema property."); - return; - } - - if (ruleIsFixable && !hasMetaFixable(metaProperty)) { - context.report(metaProperty, "Rule is fixable, but is missing a meta.fixable property."); } } @@ -177,7 +162,6 @@ module.exports = { create(context) { let exportsNode; - let ruleIsFixable = false; return { AssignmentExpression(node) { @@ -191,35 +175,13 @@ module.exports = { } }, - CallExpression(node) { - - // If the rule has a call for `context.report` and a property `fix` - // is being passed in, then we consider that the rule is fixable. - // - // Note that we only look for context.report() calls in the new - // style (with single MessageDescriptor argument), because only - // calls in the new style can specify a fix. - if (node.callee.type === "MemberExpression" && - node.callee.object.type === "Identifier" && - node.callee.object.name === "context" && - node.callee.property.type === "Identifier" && - node.callee.property.name === "report" && - node.arguments.length === 1 && - node.arguments[0].type === "ObjectExpression") { - - if (getPropertyFromObject("fix", node.arguments[0])) { - ruleIsFixable = true; - } - } - }, - "Program:exit"() { if (!isCorrectExportsFormat(exportsNode)) { context.report({ node: exportsNode, message: "Rule does not export an Object. Make sure the rule follows the new rule format." }); return; } - checkMetaValidity(context, exportsNode, ruleIsFixable); + checkMetaValidity(context, exportsNode); } }; } |