@@ -8,26 +8,6 @@ const log = require('debug')('eslint-plugin-import:resolver:node');
88
99exports . interfaceVersion = 2 ;
1010
11- exports . resolve = function ( source , file , config ) {
12- log ( 'Resolving:' , source , 'from:' , file ) ;
13- let resolvedPath ;
14-
15- if ( isCoreModule ( source ) ) {
16- log ( 'resolved to core' ) ;
17- return { found : true , path : null } ;
18- }
19-
20- try {
21- const cachedFilter = function ( pkg , dir ) { return packageFilter ( pkg , dir , config ) ; } ;
22- resolvedPath = resolve ( source , opts ( file , config , cachedFilter ) ) ;
23- log ( 'Resolved to:' , resolvedPath ) ;
24- return { found : true , path : resolvedPath } ;
25- } catch ( err ) {
26- log ( 'resolve threw error:' , err ) ;
27- return { found : false } ;
28- }
29- } ;
30-
3111function opts ( file , config , packageFilter ) {
3212 return Object . assign ( { // more closely matches Node (#333)
3313 // plus 'mjs' for native modules! (#939)
@@ -64,3 +44,23 @@ function packageFilter(pkg, dir, config) {
6444 }
6545 return pkg ;
6646}
47+
48+ exports . resolve = function ( source , file , config ) {
49+ log ( 'Resolving:' , source , 'from:' , file ) ;
50+ let resolvedPath ;
51+
52+ if ( isCoreModule ( source ) ) {
53+ log ( 'resolved to core' ) ;
54+ return { found : true , path : null } ;
55+ }
56+
57+ try {
58+ const cachedFilter = function ( pkg , dir ) { return packageFilter ( pkg , dir , config ) ; } ;
59+ resolvedPath = resolve ( source , opts ( file , config , cachedFilter ) ) ;
60+ log ( 'Resolved to:' , resolvedPath ) ;
61+ return { found : true , path : resolvedPath } ;
62+ } catch ( err ) {
63+ log ( 'resolve threw error:' , err ) ;
64+ return { found : false } ;
65+ }
66+ } ;
0 commit comments