From a413496c6794a6602e9f02892efdbac87e42cfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 10:38:15 +0800 Subject: [PATCH 1/7] feat: remove style guides from questions --- lib/config-generator.js | 32 +++-------------- ...xo-javascript => config--eslint-config-xo} | 5 +-- ...irbnb => config-eslint-config-airbnb-base} | 5 +-- .../style-esm-none-xo-typescript | 30 ---------------- tests/__snapshots__/style-esm-react-airbnb | 31 ---------------- tests/config-snapshots.spec.js | 36 ++----------------- 6 files changed, 8 insertions(+), 131 deletions(-) rename tests/__snapshots__/{style-esm-none-xo-javascript => config--eslint-config-xo} (84%) rename tests/__snapshots__/{style-esm-none-airbnb => config-eslint-config-airbnb-base} (85%) delete mode 100644 tests/__snapshots__/style-esm-none-xo-typescript delete mode 100644 tests/__snapshots__/style-esm-react-airbnb diff --git a/lib/config-generator.js b/lib/config-generator.js index e81c5ff..a0ed90d 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -11,17 +11,6 @@ import { isPackageTypeModule, installSyncSaveDev, fetchPeerDependencies, findPac import { getShorthandName } from "./utils/naming.js"; import * as log from "./utils/logging.js"; -// TODO: need to specify the package version - they may export flat configs in the future. -const jsStyleGuides = [ - { message: "Airbnb: https://github.com/airbnb/javascript", name: "airbnb", value: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } }, - { 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. */ @@ -58,8 +47,7 @@ export class ConfigGenerator { initial: 1, choices: [ { message: "To check syntax only", name: "syntax" }, - { message: "To check syntax and find problems", name: "problems" }, - { message: "To check syntax, find problems, and enforce code style", name: "style" } + { message: "To check syntax and find problems", name: "problems" } ] }, { @@ -110,20 +98,6 @@ export class ConfigGenerator { const answers = await enquirer.prompt(questions); Object.assign(this.answers, answers); - - 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 - }); - - Object.assign(this.answers, styleguideAnswer); - } } /** @@ -188,7 +162,9 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug this.result.devDependencies.push("@eslint/js"); importContent += "import pluginJs from \"@eslint/js\";\n"; exportContent += " pluginJs.configs.recommended,\n"; - } else if (this.answers.purpose === "style") { + } + + if (this.answers.styleguide) { const styleguide = this.answers.styleguide; this.result.devDependencies.push(styleguide.packageName); diff --git a/tests/__snapshots__/style-esm-none-xo-javascript b/tests/__snapshots__/config--eslint-config-xo similarity index 84% rename from tests/__snapshots__/style-esm-none-xo-javascript rename to tests/__snapshots__/config--eslint-config-xo index f0a0acf..762d495 100644 --- a/tests/__snapshots__/style-esm-none-xo-javascript +++ b/tests/__snapshots__/config--eslint-config-xo @@ -1,6 +1,5 @@ { - "configContent": "import globals from "globals"; - + "configContent": " import path from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; @@ -12,13 +11,11 @@ const __dirname = path.dirname(__filename); const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); export default [ - {languageOptions: { globals: globals.node }}, ...compat.extends("xo"), ];", "configFilename": "eslint.config.mjs", "devDependencies": [ "eslint", - "globals", "eslint-config-xo", "eslint@>=8.56.0", "@eslint/eslintrc", diff --git a/tests/__snapshots__/style-esm-none-airbnb b/tests/__snapshots__/config-eslint-config-airbnb-base similarity index 85% rename from tests/__snapshots__/style-esm-none-airbnb rename to tests/__snapshots__/config-eslint-config-airbnb-base index e6dfcfd..883a695 100644 --- a/tests/__snapshots__/style-esm-none-airbnb +++ b/tests/__snapshots__/config-eslint-config-airbnb-base @@ -1,6 +1,5 @@ { - "configContent": "import globals from "globals"; - + "configContent": " import path from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; @@ -12,13 +11,11 @@ const __dirname = path.dirname(__filename); const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); export default [ - {languageOptions: { globals: globals.browser }}, ...compat.extends("airbnb-base"), ];", "configFilename": "eslint.config.mjs", "devDependencies": [ "eslint", - "globals", "eslint-config-airbnb-base", "eslint@^7.32.0 || ^8.2.0", "eslint-plugin-import@^2.25.2", diff --git a/tests/__snapshots__/style-esm-none-xo-typescript b/tests/__snapshots__/style-esm-none-xo-typescript deleted file mode 100644 index b030443..0000000 --- a/tests/__snapshots__/style-esm-none-xo-typescript +++ /dev/null @@ -1,30 +0,0 @@ -{ - "configContent": "import globals from "globals"; - -import path from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; -import pluginJs from "@eslint/js"; - -// mimic CommonJS variables -- not needed if using CommonJS -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); - -export default [ - {languageOptions: { globals: globals.browser }}, - ...compat.extends("xo-typescript"), -];", - "configFilename": "eslint.config.mjs", - "devDependencies": [ - "eslint", - "globals", - "eslint-config-xo-typescript", - "@typescript-eslint/eslint-plugin@>=7.0.2", - "@typescript-eslint/parser@>=7.0.2", - "eslint@>=8.56.0", - "typescript@>=5.0.0", - "@eslint/eslintrc", - "@eslint/js", - ], -} \ No newline at end of file diff --git a/tests/__snapshots__/style-esm-react-airbnb b/tests/__snapshots__/style-esm-react-airbnb deleted file mode 100644 index 97153d5..0000000 --- a/tests/__snapshots__/style-esm-react-airbnb +++ /dev/null @@ -1,31 +0,0 @@ -{ - "configContent": "import globals from "globals"; - -import path from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; -import pluginJs from "@eslint/js"; - -// mimic CommonJS variables -- not needed if using CommonJS -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); - -export default [ - {languageOptions: { globals: globals.browser }}, - ...compat.extends("airbnb"), -];", - "configFilename": "eslint.config.mjs", - "devDependencies": [ - "eslint", - "globals", - "eslint-config-airbnb", - "eslint@^7.32.0 || ^8.2.0", - "eslint-plugin-import@^2.25.3", - "eslint-plugin-jsx-a11y@^6.5.1", - "eslint-plugin-react@^7.28.0", - "eslint-plugin-react-hooks@^4.3.0", - "@eslint/eslintrc", - "@eslint/js", - ], -} \ No newline at end of file diff --git a/tests/config-snapshots.spec.js b/tests/config-snapshots.spec.js index 3a7d823..47c04a0 100644 --- a/tests/config-snapshots.spec.js +++ b/tests/config-snapshots.spec.js @@ -72,46 +72,14 @@ describe("generate config for esm projects", () => { describe("generate config for cjs projects", () => { const cjsProjectDir = join(__filename, "../fixtures/cjs-project"); const inputs = [{ - name: "style-esm-none-xo-javascript", + name: "config--eslint-config-xo", answers: { - purpose: "style", - moduleType: "esm", - framework: "none", - language: "javascript", - env: ["node"], styleguide: { packageName: "eslint-config-xo", type: "eslintrc" } } }, { - name: "style-esm-none-xo-typescript", + name: "config-eslint-config-airbnb-base", answers: { - purpose: "style", - moduleType: "esm", - framework: "none", - language: "typescript", - env: ["browser"], - styleguide: { packageName: "eslint-config-xo-typescript", type: "eslintrc" } - } - }, - { - name: "style-esm-react-airbnb", - answers: { - purpose: "style", - moduleType: "esm", - framework: "react", - language: "javascript", - env: ["browser"], - styleguide: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } - } - }, - { - name: "style-esm-none-airbnb", - answers: { - purpose: "style", - moduleType: "esm", - framework: "none", - language: "javascript", - env: ["browser"], styleguide: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } } }]; From 56e5f9bfe0b2bf4ed6c7e17190728449bf120080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 10:58:38 +0800 Subject: [PATCH 2/7] fix: do not include multi eslint --- lib/config-generator.js | 45 ++++++++++--------- tests/__snapshots__/config--eslint-config-xo | 1 - .../config-eslint-config-airbnb-base | 1 - .../problems-commonjs-none-javascript | 2 +- .../problems-commonjs-none-typescript | 2 +- .../problems-commonjs-react-javascript | 2 +- .../problems-commonjs-react-typescript | 2 +- .../problems-commonjs-vue-javascript | 2 +- .../problems-commonjs-vue-typescript | 2 +- .../problems-esm-none-javascript | 2 +- .../problems-esm-none-typescript | 2 +- .../problems-esm-react-javascript | 2 +- .../problems-esm-react-typescript | 2 +- .../__snapshots__/problems-esm-vue-javascript | 2 +- .../__snapshots__/problems-esm-vue-typescript | 2 +- .../problems-script-none-javascript | 2 +- .../problems-script-none-typescript | 2 +- .../problems-script-react-javascript | 2 +- .../problems-script-react-typescript | 2 +- .../problems-script-vue-javascript | 2 +- .../problems-script-vue-typescript | 2 +- .../syntax-commonjs-none-javascript | 2 +- .../syntax-commonjs-none-typescript | 2 +- .../syntax-commonjs-react-javascript | 2 +- .../syntax-commonjs-react-typescript | 2 +- .../syntax-commonjs-vue-javascript | 2 +- .../syntax-commonjs-vue-typescript | 2 +- .../__snapshots__/syntax-esm-none-javascript | 2 +- .../__snapshots__/syntax-esm-none-typescript | 2 +- .../__snapshots__/syntax-esm-react-javascript | 2 +- .../__snapshots__/syntax-esm-react-typescript | 2 +- tests/__snapshots__/syntax-esm-vue-javascript | 2 +- tests/__snapshots__/syntax-esm-vue-typescript | 2 +- .../syntax-script-none-javascript | 2 +- .../syntax-script-none-typescript | 2 +- .../syntax-script-react-javascript | 2 +- .../syntax-script-react-typescript | 2 +- .../syntax-script-vue-javascript | 2 +- .../syntax-script-vue-typescript | 2 +- 39 files changed, 61 insertions(+), 58 deletions(-) diff --git a/lib/config-generator.js b/lib/config-generator.js index a0ed90d..792f319 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -28,7 +28,7 @@ export class ConfigGenerator { this.packageJsonPath = options.packageJsonPath || findPackageJson(this.cwd); this.answers = options.answers || {}; this.result = { - devDependencies: ["eslint"], + devDependencies: [], configFilename: "eslint.config.js", configContent: "" }; @@ -164,6 +164,25 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug exportContent += " pluginJs.configs.recommended,\n"; } + if (this.answers.language === "typescript") { + this.result.devDependencies.push("typescript-eslint"); + importContent += "import tseslint from \"typescript-eslint\";\n"; + exportContent += " ...tseslint.configs.recommended,\n"; + } + + if (this.answers.framework === "vue") { + + this.result.devDependencies.push("eslint-plugin-vue"); + + importContent += "import pluginVue from \"eslint-plugin-vue\";\n"; + exportContent += " ...pluginVue.configs[\"flat/essential\"],\n"; + } + + if (this.answers.framework === "react") { + this.result.devDependencies.push("eslint-plugin-react"); + importContent += "import pluginReactConfig from \"eslint-plugin-react/configs/recommended.js\";\n"; + exportContent += " pluginReactConfig,\n"; + } if (this.answers.styleguide) { const styleguide = this.answers.styleguide; @@ -188,28 +207,14 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug } } - if (this.answers.language === "typescript") { - this.result.devDependencies.push("typescript-eslint"); - importContent += "import tseslint from \"typescript-eslint\";\n"; - exportContent += " ...tseslint.configs.recommended,\n"; - } - - if (this.answers.framework === "vue") { - - this.result.devDependencies.push("eslint-plugin-vue"); - - importContent += "import pluginVue from \"eslint-plugin-vue\";\n"; - exportContent += " ...pluginVue.configs[\"flat/essential\"],\n"; + if (needCompatHelper) { + this.result.devDependencies.push("@eslint/eslintrc", "@eslint/js"); } - if (this.answers.framework === "react") { - this.result.devDependencies.push("eslint-plugin-react"); - importContent += "import pluginReactConfig from \"eslint-plugin-react/configs/recommended.js\";\n"; - exportContent += " pluginReactConfig,\n"; - } + const hasEslint = this.result.devDependencies.some(dep => (/^eslint(@|$)/u.test(dep))); - if (needCompatHelper) { - this.result.devDependencies.push("@eslint/eslintrc", "@eslint/js"); + if (!hasEslint) { + this.result.devDependencies.push("eslint"); } this.result.configContent = `${importContent} ${needCompatHelper ? helperContent : ""} diff --git a/tests/__snapshots__/config--eslint-config-xo b/tests/__snapshots__/config--eslint-config-xo index 762d495..d6d5693 100644 --- a/tests/__snapshots__/config--eslint-config-xo +++ b/tests/__snapshots__/config--eslint-config-xo @@ -15,7 +15,6 @@ export default [ ];", "configFilename": "eslint.config.mjs", "devDependencies": [ - "eslint", "eslint-config-xo", "eslint@>=8.56.0", "@eslint/eslintrc", diff --git a/tests/__snapshots__/config-eslint-config-airbnb-base b/tests/__snapshots__/config-eslint-config-airbnb-base index 883a695..02abf19 100644 --- a/tests/__snapshots__/config-eslint-config-airbnb-base +++ b/tests/__snapshots__/config-eslint-config-airbnb-base @@ -15,7 +15,6 @@ export default [ ];", "configFilename": "eslint.config.mjs", "devDependencies": [ - "eslint", "eslint-config-airbnb-base", "eslint@^7.32.0 || ^8.2.0", "eslint-plugin-import@^2.25.2", diff --git a/tests/__snapshots__/problems-commonjs-none-javascript b/tests/__snapshots__/problems-commonjs-none-javascript index be19a4b..7bbbcf4 100644 --- a/tests/__snapshots__/problems-commonjs-none-javascript +++ b/tests/__snapshots__/problems-commonjs-none-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-commonjs-none-typescript b/tests/__snapshots__/problems-commonjs-none-typescript index 00a021d..d93b416 100644 --- a/tests/__snapshots__/problems-commonjs-none-typescript +++ b/tests/__snapshots__/problems-commonjs-none-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-commonjs-react-javascript b/tests/__snapshots__/problems-commonjs-react-javascript index bf035ea..ab27fb8 100644 --- a/tests/__snapshots__/problems-commonjs-react-javascript +++ b/tests/__snapshots__/problems-commonjs-react-javascript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-commonjs-react-typescript b/tests/__snapshots__/problems-commonjs-react-typescript index efb4c31..0ff88fe 100644 --- a/tests/__snapshots__/problems-commonjs-react-typescript +++ b/tests/__snapshots__/problems-commonjs-react-typescript @@ -14,10 +14,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-commonjs-vue-javascript b/tests/__snapshots__/problems-commonjs-vue-javascript index 8b58d41..a925ee1 100644 --- a/tests/__snapshots__/problems-commonjs-vue-javascript +++ b/tests/__snapshots__/problems-commonjs-vue-javascript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-commonjs-vue-typescript b/tests/__snapshots__/problems-commonjs-vue-typescript index fbf258b..db4688f 100644 --- a/tests/__snapshots__/problems-commonjs-vue-typescript +++ b/tests/__snapshots__/problems-commonjs-vue-typescript @@ -14,10 +14,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-none-javascript b/tests/__snapshots__/problems-esm-none-javascript index feeaec4..e66bb2b 100644 --- a/tests/__snapshots__/problems-esm-none-javascript +++ b/tests/__snapshots__/problems-esm-none-javascript @@ -9,8 +9,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-none-typescript b/tests/__snapshots__/problems-esm-none-typescript index 0ff9676..a3c753e 100644 --- a/tests/__snapshots__/problems-esm-none-typescript +++ b/tests/__snapshots__/problems-esm-none-typescript @@ -11,9 +11,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-react-javascript b/tests/__snapshots__/problems-esm-react-javascript index a529a49..c844a1c 100644 --- a/tests/__snapshots__/problems-esm-react-javascript +++ b/tests/__snapshots__/problems-esm-react-javascript @@ -11,9 +11,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-react-typescript b/tests/__snapshots__/problems-esm-react-typescript index 295b1ef..8898193 100644 --- a/tests/__snapshots__/problems-esm-react-typescript +++ b/tests/__snapshots__/problems-esm-react-typescript @@ -13,10 +13,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-vue-javascript b/tests/__snapshots__/problems-esm-vue-javascript index da40a1b..0555cc3 100644 --- a/tests/__snapshots__/problems-esm-vue-javascript +++ b/tests/__snapshots__/problems-esm-vue-javascript @@ -11,9 +11,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-esm-vue-typescript b/tests/__snapshots__/problems-esm-vue-typescript index 3b82eaa..3632511 100644 --- a/tests/__snapshots__/problems-esm-vue-typescript +++ b/tests/__snapshots__/problems-esm-vue-typescript @@ -13,10 +13,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-none-javascript b/tests/__snapshots__/problems-script-none-javascript index 96840e0..cd756b1 100644 --- a/tests/__snapshots__/problems-script-none-javascript +++ b/tests/__snapshots__/problems-script-none-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-none-typescript b/tests/__snapshots__/problems-script-none-typescript index d17bee0..a50b00f 100644 --- a/tests/__snapshots__/problems-script-none-typescript +++ b/tests/__snapshots__/problems-script-none-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-react-javascript b/tests/__snapshots__/problems-script-react-javascript index ed1e9bc..b3001f7 100644 --- a/tests/__snapshots__/problems-script-react-javascript +++ b/tests/__snapshots__/problems-script-react-javascript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-react-typescript b/tests/__snapshots__/problems-script-react-typescript index b35aafe..2f744bf 100644 --- a/tests/__snapshots__/problems-script-react-typescript +++ b/tests/__snapshots__/problems-script-react-typescript @@ -14,10 +14,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-vue-javascript b/tests/__snapshots__/problems-script-vue-javascript index 4c0fb51..42f07b1 100644 --- a/tests/__snapshots__/problems-script-vue-javascript +++ b/tests/__snapshots__/problems-script-vue-javascript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/problems-script-vue-typescript b/tests/__snapshots__/problems-script-vue-typescript index 9244df2..4a91e35 100644 --- a/tests/__snapshots__/problems-script-vue-typescript +++ b/tests/__snapshots__/problems-script-vue-typescript @@ -14,10 +14,10 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "@eslint/js", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-none-javascript b/tests/__snapshots__/syntax-commonjs-none-javascript index c92284f..6035d03 100644 --- a/tests/__snapshots__/syntax-commonjs-none-javascript +++ b/tests/__snapshots__/syntax-commonjs-none-javascript @@ -8,7 +8,7 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-none-typescript b/tests/__snapshots__/syntax-commonjs-none-typescript index 7f3d2be..2afed03 100644 --- a/tests/__snapshots__/syntax-commonjs-none-typescript +++ b/tests/__snapshots__/syntax-commonjs-none-typescript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-react-javascript b/tests/__snapshots__/syntax-commonjs-react-javascript index c99a6ff..724bca5 100644 --- a/tests/__snapshots__/syntax-commonjs-react-javascript +++ b/tests/__snapshots__/syntax-commonjs-react-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-react-typescript b/tests/__snapshots__/syntax-commonjs-react-typescript index 80e932e..05dcabe 100644 --- a/tests/__snapshots__/syntax-commonjs-react-typescript +++ b/tests/__snapshots__/syntax-commonjs-react-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-vue-javascript b/tests/__snapshots__/syntax-commonjs-vue-javascript index 478b344..a66b850 100644 --- a/tests/__snapshots__/syntax-commonjs-vue-javascript +++ b/tests/__snapshots__/syntax-commonjs-vue-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-commonjs-vue-typescript b/tests/__snapshots__/syntax-commonjs-vue-typescript index 34a5635..9222bc7 100644 --- a/tests/__snapshots__/syntax-commonjs-vue-typescript +++ b/tests/__snapshots__/syntax-commonjs-vue-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-none-javascript b/tests/__snapshots__/syntax-esm-none-javascript index 2da2340..1e9a0e1 100644 --- a/tests/__snapshots__/syntax-esm-none-javascript +++ b/tests/__snapshots__/syntax-esm-none-javascript @@ -7,7 +7,7 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-none-typescript b/tests/__snapshots__/syntax-esm-none-typescript index e9f51f1..3dc297b 100644 --- a/tests/__snapshots__/syntax-esm-none-typescript +++ b/tests/__snapshots__/syntax-esm-none-typescript @@ -9,8 +9,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-react-javascript b/tests/__snapshots__/syntax-esm-react-javascript index 9a6bdf1..d5b5aa4 100644 --- a/tests/__snapshots__/syntax-esm-react-javascript +++ b/tests/__snapshots__/syntax-esm-react-javascript @@ -9,8 +9,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-react-typescript b/tests/__snapshots__/syntax-esm-react-typescript index 4221331..04bdc76 100644 --- a/tests/__snapshots__/syntax-esm-react-typescript +++ b/tests/__snapshots__/syntax-esm-react-typescript @@ -11,9 +11,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-vue-javascript b/tests/__snapshots__/syntax-esm-vue-javascript index 60f0964..00a8b83 100644 --- a/tests/__snapshots__/syntax-esm-vue-javascript +++ b/tests/__snapshots__/syntax-esm-vue-javascript @@ -9,8 +9,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-esm-vue-typescript b/tests/__snapshots__/syntax-esm-vue-typescript index e909753..4fc0ce5 100644 --- a/tests/__snapshots__/syntax-esm-vue-typescript +++ b/tests/__snapshots__/syntax-esm-vue-typescript @@ -11,9 +11,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-none-javascript b/tests/__snapshots__/syntax-script-none-javascript index 0e7bc5d..5fd05d0 100644 --- a/tests/__snapshots__/syntax-script-none-javascript +++ b/tests/__snapshots__/syntax-script-none-javascript @@ -8,7 +8,7 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-none-typescript b/tests/__snapshots__/syntax-script-none-typescript index 917262d..57c5d79 100644 --- a/tests/__snapshots__/syntax-script-none-typescript +++ b/tests/__snapshots__/syntax-script-none-typescript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-react-javascript b/tests/__snapshots__/syntax-script-react-javascript index 733b3b8..32b9953 100644 --- a/tests/__snapshots__/syntax-script-react-javascript +++ b/tests/__snapshots__/syntax-script-react-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-react-typescript b/tests/__snapshots__/syntax-script-react-typescript index 475ab3f..1ae72f2 100644 --- a/tests/__snapshots__/syntax-script-react-typescript +++ b/tests/__snapshots__/syntax-script-react-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-react", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-vue-javascript b/tests/__snapshots__/syntax-script-vue-javascript index 0392812..e350254 100644 --- a/tests/__snapshots__/syntax-script-vue-javascript +++ b/tests/__snapshots__/syntax-script-vue-javascript @@ -10,8 +10,8 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file diff --git a/tests/__snapshots__/syntax-script-vue-typescript b/tests/__snapshots__/syntax-script-vue-typescript index c15aa12..39b2f1e 100644 --- a/tests/__snapshots__/syntax-script-vue-typescript +++ b/tests/__snapshots__/syntax-script-vue-typescript @@ -12,9 +12,9 @@ export default [ ];", "configFilename": "eslint.config.js", "devDependencies": [ - "eslint", "globals", "typescript-eslint", "eslint-plugin-vue", + "eslint", ], } \ No newline at end of file From 9047c2df39b06281428cb863b3c981795fde714d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 11:01:19 +0800 Subject: [PATCH 3/7] docs: use latest --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 091645e..61385ac 100644 --- a/README.md +++ b/README.md @@ -28,5 +28,5 @@ npm init @eslint/config@latest -- --config eslint-config-standard To use an eslintrc-style (legacy) shared config: ```bash -npm init @eslint/config -- --eslintrc --config eslint-config-standard +npm init @eslint/config@latest -- --eslintrc --config eslint-config-standard ``` From 59fefd3695c4fd4c6b81a868d227544d7d35dee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 12:45:21 +0800 Subject: [PATCH 4/7] fix: rename styleguide to config --- bin/create-config.js | 2 +- lib/config-generator.js | 16 ++++++++-------- tests/config-snapshots.spec.js | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/create-config.js b/bin/create-config.js index f385b20..6623c25 100755 --- a/bin/create-config.js +++ b/bin/create-config.js @@ -31,7 +31,7 @@ if (sharedConfigIndex === -1) { // passed "--config" const packageName = argv[sharedConfigIndex + 1]; const type = argv.includes("--eslintrc") ? "eslintrc" : "flat"; - const answers = { purpose: "style", moduleType: "module", styleguide: { packageName, type } }; + const answers = { config: { packageName, type } }; const generator = new ConfigGenerator({ cwd, packageJsonPath, answers }); generator.calc(); diff --git a/lib/config-generator.js b/lib/config-generator.js index 792f319..a3472d1 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -108,20 +108,20 @@ export class ConfigGenerator { const isESMModule = isPackageTypeModule(this.packageJsonPath); this.result.configFilename = isESMModule ? "eslint.config.js" : "eslint.config.mjs"; - this.answers.styleguide = typeof this.answers.styleguide === "string" - ? { packageName: this.answers.styleguide, type: "flat" } - : this.answers.styleguide; + this.answers.config = typeof this.answers.config === "string" + ? { packageName: this.answers.config, type: "flat" } + : this.answers.config; // replaced `eslint-config-airbnb-base` with `eslint-config-airbnb`(for react supports) - if (this.answers.styleguide?.packageName === "eslint-config-airbnb-base" && this.answers.framework === "react") { - this.answers.styleguide.packageName = "eslint-config-airbnb"; + if (this.answers.config?.packageName === "eslint-config-airbnb-base" && this.answers.framework === "react") { + this.answers.config.packageName = "eslint-config-airbnb"; this.answers.framework = "none"; } // tseslint should have been a dependency in the shared configs // avoid install tseslint - it may install multi tseslint versions // see https://github.com/eslint/create-config/issues/97 - if (this.answers.styleguide && this.answers.language === "typescript") { + if (this.answers.config && this.answers.language === "typescript") { this.answers.language = "javascript"; } @@ -183,8 +183,8 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug importContent += "import pluginReactConfig from \"eslint-plugin-react/configs/recommended.js\";\n"; exportContent += " pluginReactConfig,\n"; } - if (this.answers.styleguide) { - const styleguide = this.answers.styleguide; + if (this.answers.config) { + const styleguide = this.answers.config; this.result.devDependencies.push(styleguide.packageName); diff --git a/tests/config-snapshots.spec.js b/tests/config-snapshots.spec.js index 47c04a0..e8c8053 100644 --- a/tests/config-snapshots.spec.js +++ b/tests/config-snapshots.spec.js @@ -74,13 +74,13 @@ describe("generate config for cjs projects", () => { const inputs = [{ name: "config--eslint-config-xo", answers: { - styleguide: { packageName: "eslint-config-xo", type: "eslintrc" } + config: { packageName: "eslint-config-xo", type: "eslintrc" } } }, { name: "config-eslint-config-airbnb-base", answers: { - styleguide: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } + config: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } } }]; From b457964a96a22aa216aa1cf806006b4a57bb8a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 12:50:46 +0800 Subject: [PATCH 5/7] chore: rm unused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唯然 --- lib/config-generator.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/config-generator.js b/lib/config-generator.js index a3472d1..63b08d1 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -112,19 +112,6 @@ export class ConfigGenerator { ? { packageName: this.answers.config, type: "flat" } : this.answers.config; - // replaced `eslint-config-airbnb-base` with `eslint-config-airbnb`(for react supports) - if (this.answers.config?.packageName === "eslint-config-airbnb-base" && this.answers.framework === "react") { - this.answers.config.packageName = "eslint-config-airbnb"; - this.answers.framework = "none"; - } - - // tseslint should have been a dependency in the shared configs - // avoid install tseslint - it may install multi tseslint versions - // see https://github.com/eslint/create-config/issues/97 - if (this.answers.config && this.answers.language === "typescript") { - this.answers.language = "javascript"; - } - let importContent = ""; const helperContent = `import path from "path"; import { fileURLToPath } from "url"; From cc46acfd16c23c9e5671d536d51ff5e648d754e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Wed, 24 Apr 2024 12:57:07 +0800 Subject: [PATCH 6/7] chore: add a few more tests --- .../__snapshots__/config@eslint-config-airbnb | 27 +++++++++++++++++++ ...-base => config@eslint-config-airbnb-base} | 0 .../config@eslint-config-standard | 26 ++++++++++++++++++ ...lint-config-xo => config@eslint-config-xo} | 0 tests/config-snapshots.spec.js | 14 ++++++++-- 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 tests/__snapshots__/config@eslint-config-airbnb rename tests/__snapshots__/{config-eslint-config-airbnb-base => config@eslint-config-airbnb-base} (100%) create mode 100644 tests/__snapshots__/config@eslint-config-standard rename tests/__snapshots__/{config--eslint-config-xo => config@eslint-config-xo} (100%) diff --git a/tests/__snapshots__/config@eslint-config-airbnb b/tests/__snapshots__/config@eslint-config-airbnb new file mode 100644 index 0000000..8a37ae6 --- /dev/null +++ b/tests/__snapshots__/config@eslint-config-airbnb @@ -0,0 +1,27 @@ +{ + "configContent": " +import path from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; +import pluginJs from "@eslint/js"; + +// mimic CommonJS variables -- not needed if using CommonJS +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); + +export default [ + ...compat.extends("airbnb"), +];", + "configFilename": "eslint.config.mjs", + "devDependencies": [ + "eslint-config-airbnb", + "eslint@^7.32.0 || ^8.2.0", + "eslint-plugin-import@^2.25.3", + "eslint-plugin-jsx-a11y@^6.5.1", + "eslint-plugin-react@^7.28.0", + "eslint-plugin-react-hooks@^4.3.0", + "@eslint/eslintrc", + "@eslint/js", + ], +} \ No newline at end of file diff --git a/tests/__snapshots__/config-eslint-config-airbnb-base b/tests/__snapshots__/config@eslint-config-airbnb-base similarity index 100% rename from tests/__snapshots__/config-eslint-config-airbnb-base rename to tests/__snapshots__/config@eslint-config-airbnb-base diff --git a/tests/__snapshots__/config@eslint-config-standard b/tests/__snapshots__/config@eslint-config-standard new file mode 100644 index 0000000..f16330b --- /dev/null +++ b/tests/__snapshots__/config@eslint-config-standard @@ -0,0 +1,26 @@ +{ + "configContent": " +import path from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; +import pluginJs from "@eslint/js"; + +// mimic CommonJS variables -- not needed if using CommonJS +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended}); + +export default [ + ...compat.extends("standard"), +];", + "configFilename": "eslint.config.mjs", + "devDependencies": [ + "eslint-config-standard", + "eslint@^8.0.1", + "eslint-plugin-import@^2.25.2", + "eslint-plugin-n@^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise@^6.0.0", + "@eslint/eslintrc", + "@eslint/js", + ], +} \ No newline at end of file diff --git a/tests/__snapshots__/config--eslint-config-xo b/tests/__snapshots__/config@eslint-config-xo similarity index 100% rename from tests/__snapshots__/config--eslint-config-xo rename to tests/__snapshots__/config@eslint-config-xo diff --git a/tests/config-snapshots.spec.js b/tests/config-snapshots.spec.js index e8c8053..f39bc0e 100644 --- a/tests/config-snapshots.spec.js +++ b/tests/config-snapshots.spec.js @@ -72,16 +72,26 @@ describe("generate config for esm projects", () => { describe("generate config for cjs projects", () => { const cjsProjectDir = join(__filename, "../fixtures/cjs-project"); const inputs = [{ - name: "config--eslint-config-xo", + name: "config@eslint-config-xo", answers: { config: { packageName: "eslint-config-xo", type: "eslintrc" } } }, { - name: "config-eslint-config-airbnb-base", + name: "config@eslint-config-airbnb-base", answers: { config: { packageName: "eslint-config-airbnb-base", type: "eslintrc" } } + }, { + name: "config@eslint-config-airbnb", + answers: { + config: { packageName: "eslint-config-airbnb", type: "eslintrc" } + } + }, { + name: "config@eslint-config-standard", + answers: { + config: { packageName: "eslint-config-standard", type: "eslintrc" } + } }]; inputs.forEach(item => { From b356bc9e6ad7c7577f3bd0178d888f54339cf0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Thu, 25 Apr 2024 10:10:29 +0800 Subject: [PATCH 7/7] chore: add a few more tests --- lib/config-generator.js | 16 ++++++++-------- .../config@eslint-config-standard-flat | 16 ++++++++++++++++ .../config@eslint-config-standard-flat2 | 16 ++++++++++++++++ tests/config-snapshots.spec.js | 10 ++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 tests/__snapshots__/config@eslint-config-standard-flat create mode 100644 tests/__snapshots__/config@eslint-config-standard-flat2 diff --git a/lib/config-generator.js b/lib/config-generator.js index 63b08d1..34dc37d 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -171,24 +171,24 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug exportContent += " pluginReactConfig,\n"; } if (this.answers.config) { - const styleguide = this.answers.config; + const config = this.answers.config; - this.result.devDependencies.push(styleguide.packageName); + this.result.devDependencies.push(config.packageName); // install peer dependencies - it's needed for most eslintrc-style shared configs. - const peers = fetchPeerDependencies(styleguide.packageName); + const peers = fetchPeerDependencies(config.packageName); if (peers !== null) { this.result.devDependencies.push(...peers); } - if (styleguide.type === "flat" || styleguide.type === void 0) { - importContent += `import styleGuide from "${styleguide.packageName}";\n`; - exportContent += " ...[].concat(styleGuide),\n"; - } else if (styleguide.type === "eslintrc") { + if (config.type === "flat" || config.type === void 0) { + importContent += `import config from "${config.packageName}";\n`; + exportContent += " ...[].concat(config),\n"; + } else if (config.type === "eslintrc") { needCompatHelper = true; - const shorthandName = getShorthandName(styleguide.packageName, "eslint-config"); + const shorthandName = getShorthandName(config.packageName, "eslint-config"); exportContent += ` ...compat.extends("${shorthandName}"),\n`; } diff --git a/tests/__snapshots__/config@eslint-config-standard-flat b/tests/__snapshots__/config@eslint-config-standard-flat new file mode 100644 index 0000000..9b748c7 --- /dev/null +++ b/tests/__snapshots__/config@eslint-config-standard-flat @@ -0,0 +1,16 @@ +{ + "configContent": "import config from "eslint-config-standard"; + + +export default [ + ...[].concat(config), +];", + "configFilename": "eslint.config.mjs", + "devDependencies": [ + "eslint-config-standard", + "eslint@^8.0.1", + "eslint-plugin-import@^2.25.2", + "eslint-plugin-n@^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise@^6.0.0", + ], +} \ No newline at end of file diff --git a/tests/__snapshots__/config@eslint-config-standard-flat2 b/tests/__snapshots__/config@eslint-config-standard-flat2 new file mode 100644 index 0000000..9b748c7 --- /dev/null +++ b/tests/__snapshots__/config@eslint-config-standard-flat2 @@ -0,0 +1,16 @@ +{ + "configContent": "import config from "eslint-config-standard"; + + +export default [ + ...[].concat(config), +];", + "configFilename": "eslint.config.mjs", + "devDependencies": [ + "eslint-config-standard", + "eslint@^8.0.1", + "eslint-plugin-import@^2.25.2", + "eslint-plugin-n@^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise@^6.0.0", + ], +} \ No newline at end of file diff --git a/tests/config-snapshots.spec.js b/tests/config-snapshots.spec.js index f39bc0e..21507b9 100644 --- a/tests/config-snapshots.spec.js +++ b/tests/config-snapshots.spec.js @@ -92,6 +92,16 @@ describe("generate config for cjs projects", () => { answers: { config: { packageName: "eslint-config-standard", type: "eslintrc" } } + }, { + name: "config@eslint-config-standard-flat", + answers: { + config: { packageName: "eslint-config-standard", type: "flat" } + } + }, { + name: "config@eslint-config-standard-flat2", + answers: { + config: "eslint-config-standard" + } }]; inputs.forEach(item => {