Skip to content

Commit 7c85bfa

Browse files
committed
support glob patterns
1 parent ad33780 commit 7c85bfa

File tree

3 files changed

+47
-29
lines changed

3 files changed

+47
-29
lines changed

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const path = require('path');
44
const resolve = require('resolve');
55
const tsconfigPaths = require('tsconfig-paths');
66
const debug = require('debug');
7+
const globSync = require('glob').sync;
8+
const isGlob = require('is-glob');
79

810
const log = debug('eslint-import-resolver-typescript');
911

@@ -105,6 +107,12 @@ function initMappers(options) {
105107
: [process.cwd()];
106108

107109
mappers = configPaths
110+
// turn glob patterns into paths
111+
.reduce(
112+
(paths, path) => paths.concat(isGlob(path) ? globSync(path) : path),
113+
[],
114+
)
115+
108116
.map(path => tsconfigPaths.loadConfig(path))
109117
.filter(configLoaderResult => {
110118
const success = configLoaderResult.resultType === 'success';

package-lock.json

Lines changed: 37 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"license": "ISC",
2222
"dependencies": {
2323
"debug": "^4.0.1",
24+
"glob": "^7.1.4",
25+
"is-glob": "^4.0.1",
2426
"resolve": "^1.4.0",
2527
"tsconfig-paths": "^3.6.0"
2628
},

0 commit comments

Comments
 (0)