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

[feature] make context.getCwd() available in resolver #2108

Open
JounQin opened this issue May 29, 2021 · 7 comments · May be fixed by #2519
Open

[feature] make context.getCwd() available in resolver #2108

JounQin opened this issue May 29, 2021 · 7 comments · May be fixed by #2519

Comments

@JounQin
Copy link
Collaborator

JounQin commented May 29, 2021

context: import-js/eslint-import-resolver-typescript#74 (comment)

process.cwd() could be incorrect, context.getCwd() is the replacement.

@ljharb
Copy link
Member

ljharb commented May 31, 2021

When available, that seems like something we could provide, altho I'm not clear on when the value would be different than process.cwd() - since all commands in any repo should always only be run in the project root.

@JounQin
Copy link
Collaborator Author

JounQin commented Jun 1, 2021

It's about IDE/editor integration actually, it can be opened in parent/child folder, did you read through my linked issue? 🤣

@ljharb
Copy link
Member

ljharb commented Jun 1, 2021

I looked, but it’s long.

an IDE should also always be opened from the root of the repo.

Either way, it’d be fine to provide the proper value when available.

@AndyClausen
Copy link

I feel like these issues could easily be solved by adding a tsconfigRootDir setting like @typescript-eslint does. Or just by using the tsconfigs that @typescript-eslint specifies. Currently, we have to specify tsconfig locations twice 🙃

@JounQin
Copy link
Collaborator Author

JounQin commented Aug 4, 2022

I feel like these issues could easily be solved by adding a tsconfigRootDir setting like @typescript-eslint does. Or just by using the tsconfigs that @typescript-eslint specifies. Currently, we have to specify tsconfig locations twice 🙃

I proposed to adding new arguments into current resolver API without any breaking change at #2447 (comment)

@ljharb How do you think?

declare function resolve(
  source: string,
  file: string,
  config: object,
  options?: {
    parser: string;
    parserOption: object;
    context: object;
  }
): { found: Boolean; path: String? };

@ljharb
Copy link
Member

ljharb commented Aug 4, 2022

As long as that actually has no breaking change, that sounds great.

@JounQin
Copy link
Collaborator Author

JounQin commented Aug 4, 2022

As long as that actually has no breaking change, that sounds great.

OK, I'll raise a PR for it.

JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Aug 7, 2022
@JounQin JounQin linked a pull request Aug 7, 2022 that will close this issue
JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Aug 7, 2022
JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Aug 11, 2022
JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Aug 13, 2022
JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Sep 2, 2022
JounQin added a commit to JounQin/eslint-plugin-import that referenced this issue Sep 4, 2022
ljharb pushed a commit to JounQin/eslint-plugin-import that referenced this issue Apr 17, 2023
ljharb pushed a commit to JounQin/eslint-plugin-import that referenced this issue Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants