From 44533275eb7b99fda362f4e25048571957053d70 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 5 Oct 2018 09:35:50 -0700 Subject: [PATCH] Update spacing rules to be of type style --- lib/rules/rest-spread-spacing.js | 2 +- lib/rules/yield-star-spacing.js | 2 +- tools/rule-types.json | 4 ++-- tools/update-rule-types.js | 7 ++++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/rules/rest-spread-spacing.js b/lib/rules/rest-spread-spacing.js index bbc10320183..efe19c9835b 100644 --- a/lib/rules/rest-spread-spacing.js +++ b/lib/rules/rest-spread-spacing.js @@ -11,7 +11,7 @@ module.exports = { meta: { - type: "suggestion", + type: "style", docs: { description: "enforce spacing between rest and spread operators and their expressions", diff --git a/lib/rules/yield-star-spacing.js b/lib/rules/yield-star-spacing.js index 9f9b1c34623..65e737cb860 100644 --- a/lib/rules/yield-star-spacing.js +++ b/lib/rules/yield-star-spacing.js @@ -11,7 +11,7 @@ module.exports = { meta: { - type: "suggestion", + type: "style", docs: { description: "require or disallow spacing around the `*` in `yield*` expressions", diff --git a/tools/rule-types.json b/tools/rule-types.json index 770874c2cfb..25c4e1ea265 100644 --- a/tools/rule-types.json +++ b/tools/rule-types.json @@ -236,7 +236,7 @@ "require-jsdoc": "style", "require-unicode-regexp": "suggestion", "require-yield": "suggestion", - "rest-spread-spacing": "suggestion", + "rest-spread-spacing": "style", "semi": "style", "semi-spacing": "style", "semi-style": "style", @@ -261,6 +261,6 @@ "vars-on-top": "suggestion", "wrap-iife": "suggestion", "wrap-regex": "style", - "yield-star-spacing": "suggestion", + "yield-star-spacing": "style", "yoda": "suggestion" } \ No newline at end of file diff --git a/tools/update-rule-types.js b/tools/update-rule-types.js index 23ea16a6350..352a0d8e336 100644 --- a/tools/update-rule-types.js +++ b/tools/update-rule-types.js @@ -24,8 +24,13 @@ module.exports = (fileInfo, api) => { // gather important nodes from the rule const metaNode = p.node.properties.find(node => node.key.name === "meta"); - const typeNode = metaNode.value.properties ? metaNode.value.properties.find(node => node.key.name === "type") : null; + // if there's no properties, just exit + if (!metaNode.value.properties) { + return; + } + + const typeNode = metaNode.value.properties.find(node => node.key.name === "type"); const docsNode = metaNode.value.properties.find(node => node.key.name === "docs"); const categoryNode = docsNode.value.properties.find(node => node.key.name === "category").value;