Skip to content

chore: migrate to rebranding unrs-resolver with new targets supported #407

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

Merged
merged 3 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/spicy-stingrays-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"eslint-import-resolver-typescript": patch
---

chore: migrate to rebranding `unrs-resolver` with new targets supported:

- `i686-pc-windows-msvc`
- `armv7-unknown-linux-musleabihf`
- `powerpc64le-unknown-linux-gnu`
- `s390x-unknown-linux-gnu`
1 change: 0 additions & 1 deletion .simple-git-hooks.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .simple-git-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@1stg/simple-git-hooks'
71 changes: 31 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ This means you can:

- [Notice](#notice)
- [Installation](#installation)
- [`eslint-plugin-import`](#eslint-plugin-import)
- [`eslint-plugin-import-x`](#eslint-plugin-import-x)
- [`eslint-plugin-import`](#eslint-plugin-import)
- [Configuration](#configuration)
- [`eslint.config.js`](#eslintconfigjs)
- [`.eslintrc`](#eslintrc)
- [Other environments](#other-environments)
- [Bun](#bun)
- [Options from `rspack-resolver`](#options-from-rspack-resolver)
- [Options from `unrs-resolver`](#options-from-unrs-resolver)
- [`conditionNames`](#conditionnames)
- [`extensions`](#extensions)
- [`extensionAlias`](#extensionalias)
Expand All @@ -53,30 +53,30 @@ If you're facing some problems on rules `import/default` or `import/named` from

## Installation

### `eslint-plugin-import`
### `eslint-plugin-import-x`

```sh
# npm
npm i -D eslint-plugin-import eslint-import-resolver-typescript
npm i -D eslint-plugin-import-x eslint-import-resolver-typescript

# pnpm
pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript

# yarn
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
```

### `eslint-plugin-import-x`
### `eslint-plugin-import`

```sh
# npm
npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
npm i -D eslint-plugin-import eslint-import-resolver-typescript

# pnpm
pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
pnpm i -D eslint-plugin-import eslint-import-resolver-typescript

# yarn
yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
```

## Configuration
Expand All @@ -98,30 +98,27 @@ export default [

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

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

// use <root>/path/to/folder/tsconfig.json
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
project: 'path/to/folder',

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

// use a glob pattern
project: 'packages/*/tsconfig.json',
project: 'packages/*/{ts,js}config.json',

// use an array
project: [
'packages/module-a/tsconfig.json',
'packages/module-b/tsconfig.json',
'packages/module-b/jsconfig.json',
],

// use an array of glob patterns
project: [
'packages/*/tsconfig.json',
'other-packages/*/tsconfig.json',
'other-packages/*/jsconfig.json',
],

// use <root>/jsconfig.json
project: 'jsconfig.json',
}),
],
},
Expand All @@ -142,30 +139,27 @@ export default [

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

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

// use <root>/path/to/folder/tsconfig.json
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
project: 'path/to/folder',

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

// use a glob pattern
project: 'packages/*/tsconfig.json',
project: 'packages/*/{ts,js}config.json',

// use an array
project: [
'packages/module-a/tsconfig.json',
'packages/module-b/tsconfig.json',
'packages/module-b/jsconfig.json',
],

// use an array of glob patterns
project: [
'packages/*/tsconfig.json',
'other-packages/*/tsconfig.json',
'other-packages/*/jsconfig.json',
],

// use <root>/jsconfig.json
project: 'jsconfig.json',
},
},
},
Expand Down Expand Up @@ -194,30 +188,27 @@ Add the following to your `.eslintrc` config:

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

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

// use <root>/path/to/folder/tsconfig.json
// use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json
"project": "path/to/folder",

// Multiple tsconfigs (Useful for monorepos)
// Multiple tsconfigs (Useful for monorepos, but discouraged in favor of `references` supported)

// use a glob pattern
"project": "packages/*/tsconfig.json",
"project": "packages/*/{ts,js}config.json",

// use an array
"project": [
"packages/module-a/tsconfig.json",
"packages/module-b/tsconfig.json",
"packages/module-b/jsconfig.json",
],

// use an array of glob patterns
"project": [
"packages/*/tsconfig.json",
"other-packages/*/tsconfig.json",
"other-packages/*/jsconfig.json",
],

// use <root>/jsconfig.json
"project": "jsconfig.json",
},
},
},
Expand All @@ -236,7 +227,7 @@ Enable Bun built-in module resolution by choosing 1 out of these 3 options:
- Run ESLint with `bun --bun eslint`
- [Configure `run.bun` in `bunfig.toml`](https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun)

## Options from [`rspack-resolver`][]
## Options from [`unrs-resolver`][]

### `conditionNames`

Expand Down Expand Up @@ -320,7 +311,7 @@ Default:

### Other options

You can pass through other options of [`rspack-resolver`][] directly
You can pass through other options of [`unrs-resolver`][] directly

### Default options

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

[`eslint-plugin-import`]: https://github.com/import-js/eslint-plugin-import
[`eslint-plugin-import-x`]: https://github.com/un-ts/eslint-plugin-import-x
[`rspack-resolver`]: https://github.com/unrs/rspack-resolver
[`unrs-resolver`]: https://github.com/unrs/unrs-resolver
[`typescript`]: https://www.typescriptlang.org
[isc]: https://opensource.org/licenses/ISC
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "4.2.3",
"type": "module",
"description": "This plugin adds `TypeScript` support to `eslint-plugin-import`",
"repository": "git+https://github.com/import-js/eslint-import-resolver-typescript",
"repository": "https://github.com/import-js/eslint-import-resolver-typescript",
"author": "Alex Gorbatchev <[email protected]>",
"contributors": [
"JounQin (https://www.1stG.me) <[email protected]>"
"JounQin <[email protected]> (https://www.1stG.me)"
],
"funding": "https://opencollective.com/unts/projects/eslint-import-resolver-ts",
"license": "ISC",
Expand Down Expand Up @@ -80,34 +80,34 @@
"debug": "^4.4.0",
"get-tsconfig": "^4.10.0",
"is-bun-module": "^2.0.0",
"rspack-resolver": "^1.2.2",
"stable-hash": "^0.0.5",
"tinyglobby": "^0.2.12"
"tinyglobby": "^0.2.12",
"unrs-resolver": "^1.3.1"
},
"devDependencies": {
"@1stg/lib-config": "^13.0.1",
"@1stg/common-config": "^11.1.0",
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.28.1",
"@commitlint/cli": "^19.8.0",
"@mozilla/glean": "^5.0.3",
"@pkgr/rollup": "^6.0.0",
"@pkgr/rollup": "^6.0.1",
"@total-typescript/ts-reset": "^0.6.1",
"@types/debug": "^4.1.12",
"@types/node": "^22.13.10",
"@types/node": "^22.13.13",
"@types/pnpapi": "^0.0.5",
"@types/unist": "^3.0.3",
"@vitest/coverage-v8": "3.0.9",
"clean-pkg-json": "^1.2.1",
"dummy.js": "link:dummy.js",
"eslint": "^9.22.0",
"eslint": "^9.23.0",
"eslint-import-resolver-typescript": "link:.",
"eslint-plugin-import-x": "^4.9.0",
"eslint-plugin-import-x": "^4.9.2",
"lint-staged": "^15.5.0",
"npm-run-all2": "^7.0.2",
"path-serializer": "^0.3.4",
"prettier": "^3.5.3",
"react": "^19.0.0",
"simple-git-hooks": "^2.11.1",
"simple-git-hooks": "^2.12.1",
"size-limit": "^11.2.0",
"size-limit-preset-node-lib": "^0.3.0",
"tinyexec": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
parseTsconfig,
} from 'get-tsconfig'
import { isBunBuiltin } from 'is-bun-module'
import { ResolverFactory } from 'rspack-resolver'
import { stableHash } from 'stable-hash'
import { ResolverFactory } from 'unrs-resolver'

import { IMPORT_RESOLVER_NAME, JS_EXT_PATTERN } from './constants.js'
import {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const resolve = (
options ||= {}

// don't worry about node/bun core modules
if ((isBun || options.bun) ? isBunBuiltin(source) : isBuiltin(source)) {
if (isBun || options.bun ? isBunBuiltin(source) : isBuiltin(source)) {
log('matched core:', source)
return { found: true, path: null }
}
Expand Down
2 changes: 1 addition & 1 deletion src/normalize-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TsconfigOptions } from 'rspack-resolver'
import { globSync, isDynamicPattern } from 'tinyglobby'
import type { TsconfigOptions } from 'unrs-resolver'

import {
DEFAULT_CONFIGS,
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NapiResolveOptions } from 'rspack-resolver'
import type { NapiResolveOptions } from 'unrs-resolver'

export interface TypeScriptResolverOptions extends NapiResolveOptions {
project?: string[] | string
Expand Down
Loading