1212[ ![ Code Style: Prettier] ( https://img.shields.io/badge/code_style-prettier-ff69b4.svg )] ( https://github.com/prettier/prettier )
1313[ ![ changesets] ( https://img.shields.io/badge/maintained%20with-changesets-176de3.svg )] ( https://github.com/changesets/changesets )
1414
15- This 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. )
15+ This 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)
1616
1717This means you can:
1818
@@ -59,32 +59,32 @@ If you're facing some problems with rules `import/default` or `import/named` fro
5959### ` eslint-plugin-import-x `
6060
6161``` sh
62- # NPM
62+ # npm
6363npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
6464
65- # PNPM
65+ # pnpm
6666pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
6767
68- # Yarn
68+ # yarn
6969yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
7070
71- # Bun
71+ # bun
7272bun add -d eslint-plugin-import-x eslint-import-resolver-typescript
7373```
7474
7575### ` eslint-plugin-import `
7676
7777``` sh
78- # NPM
78+ # npm
7979npm i -D eslint-plugin-import eslint-import-resolver-typescript
8080
81- # PNPM
81+ # pnpm
8282pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
8383
84- # Yarn
84+ # yarn
8585yarn add -D eslint-plugin-import eslint-import-resolver-typescript
8686
87- # Bun
87+ # bun
8888bun add -d eslint-plugin-import eslint-import-resolver-typescript
8989```
9090
@@ -95,35 +95,35 @@ bun add -d eslint-plugin-import eslint-import-resolver-typescript
9595If 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:
9696
9797``` js
98- // eslint.config.js (CommonJS is also supported. )
98+ // eslint.config.js (CommonJS is also supported)
9999import { createTypeScriptImportResolver } from ' eslint-import-resolver-typescript'
100100
101101export default [
102102 {
103103 settings: {
104104 ' import-x/resolver-next' : [
105105 createTypeScriptImportResolver ({
106- alwaysTryTypes: true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`.
106+ alwaysTryTypes: true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`
107107
108- bun: true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun).
108+ bun: true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)
109109
110- // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default.
110+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
111111
112- // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json,
112+ // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
113113 project: ' path/to/folder' ,
114114
115115 // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
116116
117- // Use a glob pattern.
117+ // Use a glob pattern
118118 project: ' packages/*/{ts,js}config.json' ,
119119
120- // Use an array.
120+ // Use an array
121121 project: [
122122 ' packages/module-a/tsconfig.json' ,
123123 ' packages/module-b/jsconfig.json' ,
124124 ],
125125
126- // Use an array of glob patterns.
126+ // Use an array of glob patterns
127127 project: [
128128 ' packages/*/tsconfig.json' ,
129129 ' other-packages/*/jsconfig.json' ,
@@ -138,33 +138,33 @@ export default [
138138But if you are using ` eslint-plugin-import ` or the older version of ` eslint-plugin-import-x ` , you can't use ` require ` /` import ` :
139139
140140``` js
141- // eslint.config.js (CommonJS is also supported. )
141+ // eslint.config.js (CommonJS is also supported)
142142export default [
143143 {
144144 settings: {
145145 ' import/resolver' : {
146146 typescript: {
147- alwaysTryTypes: true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`.
147+ alwaysTryTypes: true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`
148148
149- bun: true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun).
149+ bun: true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)
150150
151- // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default.
151+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
152152
153- // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json,
153+ // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
154154 project: ' path/to/folder' ,
155155
156156 // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
157157
158- // Use a glob pattern,
158+ // Use a glob pattern
159159 project: ' packages/*/{ts,js}config.json' ,
160160
161- // Use an array,
161+ // Use an array
162162 project: [
163163 ' packages/module-a/tsconfig.json' ,
164164 ' packages/module-b/jsconfig.json' ,
165165 ],
166166
167- // Use an array of glob patterns,
167+ // Use an array of glob patterns
168168 project: [
169169 ' packages/*/tsconfig.json' ,
170170 ' other-packages/*/jsconfig.json' ,
@@ -184,7 +184,7 @@ Add the following to your `.eslintrc` config:
184184{
185185 " plugins" : [" import" ],
186186 " rules" : {
187- // Turn on errors for missing imports.
187+ // Turn on errors for missing imports
188188 " import/no-unresolved" : " error" ,
189189 },
190190 " settings" : {
@@ -193,21 +193,21 @@ Add the following to your `.eslintrc` config:
193193 },
194194 " import/resolver" : {
195195 " typescript" : {
196- " alwaysTryTypes" : true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`.
196+ " alwaysTryTypes" : true , // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist`
197197
198- " bun" : true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun).
198+ " bun" : true , // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun)
199199
200- // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default.
200+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
201201
202- // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json.
202+ // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
203203 " project" : " path/to/folder" ,
204204
205205 // Multiple tsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
206206
207- // Use a glob pattern.
207+ // Use a glob pattern
208208 " project" : " packages/*/{ts,js}config.json" ,
209209
210- // Use an array.
210+ // Use an array
211211 " project" : [
212212 " packages/module-a/tsconfig.json" ,
213213 " packages/module-b/jsconfig.json" ,
@@ -266,7 +266,7 @@ Default:
266266
267267``` jsonc
268268[
269- // `.mts`, `.cts`, `.d.mts`, `.d.cts`, `.mjs`, `.cjs` are not included because `.cjs` and `.mjs` must be used explicitly.
269+ // `.mts`, `.cts`, `.d.mts`, `.d.cts`, `.mjs`, `.cjs` are not included because `.cjs` and `.mjs` must be used explicitly
270270 " .ts" ,
271271 " .tsx" ,
272272 " .d.ts" ,
@@ -285,7 +285,7 @@ Default:
285285{
286286 " .js" : [
287287 " .ts" ,
288- // `.tsx` can also be compiled as `.js`.
288+ // `.tsx` can also be compiled as `.js`
289289 " .tsx" ,
290290 " .d.ts" ,
291291 " .js" ,
@@ -296,7 +296,7 @@ Default:
296296 " .tsx" ,
297297 " .d.ts" ,
298298 " .jsx" ,
299- // `.tsx` can also be compiled as `.js`.
299+ // `.tsx` can also be compiled as `.js`
300300 " .js" ,
301301 ],
302302 " .cjs" : [" .cts" , " .d.cts" , " .cjs" ],
0 commit comments