From 9b3cfcf9d1c3f07e6eaa328c4cb437fb78b5e46c Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 3 Dec 2018 17:51:19 +0800 Subject: [PATCH] fix(cli-plugin-eslint): make eslint deps optional 1. In @vue/cli-plugin-eslint 3.1.0+, eslint will be explicitly added to the project's package.json, so it is **optional**. 2. `optionalDependencies` will still be installed by npm by default, just no longer cause installation to fail when error happens. 3. ESLint v4 did cause weird errors sometimes, like `npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed.` Though this warning never caused any errors on my machine, I think it's good to make the plugin fail-safe. --- packages/@vue/cli-plugin-eslint/package.json | 6 ++++-- packages/@vue/cli-service-global/package.json | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/@vue/cli-plugin-eslint/package.json b/packages/@vue/cli-plugin-eslint/package.json index d679c27c5d..7ab74d36c1 100644 --- a/packages/@vue/cli-plugin-eslint/package.json +++ b/packages/@vue/cli-plugin-eslint/package.json @@ -24,9 +24,11 @@ "dependencies": { "@vue/cli-shared-utils": "^3.2.0", "babel-eslint": "^10.0.1", - "eslint": "^4.19.1", "eslint-loader": "^2.1.1", - "eslint-plugin-vue": "^4.7.1", "globby": "^8.0.1" + }, + "optionalDependencies": { + "eslint": "^4.19.1", + "eslint-plugin-vue": "^4.7.1" } } diff --git a/packages/@vue/cli-service-global/package.json b/packages/@vue/cli-service-global/package.json index e1ca2a34bf..c2ff92a290 100644 --- a/packages/@vue/cli-service-global/package.json +++ b/packages/@vue/cli-service-global/package.json @@ -27,6 +27,8 @@ "@vue/cli-service": "^3.2.0", "babel-eslint": "^10.0.1", "chalk": "^2.4.1", + "eslint": "^4.19.1", + "eslint-plugin-vue": "^4.7.1", "resolve": "^1.8.1", "vue": "^2.5.17", "vue-template-compiler": "^2.5.17"