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

Commit 9883dcd

Browse files
author
Ian VanSchooten
committed
Use findFile helper from atom-linter
1 parent baf1aa8 commit 9883dcd

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

lib/es5-helpers.js

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,10 @@
33
const ChildProcess = require('child_process')
44
const Path = require('path')
55
const FS = require('fs')
6+
const find = require('atom-linter').findFile
67

78
let prefixPath = null
89

9-
function find(startDir, names) {
10-
let localNames
11-
if (typeof names === 'string') {
12-
localNames = [names]
13-
} else {
14-
localNames = names
15-
}
16-
const chunks = startDir.split(Path.sep)
17-
if (startDir[0].match(Path.sep)) {
18-
chunks[0] = Path.sep
19-
}
20-
while (chunks.length) {
21-
const currentDirectory = Path.join(chunks.join(Path.sep))
22-
for (let index = 0; index < localNames.length; index++) {
23-
const filePath = Path.join(currentDirectory, localNames[index])
24-
try {
25-
FS.accessSync(filePath, FS.R_OK)
26-
return filePath
27-
} catch (_) { }
28-
}
29-
30-
chunks.pop()
31-
}
32-
return null
33-
}
34-
3510
function findEslintDir(params) {
3611
const eslintPathLocal = Path.join(FS.realpathSync(Path.join(__dirname, '..')), 'node_modules', 'eslint')
3712
const modulesPath = find(params.fileDir, 'node_modules')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lint": "eslint ."
1414
},
1515
"dependencies": {
16-
"atom-linter": "^3.3.9",
16+
"atom-linter": "^3.4.0",
1717
"atom-package-deps": "^3.0.5",
1818
"childprocess-promise": "^3.0.0",
1919
"escape-html": "^1.0.3",

0 commit comments

Comments
 (0)