Skip to content

Commit 31e3592

Browse files
authored
docs: tiny improvements (#384)
1 parent a4a65dd commit 31e3592

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

README.md

+38-12
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ This means you can:
2525

2626
- [Notice](#notice)
2727
- [Installation](#installation)
28+
- [`eslint-plugin-import`](#eslint-plugin-import)
29+
- [`eslint-plugin-import-x`](#eslint-plugin-import-x)
2830
- [Configuration](#configuration)
29-
- [Options from `enhanced-resolve`](#options-from-enhanced-resolve)
31+
- [`eslint.config.js`](#eslintconfigjs)
32+
- [`.eslintrc`](#eslintrc)
33+
- [Options from `rspack-resolver`](#options-from-rspack-resolver)
3034
- [`conditionNames`](#conditionnames)
3135
- [`extensions`](#extensions)
3236
- [`extensionAlias`](#extensionalias)
@@ -47,6 +51,8 @@ If you're facing some problems on rules `import/default` or `import/named` from
4751

4852
## Installation
4953

54+
### `eslint-plugin-import`
55+
5056
```sh
5157
# npm
5258
npm i -D eslint-plugin-import eslint-import-resolver-typescript
@@ -58,7 +64,18 @@ pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
5864
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
5965
```
6066

61-
**Important when using `eslint-plugin-import-x` and `npm`**: Use `npm i -D eslint-plugin-import@eslint-plugin-import-x@latest eslint-import-resolver-typescript`, or you will end up with both `eslint-plugin-import` and `eslint-plugin-import-x` in your node_modules.
67+
### `eslint-plugin-import-x`
68+
69+
```sh
70+
# npm
71+
npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
72+
73+
# pnpm
74+
pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
75+
76+
# yarn
77+
yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
78+
```
6279

6380
## Configuration
6481

@@ -67,12 +84,10 @@ yarn add -D eslint-plugin-import eslint-import-resolver-typescript
6784
If 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:
6885

6986
```js
70-
// eslint.config.js
71-
const {
72-
createTypeScriptImportResolver,
73-
} = require('eslint-import-resolver-typescript')
87+
// eslint.config.js, CommonJS is also supported
88+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
7489

75-
module.exports = [
90+
export default [
7691
{
7792
settings: {
7893
'import-x/resolver-next': [
@@ -100,6 +115,9 @@ module.exports = [
100115
'packages/*/tsconfig.json',
101116
'other-packages/*/tsconfig.json',
102117
],
118+
119+
// use <root>/jsconfig.json
120+
project: 'jsconfig.json',
103121
}),
104122
],
105123
},
@@ -110,8 +128,8 @@ module.exports = [
110128
But if you are using `eslint-plugin-import` or the older version of `eslint-plugin-import-x`, you can't use require/import:
111129

112130
```js
113-
// eslint.config.js
114-
module.exports = [
131+
// eslint.config.js, CommonJS is also supported
132+
export default [
115133
{
116134
settings: {
117135
'import/resolver': {
@@ -139,6 +157,9 @@ module.exports = [
139157
'packages/*/tsconfig.json',
140158
'other-packages/*/tsconfig.json',
141159
],
160+
161+
// use <root>/jsconfig.json
162+
project: 'jsconfig.json',
142163
},
143164
},
144165
},
@@ -186,13 +207,16 @@ Add the following to your `.eslintrc` config:
186207
"packages/*/tsconfig.json",
187208
"other-packages/*/tsconfig.json",
188209
],
210+
211+
// use <root>/jsconfig.json
212+
"project": "jsconfig.json",
189213
},
190214
},
191215
},
192216
}
193217
```
194218

195-
## Options from [`enhanced-resolve`][]
219+
## Options from [`rspack-resolver`][]
196220

197221
### `conditionNames`
198222

@@ -276,7 +300,7 @@ Default:
276300

277301
### Other options
278302

279-
You can pass through other options of [`enhanced-resolve`][] directly
303+
You can pass through other options of [`rspack-resolver`][] directly
280304

281305
### Default options
282306

@@ -293,6 +317,8 @@ We have [GitHub Actions](https://github.com/import-js/eslint-import-resolver-typ
293317

294318
If either fails, we won't be able to merge your PR until it's fixed.
295319

320+
[![Sponsors](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)
321+
296322
## Sponsors
297323

298324
| 1stG | RxTS | UnTS |
@@ -315,6 +341,6 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
315341

316342
[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import
317343
[`eslint-plugin-import-x`]: https://github.com/un-ts/eslint-plugin-import-x
318-
[`enhanced-resolve`]: https://github.com/webpack/enhanced-resolve
344+
[`rspack-resolver`]: https://github.com/unrs/rspack-resolver
319345
[`typescript`]: https://www.typescriptlang.org
320346
[isc]: https://opensource.org/licenses/ISC

0 commit comments

Comments
 (0)