Skip to content

Commit

Permalink
fix: should fallback to local eslint, fixes instant prototyping
Browse files Browse the repository at this point in the history
closes #2866
  • Loading branch information
sodatea committed Nov 2, 2018
1 parent b1bba2f commit becde30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/@vue/cli-plugin-eslint/index.js
Expand Up @@ -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
Expand Down Expand Up @@ -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')
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-eslint/lint.js
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion packages/@vue/cli-service-global/package.json
Expand Up @@ -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",
Expand Down

0 comments on commit becde30

Please sign in to comment.