mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-07 15:00:47 -06:00
fix: should fallback to local eslint, fixes instant prototyping
closes #2866
This commit is contained in:
@@ -6,7 +6,9 @@ module.exports = (api, options) => {
|
||||
// Use loadModule to allow users to customize their ESLint dependency version.
|
||||
const { loadModule } = require('@vue/cli-shared-utils')
|
||||
const cwd = api.getCwd()
|
||||
const eslintPkg = loadModule('eslint/package.json', cwd, true)
|
||||
const eslintPkg =
|
||||
loadModule('eslint/package.json', cwd, true) ||
|
||||
require('eslint/package.json')
|
||||
|
||||
// eslint-loader doesn't bust cache when eslint config changes
|
||||
// so we have to manually generate a cache identifier that takes the config
|
||||
@@ -46,7 +48,9 @@ module.exports = (api, options) => {
|
||||
cacheIdentifier,
|
||||
emitWarning: options.lintOnSave !== 'error',
|
||||
emitError: options.lintOnSave === 'error',
|
||||
formatter: loadModule('eslint/lib/formatters/codeframe', cwd, true)
|
||||
formatter:
|
||||
loadModule('eslint/lib/formatters/codeframe', cwd, true) ||
|
||||
require('eslint/lib/formatters/codeframe')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = function lint (args = {}, api) {
|
||||
const path = require('path')
|
||||
const cwd = api.resolve('.')
|
||||
const { log, done, exit, chalk, loadModule } = require('@vue/cli-shared-utils')
|
||||
const { CLIEngine } = loadModule('eslint', cwd, true)
|
||||
const { CLIEngine } = loadModule('eslint', cwd, true) || require('eslint')
|
||||
const extensions = require('./eslintOptions').extensions(api)
|
||||
|
||||
const argsConfig = normalizeConfig(args)
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"@vue/cli-service": "^3.1.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"chalk": "^2.4.1",
|
||||
"eslint": "^5.8.0",
|
||||
"eslint-plugin-vue": "^5.0.0-0",
|
||||
"resolve": "^1.8.1",
|
||||
"vue": "^2.5.17",
|
||||
|
||||
Reference in New Issue
Block a user