eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

Change Request: use env npm_execpath in alias init #18396

Open RodrigoDornelles opened 3 weeks ago

RodrigoDornelles commented 3 weeks ago

ESLint version

v8.56.0

What problem do you want to solve?

compatibility with other runtimes such as bun and deno.

What do you think is the correct solution?

in file bin/eslint.js

replace

const spawn = require("cross-spawn");

spawn.sync("npm", ["init", "@eslint/config"], { encoding: "utf8", stdio: "inherit" });

to

const spawn = require("cross-spawn");
const npm = process.env.npm_execpath || "npm";

spawn.sync(npm, ["init", "@eslint/config"], { encoding: "utf8", stdio: "inherit" });

Participation

Additional comments

I created a PR, but it was rejected because it needed an RFC as per the comment. https://github.com/eslint/eslint/pull/18178#issuecomment-2032740972

need create an RFC documenting it in the eslint/rfcs repository, after that maybe re-opening my contribution;

related: https://github.com/oven-sh/bun/issues/6728

nzakas commented 3 weeks ago

Happy have an RFC submitted for this. :+1: