eslint / config-inspector

A visual tool for inspecting and understanding your ESLint flat configs.
https://www.npmjs.com/package/@eslint/config-inspector
Apache License 2.0
734 stars 19 forks source link

Does Not Run with Bun #102

Closed Barzi-Ahmed closed 3 weeks ago

Barzi-Ahmed commented 1 month ago

Hi,

I use Bun for my project, and when I try to use "bun x eslint --inspect-config" or "bun x --bun eslint --inspect-config", it doesn't work and shows this error message:

$ eslint --inspect-config
You can also run this command directly using 'npx @eslint/config-inspector@latest' in the same directory as your configuration file.
'npx' is not recognized as an internal or external command,
operable program or batch file.

Please support Bun.

voxpelli commented 1 month ago

All the info you need is there in the message that’s printed?

As it say: eslint --inspect-config is simply a shortcut within eslint that runs npx @eslint/config-inspector

Since you’re on Bun the npx command fails. Do what the command recommends and do the Bun equivalent of npx @eslint/config-inspector directly instead of using the shortcut.

If you do want to file an issue about adding support for Bun in the shortcut, then you would have to file it towards the main ESLint project, not the config inspector.

Barzi-Ahmed commented 1 month ago

@voxpelli ,

I did exactly that now, I get this error:

C:\Users\Blackberry\Desktop\monorepo\packages\web>bun x @eslint/config-inspector
22 | for (const key of Reflect.ownKeys(fs.Dirent.prototype)) {
23 |     const name = key;
24 |     if (name === 'constructor') {
25 |         continue;
26 |     }
27 |     DirentFromStats.prototype[name] = function () {
                         ^
TypeError: Attempted to assign to readonly property.
      at C:\Users\Blackberry\AppData\Local\Temp\bunx-1157896195-@eslint\config-inspector@latest\node_modules\@nodelib\fs.scandir\out\utils\fs.js:27:21
      at C:\Users\Blackberry\AppData\Local\Temp\bunx-1157896195-@eslint\config-inspector@latest\node_modules\@nodelib\fs.scandir\out\utils\index.js:4:9
      at C:\Users\Blackberry\AppData\Local\Temp\bunx-1157896195-@eslint\config-inspector@latest\node_modules\@nodelib\fs.scandir\out\providers\async.js:6:7
      at C:\Users\Blackberry\AppData\Local\Temp\bunx-1157896195-@eslint\config-inspector@latest\node_modules\@nodelib\fs.scandir\out\scandir.js:5:7
      at C:\Users\Blackberry\AppData\Local\Temp\bunx-1157896195-@eslint\config-inspector@latest\node_modules\@nodelib\fs.scandir\out\index.js:4:5

Bun v1.1.33 (Windows x64)
Razunter commented 3 weeks ago

I get this error with all package managers in my project managed with bun, so not sure it's related.

This with npx:

/home/razunter/.npm/_npx/fadb285f08a830ab/node_modules/@nodelib/fs.scandir/out/utils/fs.js:27
    DirentFromStats.prototype[name] = function () {
                                    ^

TypeError: Cannot set property path of #<Dirent> which has only a getter
    at Object.<anonymous> (/home/razunter/.npm/_npx/fadb285f08a830ab/node_modules/@nodelib/fs.scandir/out/utils/fs.js:27:37)
    at Module._compile (node:internal/modules/cjs/loader:1568:14)
    at Object..js (node:internal/modules/cjs/loader:1711:10)
    at Module.load (node:internal/modules/cjs/loader:1328:32)
    at Function._load (node:internal/modules/cjs/loader:1138:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1350:12)
    at require (node:internal/modules/helpers:138:16)
    at Object.<anonymous> (/home/razunter/.npm/_npx/fadb285f08a830ab/node_modules/@nodelib/fs.scandir/out/utils/index.js:4:14)

Node.js v23.0.0
antfu commented 3 weeks ago

This looks like a bun bug to me. Bun should be responsible for bringing compatible with Node

Razunter commented 3 weeks ago

@antfu but it's not the Bun bug. I'm getting the same issue without Bun on Node v23. And it looks like it's the same without Node on Bun engine... And the same issue with Deno.

voxpelli commented 3 weeks ago

@Razunter @antfu Node 23, 22, 20 should all be tested in the CI but currently only latest LTS is. I suggest a PR to add the other versions to the text matrix