Skip to content
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

fix: ignore bun built-in modules #288

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/purple-planes-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-import-resolver-typescript': patch
---

fix: ignore bun built-in modules
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"eslint-module-utils": "^2.8.1",
"fast-glob": "^3.3.2",
"get-tsconfig": "^4.7.5",
"is-bun-module": "^1.0.2",
"is-glob": "^4.0.3"
},
"devDependencies": {
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { hashObject } from 'eslint-module-utils/hash.js'
import fg from 'fast-glob'
import { createPathsMatcher, getTsconfig } from 'get-tsconfig'
import type { TsConfigResult } from 'get-tsconfig'
import type { Version } from 'is-bun-module'
import { isBunModule } from 'is-bun-module'
import isGlob from 'is-glob'

const { globSync } = fg
Expand Down Expand Up @@ -168,8 +170,11 @@ export function resolve(

source = removeQuerystring(source)

// don't worry about core node modules
if (isBuiltin(source)) {
// don't worry about core node/bun modules
if (
isBuiltin(source) ||
isBunModule(source, (process.versions.bun ?? 'latest') as Version)
) {
log('matched core:', source)

return {
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6123,6 +6123,7 @@ __metadata:
eslint-plugin-import: "npm:eslint-plugin-i@^2.29.1"
fast-glob: "npm:^3.3.2"
get-tsconfig: "npm:^4.7.5"
is-bun-module: "npm:^1.0.2"
is-glob: "npm:^4.0.3"
lint-staged: "npm:^13.3.0"
npm-run-all2: "npm:^5.0.2"
Expand Down Expand Up @@ -7927,6 +7928,15 @@ __metadata:
languageName: node
linkType: hard

"is-bun-module@npm:^1.0.2":
version: 1.0.2
resolution: "is-bun-module@npm:1.0.2"
dependencies:
semver: "npm:^7.6.2"
checksum: be9685b33954c24f4bee648b21c58d8453842ff84bdffe0e2959e4e71b0861f81ef48fc9e1ed319faf57fd749bd2eed0718ab86f299e9a1ed987dda53890b691
languageName: node
linkType: hard

"is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7":
version: 1.2.7
resolution: "is-callable@npm:1.2.7"
Expand Down Expand Up @@ -12726,6 +12736,15 @@ __metadata:
languageName: node
linkType: hard

"semver@npm:^7.6.2":
version: 7.6.2
resolution: "semver@npm:7.6.2"
bin:
semver: bin/semver.js
checksum: 296b17d027f57a87ef645e9c725bff4865a38dfc9caf29b26aa084b85820972fbe7372caea1ba6857162fa990702c6d9c1d82297cecb72d56c78ab29070d2ca2
languageName: node
linkType: hard

"set-blocking@npm:^2.0.0":
version: 2.0.0
resolution: "set-blocking@npm:2.0.0"
Expand Down
Loading