File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,13 @@ module.exports = {
107
107
return allLocalImports
108
108
}
109
109
110
+ function getCwd ( ) {
111
+ if ( context . getCwd ) {
112
+ return context . getCwd ( )
113
+ }
114
+ return path . resolve ( '' )
115
+ }
116
+
110
117
/**
111
118
* @param {string } moduleName
112
119
* @param {Program } ast
@@ -116,7 +123,7 @@ module.exports = {
116
123
/** @type {string } */
117
124
let modulePath
118
125
if ( moduleName . startsWith ( '.' ) ) {
119
- modulePath = safeRequireResolve ( path . join ( context . getCwd ( ) , moduleName ) )
126
+ modulePath = safeRequireResolve ( path . join ( getCwd ( ) , moduleName ) )
120
127
} else if ( path . isAbsolute ( moduleName ) ) {
121
128
modulePath = safeRequireResolve ( moduleName )
122
129
} else {
Original file line number Diff line number Diff line change @@ -328,7 +328,8 @@ export namespace Rule {
328
328
markVariableAsUsed ( name : string ) : boolean
329
329
report ( descriptor : ReportDescriptor ) : void
330
330
331
- getCwd ( ) : string
331
+ // eslint@6 does not have this method.
332
+ getCwd ?: ( ) => string
332
333
}
333
334
334
335
type ReportDescriptor =
You can’t perform that action at this time.
0 commit comments