Skip to content

Document usage with Bun #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ This means you can:
- [Configuration](#configuration)
- [`eslint.config.js`](#eslintconfigjs)
- [`.eslintrc`](#eslintrc)
- [Other environments](#other-environments)
- [Bun](#bun)
- [Options from `rspack-resolver`](#options-from-rspack-resolver)
- [`conditionNames`](#conditionnames)
- [`extensions`](#extensions)
Expand Down Expand Up @@ -94,6 +96,8 @@ export default [
createTypeScriptImportResolver({
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`

bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun

// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default

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

bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun

// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default

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

"bun": true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun

// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default

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

### Other environments

#### Bun

[Bun](https://bun.sh/) provides built-in modules such as `bun:test`, which are not resolved by default.

Enable Bun built-in module resolution by choosing 1 out of these 3 options:

- Set the `bun: true` option, as shown in [Configuration](#configuration) above
- Run ESLint with `bun --bun eslint`
- [Configure `run.bun` in `bunfig.toml`](https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun)

## Options from [`rspack-resolver`][]

### `conditionNames`
Expand Down