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

Change packageDir for import/no-unresolved rule #1246

Open
sdeleon28 opened this issue Dec 17, 2018 · 8 comments
Open

Change packageDir for import/no-unresolved rule #1246

sdeleon28 opened this issue Dec 17, 2018 · 8 comments

Comments

@sdeleon28
Copy link

It looks like I'm facing the same problems as described here #1061 but for the import/no-unresolved rule.

I'm using ALE (vim linter) and I'm getting false positives because eslint can't figure out where it should be running from. If I could set packageDir to __dirname (as it seems to be possible for `import/no-extraneous-dependencies), I think my problems would go away.

@ljharb
Copy link
Member

ljharb commented Dec 18, 2018

I believe you can/should configure ALE to always run from the project root - ie, where package.json is, and not just from "the dir containing the current file"?

@sdeleon28
Copy link
Author

You've already had this same exact conversation in #1061 but somehow reached a different conclusion on this one?

In the other issue you guys discuss how this is not only a problem with ALE but also with just plain terminal usage and other linters (SublimeLinter was brought up).

If I contributed a PR analogous to the one where it was fixed for import/no-extraneous-dependencies, would you accept it?

@ljharb
Copy link
Member

ljharb commented Jan 9, 2019

I'm a bit confused; all commands should only be run from the project root. Did i come to a different conclusion somewhere?

@sdeleon28
Copy link
Author

I meant that the packageDir option exists in the other rule but not this one. I think I referenced the wrong commit (thinking it had been added on that one). Was the packageDir option added because of this same problem or is there some other reason for it to exist in import/no-extraneous-dependencies and not in import/no-unresolved?

@ljharb
Copy link
Member

ljharb commented Jan 9, 2019

I believe packageDir was added for monorepos; not for "being able to run a command anywhere".

@sdeleon28
Copy link
Author

Would packageDir be desirable for import/no-unresolved by the same rationale, then?

@ljharb
Copy link
Member

ljharb commented Jan 10, 2019

It seems reasonable - although if it's going to be in more than one rule, is there a reason it shouldn't be in the plugin settings, so that all relevant rules can read from the same setting?

@AndyOGo
Copy link
Contributor

AndyOGo commented Aug 25, 2023

I'm already using packageDir option of import/no-extraneous-dependencies rule.

And now I'm in a situation where I would need that option for import/no-unresolved too.
My current workaround is to use it's ignore option.

I believe a setting would be great.

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