From f9ad3b0c583c931a646f146d1a7d6a35c8a34177 Mon Sep 17 00:00:00 2001 From: JounQin Date: Sat, 31 May 2025 00:29:29 +0800 Subject: [PATCH 1/3] docs: add `Star History` section --- .github/workflows/pkg-pr-new.yml | 1 + README.md | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index bf184a3..ee2cdc1 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -1,4 +1,5 @@ name: Publish Any Commit + on: - push - pull_request diff --git a/README.md b/README.md index 5d1a96e..c7bd7e5 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ This means you can: - [Backers](#backers) - [Changelog](#changelog) - [License](#license) +- [Star History](#star-history) ## Notice @@ -363,6 +364,16 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m [ISC][] +## Star History + + + + + + Star History Chart + + + [`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import [`eslint-plugin-import-x`]: https://github.com/un-ts/eslint-plugin-import-x [`unrs-resolver`]: https://github.com/unrs/unrs-resolver From f16150b5e10ec24a3f1f107d6322816338c50dc8 Mon Sep 17 00:00:00 2001 From: Carlo Corradini Date: Sat, 31 May 2025 01:01:07 +0200 Subject: [PATCH 2/3] fix: always sort projects by affinity before iterating (#459) Co-authored-by: JounQin --- .changeset/ready-mirrors-sneeze.md | 5 +++++ README.md | 1 + src/index.ts | 27 +++++++++++++-------------- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 .changeset/ready-mirrors-sneeze.md diff --git a/.changeset/ready-mirrors-sneeze.md b/.changeset/ready-mirrors-sneeze.md new file mode 100644 index 0000000..3836acf --- /dev/null +++ b/.changeset/ready-mirrors-sneeze.md @@ -0,0 +1,5 @@ +--- +"eslint-import-resolver-typescript": patch +--- + +fix: always sort projects by affinity before iterating diff --git a/README.md b/README.md index c7bd7e5..4405eee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # eslint-import-resolver-typescript [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/import-js/eslint-import-resolver-typescript/ci.yml?branch=master)](https://github.com/import-js/eslint-import-resolver-typescript/actions/workflows/ci.yml?query=branch%3Amaster) +[![Codecov](https://img.shields.io/codecov/c/github/import-js/eslint-import-resolver-typescript.svg)](https://codecov.io/gh/import-js/eslint-import-resolver-typescript) [![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fimport-js%2Feslint-import-resolver-typescript%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage) [![npm](https://img.shields.io/npm/v/eslint-import-resolver-typescript.svg)](https://www.npmjs.com/package/eslint-import-resolver-typescript) [![GitHub Release](https://img.shields.io/github/release/import-js/eslint-import-resolver-typescript)](https://github.com/import-js/eslint-import-resolver-typescript/releases) diff --git a/src/index.ts b/src/index.ts index 60db5ec..fb16fb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -95,9 +95,9 @@ export const resolve = ( // eslint-disable-next-line sonarjs/label-position, sonarjs/no-labels createResolver: if (!resolver) { - // must be a array with 2+ items here already ensured by `normalizeOptions` - const project = options.project as string[] - for (const tsconfigPath of project) { + // must be an array with 2+ items here already ensured by `normalizeOptions` + const projects = sortProjectsByAffinity(options.project as string[], file) + for (const tsconfigPath of projects) { const resolverCached = resolverCache.get(tsconfigPath) if (resolverCached) { resolver = resolverCached @@ -135,24 +135,23 @@ export const resolve = ( }, } resolver = new ResolverFactory(options) - resolverCache.set(tsconfigPath, resolver) - break createResolver + const resolved = resolve(source, file, options, resolver) + if (resolved.found) { + resolverCache.set(tsconfigPath, resolver) + return resolved + } } log( 'no tsconfig matched', file, 'with', - ...project, - ', trying from the the nearest one', + ...projects, + ', trying from the the nearest one instead', ) - for (const p of sortProjectsByAffinity(project, file)) { - const resolved = resolve( - source, - file, - { ...options, project: p }, - resolver, - ) + + for (const project of projects) { + const resolved = resolve(source, file, { ...options, project }, resolver) if (resolved.found) { return resolved } From 5db36e7ff0ffa1209579b16288e7b69739f6361a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 07:07:39 +0800 Subject: [PATCH 3/3] chore: release eslint-import-resolver-typescript (#460) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/ready-mirrors-sneeze.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/ready-mirrors-sneeze.md diff --git a/.changeset/ready-mirrors-sneeze.md b/.changeset/ready-mirrors-sneeze.md deleted file mode 100644 index 3836acf..0000000 --- a/.changeset/ready-mirrors-sneeze.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"eslint-import-resolver-typescript": patch ---- - -fix: always sort projects by affinity before iterating diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d2425..d2a5362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 4.4.2 + +### Patch Changes + +- [#459](https://github.com/import-js/eslint-import-resolver-typescript/pull/459) [`f16150b`](https://github.com/import-js/eslint-import-resolver-typescript/commit/f16150b5e10ec24a3f1f107d6322816338c50dc8) Thanks [@carlocorradini](https://github.com/carlocorradini)! - fix: always sort projects by affinity before iterating + ## 4.4.1 ### Patch Changes diff --git a/package.json b/package.json index 33c94bf..0c2683c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-import-resolver-typescript", - "version": "4.4.1", + "version": "4.4.2", "type": "module", "description": "This plugin adds `TypeScript` support to `eslint-plugin-import`", "repository": "https://github.com/import-js/eslint-import-resolver-typescript",