File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 5
5
"use strict"
6
6
7
7
const path = require ( "path" )
8
- const needle = `${ path . sep } eslint${ path . sep } `
8
+ const needle = `${ path . sep } node_modules ${ path . sep } eslint${ path . sep } `
9
9
10
10
module . exports = ( ) => {
11
11
const eslintPaths = new Set (
12
12
Object . keys ( require . cache )
13
13
. filter ( id => id . includes ( needle ) )
14
14
. map ( id => id . slice ( 0 , id . indexOf ( needle ) + needle . length ) )
15
15
)
16
- return Array . from ( eslintPaths ) . map ( eslintPath => require ( eslintPath ) . Linter )
16
+ const linters = [ ]
17
+
18
+ for ( const eslintPath of eslintPaths ) {
19
+ try {
20
+ const linter = require ( eslintPath ) . Linter
21
+
22
+ if ( linter ) {
23
+ linters . push ( linter )
24
+ }
25
+ } catch ( error ) {
26
+ if ( error . code !== "MODULE_NOT_FOUND" ) {
27
+ throw error
28
+ }
29
+ }
30
+ }
31
+
32
+ return linters
17
33
}
You can’t perform that action at this time.
0 commit comments