Skip to content

Commit 6b183ff

Browse files
authored
chore: migrate to rebranding unrs-resolver with new targets supported (#407)
1 parent 5cfcf4c commit 6b183ff

9 files changed

+1272
-1948
lines changed

.changeset/spicy-stingrays-remain.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"eslint-import-resolver-typescript": patch
3+
---
4+
5+
chore: migrate to rebranding `unrs-resolver` with new targets supported:
6+
7+
- `i686-pc-windows-msvc`
8+
- `armv7-unknown-linux-musleabihf`
9+
- `powerpc64le-unknown-linux-gnu`
10+
- `s390x-unknown-linux-gnu`

.simple-git-hooks.cjs

-1
This file was deleted.

.simple-git-hooks.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@1stg/simple-git-hooks'

README.md

+31-40
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ This means you can:
2525

2626
- [Notice](#notice)
2727
- [Installation](#installation)
28-
- [`eslint-plugin-import`](#eslint-plugin-import)
2928
- [`eslint-plugin-import-x`](#eslint-plugin-import-x)
29+
- [`eslint-plugin-import`](#eslint-plugin-import)
3030
- [Configuration](#configuration)
3131
- [`eslint.config.js`](#eslintconfigjs)
3232
- [`.eslintrc`](#eslintrc)
3333
- [Other environments](#other-environments)
3434
- [Bun](#bun)
35-
- [Options from `rspack-resolver`](#options-from-rspack-resolver)
35+
- [Options from `unrs-resolver`](#options-from-unrs-resolver)
3636
- [`conditionNames`](#conditionnames)
3737
- [`extensions`](#extensions)
3838
- [`extensionAlias`](#extensionalias)
@@ -53,30 +53,30 @@ If you're facing some problems on rules `import/default` or `import/named` from
5353

5454
## Installation
5555

56-
### `eslint-plugin-import`
56+
### `eslint-plugin-import-x`
5757

5858
```sh
5959
# npm
60-
npm i -D eslint-plugin-import eslint-import-resolver-typescript
60+
npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
6161

6262
# pnpm
63-
pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
63+
pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
6464

6565
# yarn
66-
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
66+
yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
6767
```
6868

69-
### `eslint-plugin-import-x`
69+
### `eslint-plugin-import`
7070

7171
```sh
7272
# npm
73-
npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
73+
npm i -D eslint-plugin-import eslint-import-resolver-typescript
7474

7575
# pnpm
76-
pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
76+
pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
7777

7878
# yarn
79-
yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
79+
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
8080
```
8181

8282
## Configuration
@@ -98,30 +98,27 @@ export default [
9898

9999
bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
100100

101-
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
101+
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
102102

103-
// use <root>/path/to/folder/tsconfig.json
103+
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
104104
project: 'path/to/folder',
105105

106-
// Multiple tsconfigs (Useful for monorepos)
106+
// Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
107107

108108
// use a glob pattern
109-
project: 'packages/*/tsconfig.json',
109+
project: 'packages/*/{ts,js}config.json',
110110

111111
// use an array
112112
project: [
113113
'packages/module-a/tsconfig.json',
114-
'packages/module-b/tsconfig.json',
114+
'packages/module-b/jsconfig.json',
115115
],
116116

117117
// use an array of glob patterns
118118
project: [
119119
'packages/*/tsconfig.json',
120-
'other-packages/*/tsconfig.json',
120+
'other-packages/*/jsconfig.json',
121121
],
122-
123-
// use <root>/jsconfig.json
124-
project: 'jsconfig.json',
125122
}),
126123
],
127124
},
@@ -142,30 +139,27 @@ export default [
142139

143140
bun: true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
144141

145-
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
142+
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
146143

147-
// use <root>/path/to/folder/tsconfig.json
144+
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
148145
project: 'path/to/folder',
149146

150-
// Multiple tsconfigs (Useful for monorepos)
147+
// Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
151148

152149
// use a glob pattern
153-
project: 'packages/*/tsconfig.json',
150+
project: 'packages/*/{ts,js}config.json',
154151

155152
// use an array
156153
project: [
157154
'packages/module-a/tsconfig.json',
158-
'packages/module-b/tsconfig.json',
155+
'packages/module-b/jsconfig.json',
159156
],
160157

161158
// use an array of glob patterns
162159
project: [
163160
'packages/*/tsconfig.json',
164-
'other-packages/*/tsconfig.json',
161+
'other-packages/*/jsconfig.json',
165162
],
166-
167-
// use <root>/jsconfig.json
168-
project: 'jsconfig.json',
169163
},
170164
},
171165
},
@@ -194,30 +188,27 @@ Add the following to your `.eslintrc` config:
194188

195189
"bun": true, // resolve Bun modules https://github.com/import-js/eslint-import-resolver-typescript#bun
196190

197-
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
191+
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default
198192

199-
// use <root>/path/to/folder/tsconfig.json
193+
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
200194
"project": "path/to/folder",
201195

202-
// Multiple tsconfigs (Useful for monorepos)
196+
// Multiple tsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)
203197

204198
// use a glob pattern
205-
"project": "packages/*/tsconfig.json",
199+
"project": "packages/*/{ts,js}config.json",
206200

207201
// use an array
208202
"project": [
209203
"packages/module-a/tsconfig.json",
210-
"packages/module-b/tsconfig.json",
204+
"packages/module-b/jsconfig.json",
211205
],
212206

213207
// use an array of glob patterns
214208
"project": [
215209
"packages/*/tsconfig.json",
216-
"other-packages/*/tsconfig.json",
210+
"other-packages/*/jsconfig.json",
217211
],
218-
219-
// use <root>/jsconfig.json
220-
"project": "jsconfig.json",
221212
},
222213
},
223214
},
@@ -236,7 +227,7 @@ Enable Bun built-in module resolution by choosing 1 out of these 3 options:
236227
- Run ESLint with `bun --bun eslint`
237228
- [Configure `run.bun` in `bunfig.toml`](https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun)
238229

239-
## Options from [`rspack-resolver`][]
230+
## Options from [`unrs-resolver`][]
240231

241232
### `conditionNames`
242233

@@ -320,7 +311,7 @@ Default:
320311

321312
### Other options
322313

323-
You can pass through other options of [`rspack-resolver`][] directly
314+
You can pass through other options of [`unrs-resolver`][] directly
324315

325316
### Default options
326317

@@ -361,6 +352,6 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
361352

362353
[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import
363354
[`eslint-plugin-import-x`]: https://github.com/un-ts/eslint-plugin-import-x
364-
[`rspack-resolver`]: https://github.com/unrs/rspack-resolver
355+
[`unrs-resolver`]: https://github.com/unrs/unrs-resolver
365356
[`typescript`]: https://www.typescriptlang.org
366357
[isc]: https://opensource.org/licenses/ISC

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "4.2.3",
44
"type": "module",
55
"description": "This plugin adds `TypeScript` support to `eslint-plugin-import`",
6-
"repository": "git+https://github.com/import-js/eslint-import-resolver-typescript",
6+
"repository": "https://github.com/import-js/eslint-import-resolver-typescript",
77
"author": "Alex Gorbatchev <[email protected]>",
88
"contributors": [
9-
"JounQin (https://www.1stG.me) <[email protected]>"
9+
"JounQin <[email protected]> (https://www.1stG.me)"
1010
],
1111
"funding": "https://opencollective.com/unts/projects/eslint-import-resolver-ts",
1212
"license": "ISC",
@@ -80,34 +80,34 @@
8080
"debug": "^4.4.0",
8181
"get-tsconfig": "^4.10.0",
8282
"is-bun-module": "^2.0.0",
83-
"rspack-resolver": "^1.2.2",
8483
"stable-hash": "^0.0.5",
85-
"tinyglobby": "^0.2.12"
84+
"tinyglobby": "^0.2.12",
85+
"unrs-resolver": "^1.3.1"
8686
},
8787
"devDependencies": {
88-
"@1stg/lib-config": "^13.0.1",
88+
"@1stg/common-config": "^11.1.0",
8989
"@changesets/changelog-github": "^0.5.1",
9090
"@changesets/cli": "^2.28.1",
9191
"@commitlint/cli": "^19.8.0",
9292
"@mozilla/glean": "^5.0.3",
93-
"@pkgr/rollup": "^6.0.0",
93+
"@pkgr/rollup": "^6.0.1",
9494
"@total-typescript/ts-reset": "^0.6.1",
9595
"@types/debug": "^4.1.12",
96-
"@types/node": "^22.13.10",
96+
"@types/node": "^22.13.13",
9797
"@types/pnpapi": "^0.0.5",
9898
"@types/unist": "^3.0.3",
9999
"@vitest/coverage-v8": "3.0.9",
100100
"clean-pkg-json": "^1.2.1",
101101
"dummy.js": "link:dummy.js",
102-
"eslint": "^9.22.0",
102+
"eslint": "^9.23.0",
103103
"eslint-import-resolver-typescript": "link:.",
104-
"eslint-plugin-import-x": "^4.9.0",
104+
"eslint-plugin-import-x": "^4.9.2",
105105
"lint-staged": "^15.5.0",
106106
"npm-run-all2": "^7.0.2",
107107
"path-serializer": "^0.3.4",
108108
"prettier": "^3.5.3",
109109
"react": "^19.0.0",
110-
"simple-git-hooks": "^2.11.1",
110+
"simple-git-hooks": "^2.12.1",
111111
"size-limit": "^11.2.0",
112112
"size-limit-preset-node-lib": "^0.3.0",
113113
"tinyexec": "^1.0.0",

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
parseTsconfig,
1010
} from 'get-tsconfig'
1111
import { isBunBuiltin } from 'is-bun-module'
12-
import { ResolverFactory } from 'rspack-resolver'
1312
import { stableHash } from 'stable-hash'
13+
import { ResolverFactory } from 'unrs-resolver'
1414

1515
import { IMPORT_RESOLVER_NAME, JS_EXT_PATTERN } from './constants.js'
1616
import {
@@ -65,7 +65,7 @@ export const resolve = (
6565
options ||= {}
6666

6767
// don't worry about node/bun core modules
68-
if ((isBun || options.bun) ? isBunBuiltin(source) : isBuiltin(source)) {
68+
if (isBun || options.bun ? isBunBuiltin(source) : isBuiltin(source)) {
6969
log('matched core:', source)
7070
return { found: true, path: null }
7171
}

src/normalize-options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { TsconfigOptions } from 'rspack-resolver'
21
import { globSync, isDynamicPattern } from 'tinyglobby'
2+
import type { TsconfigOptions } from 'unrs-resolver'
33

44
import {
55
DEFAULT_CONFIGS,

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { NapiResolveOptions } from 'rspack-resolver'
1+
import type { NapiResolveOptions } from 'unrs-resolver'
22

33
export interface TypeScriptResolverOptions extends NapiResolveOptions {
44
project?: string[] | string

0 commit comments

Comments
 (0)