{"name":"eslint-import-resolver-typescript","version":"4.4.3","keywords":["typescript","eslint","import","resolver","plugin"],"author":{"name":"Alex Gorbatchev","email":"alex.gorbatchev@gmail.com"},"license":"ISC","_id":"eslint-import-resolver-typescript@4.4.3","maintainers":[{"name":"jounqin","email":"admin@1stg.me"},{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"},{"name":"bradzacher","email":"brad.zacher@gmail.com"}],"homepage":"https://github.com/import-js/eslint-import-resolver-typescript#readme","bugs":{"url":"https://github.com/import-js/eslint-import-resolver-typescript/issues"},"dist":{"shasum":"7fdd06f8fd7cdb05656980e3fe9d2c246365b2a2","tarball":"http://registry-npm.ywwl.com/eslint-import-resolver-typescript/download/eslint-import-resolver-typescript-4.4.3.tgz","fileCount":23,"integrity":"sha512-elVDn1eWKFrWlzxlWl9xMt8LltjKl161Ix50JFC50tHXI5/TRP32SNEqlJ/bo/HV+g7Rou/tlPQU2AcRtIhrOg==","signatures":[{"sig":"MEYCIQCVndM9NplxWZ43BVx3skgpaDBchSKH4ku92AM2JnAhoQIhAJ+23I7iEy+GVzakx8kKWzxxa87ECpMIRLzTapVB+QlR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/eslint-import-resolver-typescript@4.4.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59335,"size":14842,"noattachment":false,"key":"/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.3.tgz"},"main":"lib/index.cjs","type":"module","types":"lib/index.d.cts","module":"lib/index.js","engines":{"node":"^16.17.0 || >=18.6.0"},"exports":{".":{"import":{"types":"./lib/index.d.ts","default":"./lib/index.js"},"require":{"types":"./lib/index.d.cts","default":"./lib/index.cjs"}},"./package.json":"./package.json"},"funding":"https://opencollective.com/eslint-import-resolver-typescript","gitHead":"ff0445fab1f545fa1413503d2e854efb224e6f3f","_npmUser":{"name":"jounqin","email":"admin@1stg.me"},"repository":{"url":"git+https://github.com/import-js/eslint-import-resolver-typescript.git","type":"git"},"_npmVersion":"10.9.2","description":"This plugin adds `TypeScript` support to `eslint-plugin-import`","directories":{},"_nodeVersion":"22.15.0","dependencies":{"debug":"^4.4.1","tinyglobby":"^0.2.14","get-tsconfig":"^4.10.1","is-bun-module":"^2.0.0","stable-hash-x":"^0.1.1","unrs-resolver":"^1.7.11","eslint-import-context":"^0.1.8"},"_hasShrinkwrap":false,"peerDependencies":{"eslint":"*","eslint-plugin-import":"*","eslint-plugin-import-x":"*"},"peerDependenciesMeta":{"eslint-plugin-import":{"optional":true},"eslint-plugin-import-x":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/eslint-import-resolver-typescript_4.4.3_1749155868993_0.43762761397247507","host":"s3://npm-registry-packages-npm-production"},"readme":"# eslint-import-resolver-typescript\n\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/import-js/eslint-import-resolver-typescript/ci.yml?branch=master)](https://github.com/import-js/eslint-import-resolver-typescript/actions/workflows/ci.yml?query=branch%3Amaster)\n[![Codecov](https://img.shields.io/codecov/c/github/import-js/eslint-import-resolver-typescript.svg)](https://codecov.io/gh/import-js/eslint-import-resolver-typescript)\n[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fimport-js%2Feslint-import-resolver-typescript%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)\n[![npm](https://img.shields.io/npm/v/eslint-import-resolver-typescript.svg)](https://www.npmjs.com/package/eslint-import-resolver-typescript)\n[![GitHub Release](https://img.shields.io/github/release/import-js/eslint-import-resolver-typescript)](https://github.com/import-js/eslint-import-resolver-typescript/releases)\n\n[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/changesets/changesets)\n\nThis is a resolver for `eslint-plugin-import(-x)` plugin, not an ESLint plugin itself, it adds [`TypeScript`][] support to [`eslint-plugin-import`][]. (Or maybe you want to try [`eslint-plugin-import-x`][] for faster speed)\n\nThis means you can:\n\n- `import`/`require` files with extension `.cts`/`.mts`/`.ts`/`.tsx`/`.d.cts`/`.d.mts`/`.d.ts`\n- Use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) defined in `tsconfig.json`\n- Prefer resolving `@types/*` definitions over plain `.js`/`.jsx`\n- Multiple tsconfigs support, just like normal\n- `imports/exports` fields support in `package.json`\n\n## TOC <!-- omit in toc -->\n\n- [Notice](#notice)\n- [Installation](#installation)\n  - [`eslint-plugin-import-x`](#eslint-plugin-import-x)\n  - [`eslint-plugin-import`](#eslint-plugin-import)\n- [Configuration](#configuration)\n  - [`eslint.config.js`](#eslintconfigjs)\n  - [`.eslintrc`](#eslintrc)\n  - [Other environments](#other-environments)\n    - [Bun](#bun)\n- [Options from `unrs-resolver`](#options-from-unrs-resolver)\n  - [`conditionNames`](#conditionnames)\n  - [`extensions`](#extensions)\n  - [`extensionAlias`](#extensionalias)\n  - [`mainFields`](#mainfields)\n  - [Other options](#other-options)\n  - [Default options](#default-options)\n- [Contributing](#contributing)\n- [Sponsors and Backers](#sponsors-and-backers)\n  - [Sponsors](#sponsors)\n  - [Backers](#backers)\n- [Changelog](#changelog)\n- [License](#license)\n- [Star History](#star-history)\n\n## Notice\n\nAfter version 2.0.0, `.d.ts` will take higher priority than normal `.js`/`.jsx` files on resolving `node_modules` packages in favor of `@types/*` definitions or its own definition.\n\nIf you're facing some problems with rules `import/default` or `import/named` from [`eslint-plugin-import`][], do not post any issue here, because they are working exactly as [expected](https://github.com/import-js/eslint-import-resolver-typescript/issues/31#issuecomment-539751607) on our side. Take [import-js/eslint-plugin-import#1525](https://github.com/import-js/eslint-plugin-import/issues/1525) as reference or post a new issue on [`eslint-plugin-import`][] instead.\n\n## Installation\n\n### `eslint-plugin-import-x`\n\n```sh\n# npm\nnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript\n\n# pnpm\npnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript\n\n# yarn\nyarn add -D eslint-plugin-import-x eslint-import-resolver-typescript\n\n# bun\nbun add -d eslint-plugin-import-x eslint-import-resolver-typescript\n```\n\n### `eslint-plugin-import`\n\n```sh\n# npm\nnpm i -D eslint-plugin-import eslint-import-resolver-typescript\n\n# pnpm\npnpm i -D eslint-plugin-import eslint-import-resolver-typescript\n\n# yarn\nyarn add -D eslint-plugin-import eslint-import-resolver-typescript\n\n# bun\nbun add -d eslint-plugin-import eslint-import-resolver-typescript\n```\n\n## Configuration\n\n### `eslint.config.js`\n\nIf you are using `eslint-plugin-import-x@>=4.5.0`, you can use `import`/`require` to reference `eslint-import-resolver-typescript` directly in your ESLint flat config:\n\n```js\n// eslint.config.js (CommonJS is also supported)\nimport { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'\n\nexport default [\n  {\n    settings: {\n      'import-x/resolver-next': [\n        createTypeScriptImportResolver({\n          alwaysTryTypes: true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`\n\n          bun: true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)\n\n          // Choose from one of the \"project\" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default\n\n          // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json\n          project: 'path/to/folder',\n\n          // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)\n\n          // Use a glob pattern\n          project: 'packages/*/{ts,js}config.json',\n\n          // Use an array\n          project: [\n            'packages/module-a/tsconfig.json',\n            'packages/module-b/jsconfig.json',\n          ],\n\n          // Use an array of glob patterns\n          project: [\n            'packages/*/tsconfig.json',\n            'other-packages/*/jsconfig.json',\n          ],\n        }),\n      ],\n    },\n  },\n]\n```\n\nBut if you are using `eslint-plugin-import` or the older version of `eslint-plugin-import-x`, you can't use `require`/`import`:\n\n```js\n// eslint.config.js (CommonJS is also supported)\nexport default [\n  {\n    settings: {\n      'import/resolver': {\n        typescript: {\n          alwaysTryTypes: true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`\n\n          bun: true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)\n\n          // Choose from one of the \"project\" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default\n\n          // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json\n          project: 'path/to/folder',\n\n          // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)\n\n          // Use a glob pattern\n          project: 'packages/*/{ts,js}config.json',\n\n          // Use an array\n          project: [\n            'packages/module-a/tsconfig.json',\n            'packages/module-b/jsconfig.json',\n          ],\n\n          // Use an array of glob patterns\n          project: [\n            'packages/*/tsconfig.json',\n            'other-packages/*/jsconfig.json',\n          ],\n        },\n      },\n    },\n  },\n]\n```\n\n### `.eslintrc`\n\nAdd the following to your `.eslintrc` config:\n\n```jsonc\n{\n  \"plugins\": [\"import\"],\n  \"rules\": {\n    // Turn on errors for missing imports\n    \"import/no-unresolved\": \"error\",\n  },\n  \"settings\": {\n    \"import/parsers\": {\n      \"@typescript-eslint/parser\": [\".ts\", \".tsx\"],\n    },\n    \"import/resolver\": {\n      \"typescript\": {\n        \"alwaysTryTypes\": true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`\n\n        \"bun\": true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)\n\n        // Choose from one of the \"project\" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default\n\n        // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json\n        \"project\": \"path/to/folder\",\n\n        // Multiple tsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)\n\n        // Use a glob pattern\n        \"project\": \"packages/*/{ts,js}config.json\",\n\n        // Use an array\n        \"project\": [\n          \"packages/module-a/tsconfig.json\",\n          \"packages/module-b/jsconfig.json\",\n        ],\n\n        // Use an array of glob patterns\n        \"project\": [\n          \"packages/*/tsconfig.json\",\n          \"other-packages/*/jsconfig.json\",\n        ],\n      },\n    },\n  },\n}\n```\n\n### Other environments\n\n#### Bun\n\n[Bun](https://bun.sh/) provides built-in modules such as `bun:test`, which are not resolved by default.\n\nEnable Bun built-in module resolution by choosing 1 out of these 3 options:\n\n- Set the `bun: true` option, as shown in [Configuration](#configuration) above.\n- Run ESLint with `bun --bun eslint`.\n- [Configure `run.bun` in `bunfig.toml`](https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun).\n\n## Options from [`unrs-resolver`][]\n\n### `conditionNames`\n\nDefault:\n\n```jsonc\n[\n  \"types\",\n  \"import\",\n\n  // APF: https://angular.io/guide/angular-package-format\n  \"esm2020\",\n  \"es2020\",\n  \"es2015\",\n\n  \"require\",\n  \"node\",\n  \"node-addons\",\n  \"browser\",\n  \"default\",\n]\n```\n\n### `extensions`\n\nDefault:\n\n```jsonc\n[\n  // `.mts`, `.cts`, `.d.mts`, `.d.cts`, `.mjs`, `.cjs` are not included because `.cjs` and `.mjs` must be used explicitly\n  \".ts\",\n  \".tsx\",\n  \".d.ts\",\n  \".js\",\n  \".jsx\",\n  \".json\",\n  \".node\",\n]\n```\n\n### `extensionAlias`\n\nDefault:\n\n```jsonc\n{\n  \".js\": [\n    \".ts\",\n    // `.tsx` can also be compiled as `.js`\n    \".tsx\",\n    \".d.ts\",\n    \".js\",\n  ],\n  \".ts\": [\".ts\", \".d.ts\", \".js\"],\n  \".jsx\": [\".tsx\", \".d.ts\", \".jsx\"],\n  \".tsx\": [\n    \".tsx\",\n    \".d.ts\",\n    \".jsx\",\n    // `.tsx` can also be compiled as `.js`\n    \".js\",\n  ],\n  \".cjs\": [\".cts\", \".d.cts\", \".cjs\"],\n  \".cts\": [\".cts\", \".d.cts\", \".cjs\"],\n  \".mjs\": [\".mts\", \".d.mts\", \".mjs\"],\n  \".mts\": [\".mts\", \".d.mts\", \".mjs\"],\n}\n```\n\n### `mainFields`\n\nDefault:\n\n```jsonc\n[\n  \"types\",\n  \"typings\",\n\n  // APF: https://angular.io/guide/angular-package-format\n  \"fesm2020\",\n  \"fesm2015\",\n  \"esm2020\",\n  \"es2020\",\n\n  \"module\",\n  \"jsnext:main\",\n\n  \"main\",\n]\n```\n\n### Other options\n\nYou can pass through other options of [`unrs-resolver`][] directly.\n\n### Default options\n\nYou can reuse `defaultConditionNames`, `defaultExtensions`, `defaultExtensionAlias`, and `defaultMainFields` by directly using `require`/`import`.\n\n## Contributing\n\n- Make sure your change is covered by a test import.\n- Make sure that `yarn test` passes without a failure.\n- Make sure that `yarn lint` passes without conflicts.\n- Make sure your code changes match our [type-coverage](https://github.com/plantain-00/type-coverage) settings: `yarn type-coverage`.\n\nWe have [GitHub Actions](https://github.com/import-js/eslint-import-resolver-typescript/actions), which will run the above commands on your PRs.\n\nIf either fails, we won't be able to merge your PR until it's fixed.\n\n## Sponsors and Backers\n\n[![Sponsors and Backers](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)\n\n### Sponsors\n\n| 1stG                                                                                                                   | RxTS                                                                                                                   | UnTS                                                                                                                   |\n| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |\n\n### Backers\n\n| 1stG                                                                                                                | RxTS                                                                                                                | UnTS                                                                                                                |\n| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective backers](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |\n\n## Changelog\n\nDetailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).\n\n## License\n\n[ISC][]\n\n## Star History\n\n<a href=\"https://www.star-history.com/#import-js/eslint-import-resolver-typescript&Date\">\n <picture>\n   <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=import-js/eslint-import-resolver-typescript&type=Date&theme=dark\" />\n   <source media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=import-js/eslint-import-resolver-typescript&type=Date\" />\n   <img alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=import-js/eslint-import-resolver-typescript&type=Date\" />\n </picture>\n</a>\n\n[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import\n[`eslint-plugin-import-x`]: https://github.com/un-ts/eslint-plugin-import-x\n[`unrs-resolver`]: https://github.com/unrs/unrs-resolver\n[`typescript`]: https://www.typescriptlang.org\n[isc]: https://opensource.org/licenses/ISC\n","publish_time":1749155869208,"_cnpm_publish_time":1749155869208,"dist-tags":{"beta":"2.6.0-beta","latest":"4.4.5","next":"1.1.1","release-v3":"3.10.1"}}