Skip to content

Commit 5cfcf4c

Browse files
authored
docs: document usage with Bun (#404)
1 parent 72b2fbe commit 5cfcf4c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: README.md

+20
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ This means you can:
3030
- [Configuration](#configuration)
3131
- [`eslint.config.js`](#eslintconfigjs)
3232
- [`.eslintrc`](#eslintrc)
33+
- [Other environments](#other-environments)
34+
- [Bun](#bun)
3335
- [Options from `rspack-resolver`](#options-from-rspack-resolver)
3436
- [`conditionNames`](#conditionnames)
3537
- [`extensions`](#extensions)
@@ -94,6 +96,8 @@ export default [
9496
createTypeScriptImportResolver({
9597
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
9698

99+
bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
100+
97101
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
98102

99103
// use <root>/path/to/folder/tsconfig.json
@@ -136,6 +140,8 @@ export default [
136140
typescript: {
137141
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
138142

143+
bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
144+
139145
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
140146

141147
// use <root>/path/to/folder/tsconfig.json
@@ -186,6 +192,8 @@ Add the following to your `.eslintrc` config:
186192
"typescript": {
187193
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
188194

195+
"bun": true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
196+
189197
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
190198

191199
// use <root>/path/to/folder/tsconfig.json
@@ -216,6 +224,18 @@ Add the following to your `.eslintrc` config:
216224
}
217225
```
218226

227+
### Other environments
228+
229+
#### Bun
230+
231+
[Bun](https://bun.sh/) provides built-in modules such as `bun:test`, which are not resolved by default.
232+
233+
Enable Bun built-in module resolution by choosing 1 out of these 3 options:
234+
235+
- Set the `bun: true` option, as shown in [Configuration](#configuration) above
236+
- Run ESLint with `bun --bun eslint`
237+
- [Configure `run.bun` in `bunfig.toml`](https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun)
238+
219239
## Options from [`rspack-resolver`][]
220240

221241
### `conditionNames`

0 commit comments

Comments
 (0)