Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 4dd6500

Browse files
committed
fix: fallback to other methods when global Eslint is not found
1 parent 1676b9b commit 4dd6500

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/worker-helpers.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ function isDirectory(dirPath) {
4747
return isDir
4848
}
4949

50-
export function findESLintDirectory(modulesDir, config, projectPath) {
50+
export function findESLintDirectory(modulesDir, config, projectPath, fallback = false) {
5151
let eslintDir = null
5252
let locationType = null
53-
if (config.global.useGlobalEslint) {
53+
if (config.global.useGlobalEslint && !fallback) {
5454
locationType = 'global'
5555
const configGlobal = cleanPath(config.global.globalNodePath)
5656
const prefixPath = configGlobal || getNodePrefixPath()
@@ -79,7 +79,8 @@ export function findESLintDirectory(modulesDir, config, projectPath) {
7979
}
8080

8181
if (config.global.useGlobalEslint) {
82-
throw new Error('ESLint not found, please ensure the global Node path is set correctly.')
82+
console.warn('ESLint not found, please ensure the global Node path is set correctly. \n Using other methods to find Eslint...')
83+
findESLintDirectory(modulesDir, config, projectPath, true)
8384
}
8485

8586
return {

0 commit comments

Comments
 (0)