Skip to content

Commit 01f7f27

Browse files
committed
fix: fix eslint path resolution in vue serve (#4246)
fixes #4237 (cherry picked from commit 0ba505c)
1 parent fc6e0b7 commit 01f7f27

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = (api, options) => {
4343
.pre()
4444
.exclude
4545
.add(/node_modules/)
46-
.add(require('path').dirname(require.resolve('@vue/cli-service')))
46+
.add(require('path').dirname(require.resolve('@vue/cli-service'))) // eslint-disable-line
4747
.end()
4848
.test(/\.(vue|(j|t)sx?)$/)
4949
.use('eslint-loader')
@@ -55,7 +55,10 @@ module.exports = (api, options) => {
5555
emitWarning: allWarnings,
5656
// only emit errors in production mode.
5757
emitError: allErrors,
58-
eslintPath: path.dirname(resolveModule('eslint/package.json', cwd)),
58+
eslintPath: path.dirname(
59+
resolveModule('eslint/package.json', cwd) ||
60+
require.resolve('eslint/package.json')
61+
),
5962
formatter:
6063
loadModule('eslint/lib/formatters/codeframe', cwd, true) ||
6164
require('eslint/lib/formatters/codeframe')

0 commit comments

Comments
 (0)