eslint-import-resolver-typescript icon indicating copy to clipboard operation
eslint-import-resolver-typescript copied to clipboard

fix: resolve modules if folder contains a package.json file

Open sanderson-ut opened this issue 3 years ago • 2 comments

getMappedPath resolves files by trying a number of different file extensions and filtering out those that aren't a file. This does not work when a TSConfig path alias resolves to a directory containing built assets, and described by a package.json, e.g. @foo/bar -> node_modules/foo/bar/dist.

If the tsconfig path is mapped to a folder that doesn't contain an index.${ext} file, then getMappedPath returns undefined as the folder itself is not a file. However, in some cases it is ok for this to resolve to the directory as the package.json contains a typings entry that references a .d.ts file, which is correctly handled by enhanced-resolve.

https://github.com/import-js/eslint-import-resolver-typescript/issues/188

sanderson-ut avatar Sep 28 '22 12:09 sanderson-ut

🦋 Changeset detected

Latest commit: 27b4ce89170485907e32a346dfebcc1b6f0bd214

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-import-resolver-typescript Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Sep 28 '22 12:09 changeset-bot[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Sep 28 '22 12:09 codesandbox-ci[bot]

@scott-ut Thanks for your contribution!

JounQin avatar Oct 20 '22 11:10 JounQin