Skip to content

Commit becde30

Browse files
committed
fix: should fallback to local eslint, fixes instant prototyping
closes #2866
1 parent b1bba2f commit becde30

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ module.exports = (api, options) => {
66
// Use loadModule to allow users to customize their ESLint dependency version.
77
const { loadModule } = require('@vue/cli-shared-utils')
88
const cwd = api.getCwd()
9-
const eslintPkg = loadModule('eslint/package.json', cwd, true)
9+
const eslintPkg =
10+
loadModule('eslint/package.json', cwd, true) ||
11+
require('eslint/package.json')
1012

1113
// eslint-loader doesn't bust cache when eslint config changes
1214
// so we have to manually generate a cache identifier that takes the config
@@ -46,7 +48,9 @@ module.exports = (api, options) => {
4648
cacheIdentifier,
4749
emitWarning: options.lintOnSave !== 'error',
4850
emitError: options.lintOnSave === 'error',
49-
formatter: loadModule('eslint/lib/formatters/codeframe', cwd, true)
51+
formatter:
52+
loadModule('eslint/lib/formatters/codeframe', cwd, true) ||
53+
require('eslint/lib/formatters/codeframe')
5054
})
5155
})
5256
}

packages/@vue/cli-plugin-eslint/lint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function lint (args = {}, api) {
2121
const path = require('path')
2222
const cwd = api.resolve('.')
2323
const { log, done, exit, chalk, loadModule } = require('@vue/cli-shared-utils')
24-
const { CLIEngine } = loadModule('eslint', cwd, true)
24+
const { CLIEngine } = loadModule('eslint', cwd, true) || require('eslint')
2525
const extensions = require('./eslintOptions').extensions(api)
2626

2727
const argsConfig = normalizeConfig(args)

packages/@vue/cli-service-global/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@vue/cli-service": "^3.1.0",
2828
"babel-eslint": "^10.0.1",
2929
"chalk": "^2.4.1",
30-
"eslint": "^5.8.0",
3130
"eslint-plugin-vue": "^5.0.0-0",
3231
"resolve": "^1.8.1",
3332
"vue": "^2.5.17",

0 commit comments

Comments
 (0)