From 114313cc2f2d712b54fe961fefc129f2fac8dee1 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 18 Feb 2019 00:02:32 +0800 Subject: [PATCH] fix(cli-plugin-eslint): make eslint deps optional (#3068) 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 17aa95a29..729536bb6 100644 --- a/packages/@vue/cli-plugin-eslint/package.json +++ b/packages/@vue/cli-plugin-eslint/package.json @@ -25,10 +25,12 @@ "dependencies": { "@vue/cli-shared-utils": "^3.4.0", "babel-eslint": "^10.0.1", - "eslint": "^4.19.1", "eslint-loader": "^2.1.1", - "eslint-plugin-vue": "^4.7.1", "globby": "^9.0.0", "webpack": ">=4 < 4.29" + }, + "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 ae7d63bd0..1300794ba 100644 --- a/packages/@vue/cli-service-global/package.json +++ b/packages/@vue/cli-service-global/package.json @@ -28,6 +28,8 @@ "@vue/cli-service": "^3.4.0", "babel-eslint": "^10.0.1", "chalk": "^2.4.2", + "eslint": "^4.19.1", + "eslint-plugin-vue": "^4.7.1", "resolve": "^1.10.0", "vue": "^2.5.22", "vue-template-compiler": "^2.5.22"