From dad2fffe676cf58c977385d942f6e0dbb2b4b621 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Mon, 9 Dec 2024 15:56:07 +0100 Subject: [PATCH] Remove unnecessary intermediate variable --- tools/update-docs-rules-index.js | 40 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tools/update-docs-rules-index.js b/tools/update-docs-rules-index.js index f75aa1662..63a6d66fb 100644 --- a/tools/update-docs-rules-index.js +++ b/tools/update-docs-rules-index.js @@ -249,24 +249,16 @@ const releases = [ ]) ) ].sort() -const linkDefinitionLines = [ - '', - '', - ...rules.map((rule) => `[${rule.ruleId}]: ./${rule.name}.md`), - '', - '', - '', - ...removedRules.map( - (rule) => `[vue/${rule.ruleName}]: ./${rule.ruleName}.md` - ), - '', - '', - '', - ...releases.map( - (release) => - `[${release}]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/${release}` - ) -] +const ruleLinkDefinitions = rules.map( + (rule) => `[${rule.ruleId}]: ./${rule.name}.md` +) +const removedRuleLinkDefinitions = removedRules.map( + (rule) => `[vue/${rule.ruleName}]: ./${rule.ruleName}.md` +) +const releaseLinkDefinitions = releases.map( + (release) => + `[${release}]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/${release}` +) // ----------------------------------------------------------------------------- const readmeFilePath = path.resolve(__dirname, '../docs/rules/index.md') @@ -295,6 +287,16 @@ Mark indicating rule type: ${rulesTableContent.trim()} -${linkDefinitionLines.join('\n')} + + +${ruleLinkDefinitions.join('\n')} + + + +${removedRuleLinkDefinitions.join('\n')} + + + +${releaseLinkDefinitions.join('\n')} ` )