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

detect does not consider NODE_PATH environment variable #2653

Closed
shanemcquillan opened this issue May 29, 2020 · 4 comments
Closed

detect does not consider NODE_PATH environment variable #2653

shanemcquillan opened this issue May 29, 2020 · 4 comments

Comments

@shanemcquillan
Copy link

detect assumes you're executing eslint from your project's root directory. It should also check if react is installed in a provided NODE_PATH

This appears to be the problematic line:

https://github.com/yannickcr/eslint-plugin-react/blob/2598b1ee64df6f1814a5084075da9cd45deb8b8f/lib/util/version.js#L19

@ljharb
Copy link
Member

ljharb commented May 29, 2020

I don't think it should; NODE_PATH is deprecated and discouraged and a very very bad idea to set and use (ESM will never support it, for example).

@shanemcquillan
Copy link
Author

It looks like it was decided against deprecating it - nodejs/node#1627

While use is generally discouraged there are some valid use cases for it, so I think it’s worth considering.

@ljharb
Copy link
Member

ljharb commented May 29, 2020

That it's not officially deprecated doesn't mean it's not widely discouraged. I'm not aware of any valid use cases for it; node modules you require should always be in the local node_modules folder.

@ljharb
Copy link
Member

ljharb commented Feb 19, 2022

Avoid using NODE_PATH; it's a bad practice.

@ljharb ljharb closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants