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

bun:jsc being flagged as required node:protocol #2226

Closed
noahehall opened this issue Dec 1, 2023 · 3 comments · Fixed by #2272
Closed

bun:jsc being flagged as required node:protocol #2226

noahehall opened this issue Dec 1, 2023 · 3 comments · Fixed by #2272

Comments

@noahehall
Copy link

noahehall commented Dec 1, 2023

same as this: #1931

jsc = await import('bun:jsc')
// is converted to this
jsc = await import('node:bun:jsc')
const code = 'that should be ok';
@fisker
Copy link
Collaborator

fisker commented Dec 2, 2023

same as this: #1931

Apparently, it's not.

@fisker
Copy link
Collaborator

fisker commented Dec 4, 2023

I can't find any mention of bun: protocol on https://bun.sh/, is it a builtin protocol?

@mangs
Copy link

mangs commented Jan 20, 2024

@fisker I get this same error with bun:test too (Bun's test runner); it expects node:bun:test which doesn't make any sense.

I'm not really sure bun: is a protocol, rather it's kind of a namespace, kind of not. For example, here are many of Bun's native APIs: https://bun.sh/docs/runtime/bun-apis

Let's use the Glob API as an example. As you can see, it's written as Bun.Glob implying that it only exists as a member of the Bun global variable. However, if you click into the details of the Glob API (https://bun.sh/docs/api/glob), you can see it can also be used as an import: import { Glob } from "bun";. In other words, accessing APIs via imports or via the global Bun variable are interchangeable. Jarred Sumner (Bun's creator) has stated this as fact a few times in the past. So this ESLint plugin should not be treating bun, bun:test, bun:jsc, or any other Bun imports as being Node.js imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants