From 30b6873fed00bb91748e76fbb11ba0f42913e5b8 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 7 Apr 2020 18:54:00 +0800 Subject: [PATCH] fix(eslint-migrator): fix local eslint major version detection (#5363) closes #5357 --- packages/@vue/cli-plugin-eslint/migrator/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-plugin-eslint/migrator/index.js b/packages/@vue/cli-plugin-eslint/migrator/index.js index 08b03584e9..5185df2b88 100644 --- a/packages/@vue/cli-plugin-eslint/migrator/index.js +++ b/packages/@vue/cli-plugin-eslint/migrator/index.js @@ -21,10 +21,11 @@ module.exports = async (api) => { } const localESLintMajor = semver.major( - semver.maxSatisfying( - ['4.99.0', '5.99.0', '6.99.0'], - localESLintRange - ) + semver.maxSatisfying(['4.99.0', '5.99.0', '6.99.0'], localESLintRange) || + // in case the user does not specify a typical caret range; + // it is used as **fallback** because the user may have not previously + // installed eslint yet, such as in the case that they are from v3.0.x + require('eslint/package.json').version ) if (localESLintMajor === 6) {