From e81bbba5905152cee71207bbfbb4cff963a90910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Thu, 18 Apr 2024 16:10:56 +0800 Subject: [PATCH] feat: remove ts style guides fixes #101 --- lib/config-generator.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/config-generator.js b/lib/config-generator.js index e81c5ff..5420dbb 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -17,10 +17,6 @@ const jsStyleGuides = [ { message: "Standard: https://github.com/standard/standard", name: "standard", value: { packageName: "eslint-config-standard", type: "eslintrc" } }, { message: "XO: https://github.com/xojs/eslint-config-xo", name: "xo", value: { packageName: "eslint-config-xo", type: "eslintrc" } } ]; -const tsStyleGuides = [ - { message: "Standard: https://github.com/standard/eslint-config-standard-with-typescript", name: "standard", value: { packageName: "eslint-config-standard-with-typescript", type: "eslintrc" } }, - { message: "XO: https://github.com/xojs/eslint-config-xo-typescript", name: "xo", value: { packageName: "eslint-config-xo-typescript", type: "eslintrc" } } -]; /** * Class representing a ConfigGenerator. @@ -92,7 +88,10 @@ export class ConfigGenerator { { message: "No", name: "javascript" }, { message: "Yes", name: "typescript" } ], - initial: 0 + initial: 0, + skip() { + return this.state.answers.purpose === "style"; + } }, { type: "multiselect", @@ -113,13 +112,12 @@ export class ConfigGenerator { if (answers.purpose === "style") { - const choices = this.answers.language === "javascript" ? jsStyleGuides : tsStyleGuides; const styleguideAnswer = await enquirer.prompt({ type: "select", name: "styleguide", message: "Which style guide do you want to follow?", - choices, - result: choice => choices.find(it => it.name === choice).value + choices: jsStyleGuides, + result: choice => jsStyleGuides.find(it => it.name === choice).value }); Object.assign(this.answers, styleguideAnswer);