mantoni / eslint_d.js

🪄 Speed up eslint to accelerate your development workflow
MIT License
1.12k stars 69 forks source link

Specify path to eslint #242

Open gbroques opened 1 year ago

gbroques commented 1 year ago

Hello, thank you for your work on this project!

From the README:

If eslint is found in the current working directories node_modules folder, then this version of eslint is going to be used. Otherwise, the version of eslint that ships with eslint_d is used as a fallback.

Is there a way to specify the path to where eslint can be found?

We have many repos, all with the same ESLint configuration and rules.

Thus, we have a centralized repo that contains node_modules/ with eslint and the custom rules.

Therefore, each project won't have a node_modules/ directory with eslint, and we don't want to fallback to the version of eslint that ships with eslint_d.

gbroques commented 1 year ago

I was able to get this to work by adding the path to that centralized repo's node_modules/.bin directory (containing eslint) to my PATH variable.

mantoni commented 1 year ago

Thanks for posting. Care to add a short note to the readme for others that might have the same question? 🙏

gbroques commented 1 year ago

Thanks for posting. Care to add a short note to the readme for others that might have the same question? 🙏

Sure, I'll re-open this for now, and see if I can submit a PR within the next week or so to close this.

I think it may be best if we note which takes higher precedence:

  1. eslint in the current working directory's node_modules folder
  2. or eslint in the PATH.

Does anyone happen to know by chance?

Based on this code, my guess is the current working directory's node_modules/ folder takes higher precedence.

If not, I can test to find out.

Thanks for the responsiveness @mantoni!

mantoni commented 3 months ago

With the release of v14.0.0, I'm not sure this still works. Can you check?

As an alternative, there is the new ESLINT_D_MISS environment variable. For this uses case, it could allow to specify an alternative path to eslint. Please let me know.