From 943b18b78fdbbce02601915fdf0bf916440a0a16 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Wed, 1 May 2019 07:52:22 -0400 Subject: [PATCH 1/2] allow null config means you can specify this resolver using just `import/resolver: 'typescript'` instead of `import/resolver: {'typescript':{}}` --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7a14792..adfd17d 100644 --- a/index.js +++ b/index.js @@ -32,7 +32,7 @@ function resolveFile(source, file, config) { ); // setup tsconfig-paths - const searchStart = config.directory || process.cwd(); + const searchStart = (config && config.directory) || process.cwd(); const configLoaderResult = tsconfigPaths.loadConfig(searchStart); if (configLoaderResult.resultType === 'success') { const matchPath = tsconfigPaths.createMatchPath( From c357c873d62d905a08ba789bc4ece3365050b2ac Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Wed, 1 May 2019 08:09:55 -0400 Subject: [PATCH 2/2] update readme to reflect name-only resolver config option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit again, didn't test this explicitly 😬 but it should work --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 143eb86..1a499cf 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,12 @@ Add the following to your `.eslintrc` config: "import/parsers": { "@typescript-eslint/parser": [".ts", ".tsx"] }, - "import/resolver": { - // use /tsconfig.json - "typescript": {}, - - // use /path/to/folder/tsconfig.json + + // use /tsconfig.json: + "import/resolver": "typescript", + + // use /path/to/folder/tsconfig.json: + "import/resolver: { "typescript": { "directory": "./path/to/folder" }