From cf0bd483ce698413cf8ecbef9ab941f813d83453 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 21 Feb 2023 19:20:59 +0800 Subject: [PATCH] refactor!: when prettier is used, don't format with eslint See https://github.com/vuejs/create-vue/issues/190 --- bin/create-eslint-config.js | 1 + index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/create-eslint-config.js b/bin/create-eslint-config.js index f262bab..99f375b 100644 --- a/bin/create-eslint-config.js +++ b/bin/create-eslint-config.js @@ -276,6 +276,7 @@ const { pkg: pkgToExtend, files } = createConfig({ // Add `lint` command to package.json // - Vue CLI -> vue-cli-service lint // - Otherwise -> eslint ... (extensions vary based on the language) +// Add a `format` command to package.json when prettier is used // TODO: // Add a note about that Vue CLI projects may need a `tsconfig.eslint.json` diff --git a/index.js b/index.js index 4180e7b..6350674 100644 --- a/index.js +++ b/index.js @@ -110,7 +110,8 @@ export default function createConfig ({ if (needsPrettier) { addDependency('prettier') - addDependencyAndExtend('@vue/eslint-config-prettier') + addDependency('@vue/eslint-config-prettier') + eslintConfig.extends.push('@vue/eslint-config-prettier/skip-formatting') } deepMerge(pkg.devDependencies, additionalDependencies)