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

feat: add support for jsconfig.json #161

Merged
merged 2 commits into from Aug 1, 2022
Merged

Conversation

rbong
Copy link
Contributor

@rbong rbong commented Aug 1, 2022

close #73

tl;dr - this handles the case of project: "path/to/jsconfig.json" without breaking project: "/path/to/dir".

Context: get-tsconfig behaviour

If a path other than tsconfig.json is used, getTsconfig requires that the first argument is a directory and the second argument is a path.

The second argument to getTsconfig must not be a directory, otherwise it will try to read it as a file, resulting in an error.

Current behaviour

The given project paths, or the resulting paths from globs, are passed as the first and only argument to getTsconfig.

Changes

In the case that the given project path is a file, or a glob results in a file, its parent directory will be passed as the first argument to getTsconfig and its base name will be the second argument.
This fixes passing full filenames other than tsconfig.json, ex. jsconfig.json.

In the case that a given project path is a directory, or a glob results in a directory, the full path will be passed as the first and only argument to getTsconfig.
This distinction is necessary, since if the base name of a directory is passed as the second argument it will result in an error.

@changeset-bot
Copy link

changeset-bot bot commented Aug 1, 2022

🦋 Changeset detected

Latest commit: 3678a1b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-import-resolver-typescript Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 1, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@rbong
Copy link
Contributor Author

rbong commented Aug 1, 2022

My mistake - didn't check coverage. Adding another test case now.

@JounQin
Copy link
Collaborator

JounQin commented Aug 1, 2022

It seems you didn't follow own commit message lint at the same time.

See also https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional

@rbong
Copy link
Contributor Author

rbong commented Aug 1, 2022

@JounQin thanks, I was having some issues with my editor so it didn't run. Checks are passing now.

JounQin
JounQin approved these changes Aug 1, 2022
@JounQin JounQin changed the title Add support for jsconfig.json (#73) feat: add support for jsconfig.json Aug 1, 2022
@JounQin JounQin merged commit 82d090b into import-js:master Aug 1, 2022
6 checks passed
@JounQin
Copy link
Collaborator

JounQin commented Aug 1, 2022

@rbong Thanks for your contribution!

@JounQin
Copy link
Collaborator

JounQin commented Aug 1, 2022

It seems I/we forgot to update README to mention this. 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support for jsconfig.json
2 participants