-
-
Notifications
You must be signed in to change notification settings - Fork 70
fix: always sort projects by affinity before iterating #459
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
Conversation
🦋 Changeset detectedLatest commit: d3e5916 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
WalkthroughThe pull request updates the resolver logic to sort TypeScript projects by affinity before iteration, attempts resolution before caching the resolver, and adjusts fallback resolution accordingly. It also adds a Codecov badge to the README and introduces a changeset documenting these patch updates. Changes
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
yarn install v1.22.22 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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. |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to d82e908 in 1 minute and 33 seconds. Click for details.
- Reviewed
50
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
3
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/ready-mirrors-sneeze.md:5
- Draft comment:
Changeset message looks good; it reflects the sorting fix. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. src/index.ts:100
- Draft comment:
The removed block that parses tsconfig and creates a new ResolverFactory has been omitted. Without this, if no cached resolver is found, no resolver is created, which may break resolution for new tsconfig files. - Reason this comment was not posted:
Comment was on unchanged code.
3. src/index.ts:142
- Draft comment:
The fallback recursion that attempted resolution with sorted projects has been removed. This may lead to missing valid resolution paths when no cached resolver exists. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =30%
<= threshold50%
The comment is informative and suggests a potential issue with the removal of a feature. However, it does not provide a specific suggestion or ask for confirmation of intent. It implies a potential problem but does not directly address the PR author with a specific action or question.
Workflow ID: wflow_yakE3ODVzcYW09uV
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
@carlocorradini Did you try to disable the snapshot serializer for testing locally? |
@JounQin |
Thanks for the clarification, I'll try to fix the test cases then. |
![]() @carlocorradini I'm still getting this issue even if I disabled the snapshot serializer. You need to run ![]() I don't see any difference between the original and sorted tsconfigs. ![]() |
…les, include, exclude
@JounQin Awesome! What/where was the issue(s)? |
See my commit message |
| datasource | package | from | to | | ---------- | --------------------------------- | ----- | ----- | | npm | eslint-import-resolver-typescript | 4.3.4 | 4.4.2 | ## [v4.4.2](https://github.com/import-js/eslint-import-resolver-typescript/blob/HEAD/CHANGELOG.md#442) ##### Patch Changes - [#459](import-js/eslint-import-resolver-typescript#459) [`f16150b`](import-js/eslint-import-resolver-typescript@f16150b) Thanks [@carlocorradini](https://github.com/carlocorradini)! - fix: always sort projects by affinity before iterating ## [v4.4.1](https://github.com/import-js/eslint-import-resolver-typescript/blob/HEAD/CHANGELOG.md#441) ##### Patch Changes - [#457](import-js/eslint-import-resolver-typescript#457) [`d9f3e68`](import-js/eslint-import-resolver-typescript@d9f3e68) Thanks [@JounQin](https://github.com/JounQin)! - fix(deps): bump `eslint-import-context` to v0.1.5 ## [v4.4.0](https://github.com/import-js/eslint-import-resolver-typescript/blob/HEAD/CHANGELOG.md#440) ##### Minor Changes - [#453](import-js/eslint-import-resolver-typescript#453) [`7d87517`](import-js/eslint-import-resolver-typescript@7d87517) Thanks [@JounQin](https://github.com/JounQin)! - feat: integrate `eslint-import-context` to get correct `context.cwd` ## [v4.3.5](https://github.com/import-js/eslint-import-resolver-typescript/blob/HEAD/CHANGELOG.md#435) ##### Patch Changes - [#450](import-js/eslint-import-resolver-typescript#450) [`3f1aab1`](import-js/eslint-import-resolver-typescript@3f1aab1) Thanks [@JounQin](https://github.com/JounQin)! - fix: remove buggy `module-sync` exports field
Fix #393
It is necessary to always sort
projects
by affinity before iterating.This correctly resolves the current file to the nearest and correct
tsconfig.json
file, even if there are several mappings with the same prefix in differenttsconfig.json
files.The _e2e_ test `nearestTsconfig` fails because the function `matcherCached` always returns `undefined`, indicating that the file could not be resolved. I believe the latter is due to _vitest_'s snapshot serializer, which replaces the absolute path of the root with the alias ``, and this is not handled correctly by `get-tsconfig`. I'll let you deal with this minor issue because I'm not sure whether it's necessary or how to fix it properly.Important
Fixes issue #393 by sorting projects by affinity in
resolve()
to ensure correcttsconfig.json
resolution.import/no-unresolved
on NX monorepos on4.x
#393 by sortingprojects
by affinity before iterating inresolve()
inindex.ts
.tsconfig.json
resolution when multiple mappings with the same prefix exist.nearestTsconfig
e2e test fails due to path aliasing issue in vitest's snapshot serializer, unrelated to this fix.This description was created by
for d82e908. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
Bug Fixes
Chores