You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// use a factory to get config outside of the resolver
69
74
},
70
75
},
@@ -89,6 +94,22 @@ the module identifier (`./imported-file`).
89
94
90
95
the absolute path to the file making the import (`/some/path/to/module.js`)
91
96
97
+
##### `options`
98
+
99
+
###### `options.context`
100
+
101
+
> [!NOTE]
102
+
> Only available after `eslint-plugin-import-x@4.13.0+`
103
+
104
+
Please view [ChildContext] and [RuleContext] for more details.
105
+
106
+
###### `options.tsconfig`
107
+
108
+
> [!NOTE]
109
+
> Only available after `eslint-plugin-import-x@4.13.0+`
110
+
111
+
Please view [TsConfigJsonResolved] for more details.
112
+
92
113
### Optional `name`
93
114
94
115
the resolver name used in logs/debug output
@@ -204,6 +225,14 @@ the absolute path to the file making the import (`/some/path/to/module.js`)
204
225
an object provided via the `import/resolver` setting. `my-cool-resolver` will get `["some", "stuff"]` as its `config`, while
205
226
`node` will get `{ "paths": ["a", "b", "c"] }` provided as `config`.
206
227
228
+
##### `undefined`
229
+
230
+
For compatibility reason, the 4th argument is always passed as `undefined`. Take [TypeScript resolver](https://github.com/import-js/eslint-import-resolver-typescript/blob/c45039e5c310479c1e178c2180e054380facbadd/src/index.ts#L69) for example. It uses the 4th argument to pass the optional [unrs-resolver] `ResolverFactory` instance to support both `v2` and `v3` interface at the same time.
231
+
232
+
##### `options`
233
+
234
+
Same as [options](#options) in `v3` resolver above
235
+
207
236
### Example
208
237
209
238
Here is most of the [Node resolver] at the time of this writing. It is just a wrapper around substack/Browserify's synchronous [`resolve`][resolve]:
@@ -212,7 +241,7 @@ Here is most of the [Node resolver] at the time of this writing. It is just a wr
212
241
var resolve = require('resolve/sync')
213
242
var isCoreModule = require('is-core-module')
214
243
215
-
exports.resolve = function (source, file, config) {
244
+
exports.resolve = function (source, file, config, _, options) {
216
245
if (isCoreModule(source)) return { found: true, path: null }
0 commit comments