import { PromptModuleAPI } from "../promptModuleAPI"; export default function(cli: PromptModuleAPI): void { cli.injectFeature({ name: "ES Linter", value: "linter", short: "Linter", description: "Check and enforce code quality with ESLint and Prettier", link: "https://eslint.org", plugins: ["eslint"], checked: true, }); cli.injectPrompt({ name: "eslintConfig", when: (answers) => answers.features.includes("linter"), type: "list", message: "Pick a linter config:", // description: "Checking code errors and enforcing an unitive code style is recommended.", choices: () => [ { name: "ESLint + Basic config", value: "base", short: "Basic", }, { name: "ESLint + Airbnb config", value: "airbnb", short: "Airbnb", }, { name: "ESLint + Standard config", value: "standard", short: "Standard", }, ], }); cli.onPromptComplete((answers, options) => { if (!options.plugins) { return; } if (answers.features.includes("linter")) { options.plugins["cli-plugin-eslint"] = { config: answers.eslintConfig, }; } }); };