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

Commit 6465ecd

Browse files
author
steelbrain
committed
🆕 Add getModulesDirectory helper
1 parent 2983cc5 commit 6465ecd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/helpers.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export function spawnWorker() {
3838
}}}
3939
}
4040

41+
export function getModulesDirectory(fileDir) {
42+
return find(fileDir, 'node_modules')
43+
}
44+
4145
export function getCliFromDirectory(path) {
4246
try {
4347
return require(Path.join(path, 'lib', 'cli.js'))
@@ -71,7 +75,7 @@ export function getBundledEslintDirectory() {
7175
return bundledEslintDirectory
7276
}
7377

74-
export function getEslintDirectory(params) {
78+
export function getEslintDirectory(params, modulesPath) {
7579
if (params.global) {
7680
const prefixPath = getNodePrefixPath()
7781
if (process.platform === 'win32') {
@@ -80,7 +84,6 @@ export function getEslintDirectory(params) {
8084
return Path.join(params.nodePath || prefixPath, 'lib', 'node_modules', 'eslint')
8185
}
8286
} else {
83-
const modulesPath = find(params.fileDir, 'node_modules')
8487
const eslintPath = Path.join(modulesPath, 'eslint')
8588
try {
8689
FS.accessSync(eslintPath, FS.R_OK)

0 commit comments

Comments
 (0)