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

[eslint-import-resolver-node] allow ~/... #1454

Closed
TriMoon opened this issue Aug 17, 2019 · 3 comments
Closed

[eslint-import-resolver-node] allow ~/... #1454

TriMoon opened this issue Aug 17, 2019 · 3 comments

Comments

@TriMoon
Copy link

TriMoon commented Aug 17, 2019

Could you add the posibility to use ~ as a replacement for $HOME like in shells?
That way it would be possible to use:

settings:
  import/resolver:
    node:
      paths:
        - ~/node_modules

instead of hardcoding the real path to the user's home dir, which will be different for every user...

@ljharb
Copy link
Member

ljharb commented Aug 17, 2019

I have a few responses to this:

  1. you should never be requiring from anything but locally installed dependencies, ever. NODE_PATH is community-deprecated, and for good reason.
  2. An upcoming change to node's module resolution algorithm is going to provide a meaning for ~, which is "the package root" - so your request would conflict with it.
  3. ~ currently is not allowed in node's module resolution algorithm, so we wouldn't be able to support it by default anyways.

@TriMoon TriMoon closed this as completed Aug 18, 2019
@scottlaplante
Copy link

@ljharb Can you provide a link to information regarding this?

An upcoming change to node's module resolution algorithm is going to provide a meaning for ~, which is "the package root"

Thanks!

@ljharb
Copy link
Member

ljharb commented Nov 27, 2019

nodejs/modules#403 is one of the issue tracking it; it's currently not available in node, and may be ~ or @ or something entirely different.

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

3 participants