Skip to content

Commit 30b6873

Browse files
authored
fix(eslint-migrator): fix local eslint major version detection (#5363)
closes #5357
1 parent 9855c52 commit 30b6873

File tree

1 file changed

+5
-4
lines changed
  • packages/@vue/cli-plugin-eslint/migrator

1 file changed

+5
-4
lines changed

packages/@vue/cli-plugin-eslint/migrator/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ module.exports = async (api) => {
2121
}
2222

2323
const localESLintMajor = semver.major(
24-
semver.maxSatisfying(
25-
['4.99.0', '5.99.0', '6.99.0'],
26-
localESLintRange
27-
)
24+
semver.maxSatisfying(['4.99.0', '5.99.0', '6.99.0'], localESLintRange) ||
25+
// in case the user does not specify a typical caret range;
26+
// it is used as **fallback** because the user may have not previously
27+
// installed eslint yet, such as in the case that they are from v3.0.x
28+
require('eslint/package.json').version
2829
)
2930

3031
if (localESLintMajor === 6) {

0 commit comments

Comments
 (0)