Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix eslint not found error in vue serve command #4728

Merged
merged 1 commit into from Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 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 { resolveModule, 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) ||
loadModule('eslint/package.json', __dirname, true)

// eslint-loader doesn't bust cache when eslint config changes
// so we have to manually generate a cache identifier that takes the config
Expand All @@ -28,10 +30,6 @@ module.exports = (api, options) => {
)

api.chainWebpack(webpackConfig => {
webpackConfig.resolveLoader.modules.prepend(
path.join(__dirname, 'node_modules')
)

const { lintOnSave } = options
const allWarnings = lintOnSave === true || lintOnSave === 'warning'
const allErrors = lintOnSave === 'error'
Expand All @@ -45,7 +43,7 @@ module.exports = (api, options) => {
.end()
.test(/\.(vue|(j|t)sx?)$/)
.use('eslint-loader')
.loader('eslint-loader')
.loader(require.resolve('eslint-loader'))
.options({
extensions,
cache: true,
Expand Down