Skip to content
Draft
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
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@ jobs:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
# - macos-latest
# - ubuntu-latest
- windows-latest
node:
- 18
- 20
- 22
# - 18
# - 20
# - 22
# https://github.com/nodejs/node/issues/59480
- 24.5
eslint:
- 8.56
- 8
# - 8.56
# - 8
- 9

include:
- executeLint: true
node: lts/*
eslint: 9
os: ubuntu-latest
- legacyNodeResolver: true
node: lts/*
eslint: 9
os: ubuntu-latest
# include:
# - executeLint: true
# node: lts/*
# eslint: 9
# os: ubuntu-latest
# - legacyNodeResolver: true
# node: lts/*
# eslint: 9
# os: ubuntu-latest
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
'^eslint-plugin-import-x/(.+)$': `<rootDir>/${srcDir}/$1`,
},
snapshotSerializers: ['<rootDir>/test/jest.serializer.cjs'],
testMatch: ['<rootDir>/test/**/*.spec.ts'],
testMatch: ['<rootDir>/test/**/fixtures.spec.ts'],
transform: {
'^.+\\.(m?[jt]s|[jt]sx?)$': [
'@swc-node/jest',
Expand Down
74 changes: 38 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@
}
},
"dependencies": {
"@typescript-eslint/types": "^8.35.0",
"@typescript-eslint/types": "^8.40.0",
"comment-parser": "^1.4.1",
"debug": "^4.4.1",
"eslint-import-context": "^0.1.9",
"eslint-import-context": "^0.2.0",
"is-glob": "^4.0.3",
"minimatch": "^9.0.3 || ^10.0.1",
"minimatch": "^9.0.3 || ^10.0.3",
"oxc-resolver": "^11.7.1",
"semver": "^7.7.2",
"stable-hash-x": "^0.2.0",
"unrs-resolver": "^1.9.2"
"stable-hash-x": "^0.2.0"
},
"devDependencies": {
"@1stg/commitlint-config": "^5.1.0",
Expand All @@ -93,22 +93,22 @@
"@1stg/simple-git-hooks": "^2.1.0",
"@1stg/tsconfig": "^3.0.3",
"@angular-eslint/template-parser": "^20.1.1",
"@babel/core": "^7.27.4",
"@babel/eslint-parser": "^7.27.5",
"@babel/plugin-proposal-decorators": "^7.27.1",
"@babel/core": "^7.28.3",
"@babel/eslint-parser": "^7.28.0",
"@babel/plugin-proposal-decorators": "^7.28.0",
"@babel/plugin-proposal-export-default-from": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-env": "^7.28.3",
"@babel/preset-flow": "^7.27.1",
"@babel/preset-react": "^7.27.1",
"@babel/preset-typescript": "^7.27.1",
"@babel/register": "^7.27.1",
"@babel/register": "^7.28.3",
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.29.5",
"@changesets/cli": "^2.29.6",
"@commitlint/cli": "^19.8.1",
"@eslint/import-test-order-redirect-scoped": "link:./test/fixtures/order-redirect-scoped",
"@eslint/js": "^9.29.0",
"@swc-node/jest": "^1.8.13",
"@swc/core": "^1.12.7",
"@eslint/js": "^9.33.0",
"@swc-node/jest": "^1.9.1",
"@swc/core": "^1.13.3",
"@swc/helpers": "^0.5.17",
"@test-scope/some-module": "link:./test/fixtures/symlinked-module",
"@total-typescript/ts-reset": "^0.6.1",
Expand All @@ -119,17 +119,18 @@
"@types/jest": "^30.0.0",
"@types/json-schema": "^7.0.15",
"@types/klaw-sync": "^6.0.5",
"@types/node": "^22.15.33",
"@types/node": "^22.17.2",
"@types/pnpapi": "^0.0.5",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^8.35.0",
"@typescript-eslint/parser": "^8.35.0",
"@typescript-eslint/rule-tester": "^8.35.0",
"@typescript-eslint/utils": "^8.35.0",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@typescript-eslint/parser": "^8.40.0",
"@typescript-eslint/rule-tester": "^8.40.0",
"@typescript-eslint/scope-manager": "^8.40.0",
"@typescript-eslint/utils": "^8.40.0",
"@unts/patch-package": "^8.1.1",
"clean-pkg-json": "^1.3.0",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint": "^9.33.0",
"eslint-config-prettier": "^10.1.8",
"eslint-doc-generator": "^2.2.2",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-import-resolver-webpack": "^0.13.10",
Expand All @@ -138,36 +139,37 @@
"eslint-plugin-import-x": "link:.",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-json": "^4.0.1",
"eslint-plugin-mdx": "^3.5.0",
"eslint-plugin-n": "^17.20.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-mdx": "^3.6.2",
"eslint-plugin-n": "^17.21.3",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-unicorn": "^59.0.1",
"eslint-plugin-yml": "^1.18.0",
"eslint8.56": "npm:eslint@~8.56.0",
"eslint9": "npm:eslint@^9.28.0",
"globals": "^16.2.0",
"hermes-eslint": "^0.29.0",
"jest": "^30.0.3",
"eslint9": "npm:eslint@^9.33.0",
"globals": "^16.3.0",
"hermes-eslint": "^0.31.2",
"jest": "^30.0.5",
"klaw-sync": "^7.0.0",
"nano-staged": "^0.8.0",
"npm-run-all2": "^8.0.4",
"path-serializer": "^0.5.0",
"path-serializer": "^0.5.1",
"premove": "^4.0.0",
"prettier": "^3.6.1",
"prettier": "^3.6.2",
"redux": "^5.0.1",
"simple-git-hooks": "^2.13.0",
"simple-git-hooks": "^2.13.1",
"tinyexec": "^1.0.1",
"tmp": "^0.2.3",
"tmp": "^0.2.5",
"ts-node": "^10.9.2",
"tsdown": "^0.12.9",
"tsdown": "^0.14.1",
"type-fest": "^4.41.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.40.0",
"yarn-berry-deduplicate": "^6.1.3"
},
"resolutions": {
"@typescript-eslint/utils": "^8.34.0",
"prettier": "^3.5.3"
"prettier": "^3.5.3",
"unrs-resolver": "npm:oxc-resolver@^11.7.1"
},
"eslintIgnore": [
".yarn",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@swc-node/jest/lib/index.js b/node_modules/@swc-node/jest/lib/index.js
index 9a2fc9d..92f19fc 100644
index 9a2fc9d..4060446 100644
--- a/node_modules/@swc-node/jest/lib/index.js
+++ b/node_modules/@swc-node/jest/lib/index.js
@@ -17,13 +17,13 @@ function getJestTransformConfig(jestConfig) {
Expand Down
10 changes: 6 additions & 4 deletions src/node-resolver.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { isBuiltin } from 'node:module'
import path from 'node:path'

import { ResolverFactory } from 'unrs-resolver'
import type { NapiResolveOptions } from 'unrs-resolver'
import { ResolverFactory } from 'oxc-resolver'
import type { NapiResolveOptions } from 'oxc-resolver'

import type { NewResolver } from './types.js'

Expand Down Expand Up @@ -34,8 +34,10 @@ export function createNodeResolver({
if (resolved.path) {
return { found: true, path: resolved.path }
}
} catch {
//
} catch (error) {
console.log('----------------------')
console.error(modulePath, sourceFile, error)
console.log('----------------------')
}
return { found: false }
},
Expand Down
3 changes: 2 additions & 1 deletion src/utils/declared-scope.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ScopeType } from '@typescript-eslint/scope-manager'
import type { TSESTree } from '@typescript-eslint/utils'

import type { RuleContext } from '../types.js'
Expand All @@ -6,7 +7,7 @@ export function declaredScope(
context: RuleContext,
node: TSESTree.Node,
name: string,
) {
): ScopeType | undefined {
const references = context.sourceCode.getScope(node).references
const reference = references.find(x => x.identifier.name === name)
return reference?.resolved?.scope.type
Expand Down
5 changes: 4 additions & 1 deletion src/utils/legacy-resolver-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function resolveWithLegacyResolver(
sourceFile: string,
): ResolvedResult {
if (resolver.interfaceVersion === 2) {
return resolver.resolve(modulePath, sourceFile, config)
console.log(modulePath, sourceFile, config)
const result = resolver.resolve(modulePath, sourceFile, config)
console.log('result:', result)
return result
}

try {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/yarn-pnp/.env.yarn
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
DEBUG=eslint-import-resolver-typescript
ESLINT_USE_FLAT_CONFIG=true
RUST_BACKTRACE=full
5 changes: 4 additions & 1 deletion test/fixtures/yarn-pnp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"./add": "./add.js?custom"
},
"scripts": {
"lint": "eslint && yarn workspace test-package lint"
"lint": "yarn workspace test-package lint"
},
"devDependencies": {
"epix-oxc": "link:.",
"eslint": "^9.29.0",
"eslint-plugin-import-x": "link:../../.."
},
"resolutions": {
"unrs-resolver": "npm:oxc-resolver@^11.7.1"
}
}
2 changes: 0 additions & 2 deletions test/fixtures/yarn-pnp/test-package/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import js from '@eslint/js'
import { importX } from 'eslint-plugin-import-x'
import * as tsParser from '@typescript-eslint/parser'
import { globalIgnores } from 'eslint/config'
import globals from 'globals'

export default [
globalIgnores(['.pnp.cjs', '.yarn']),
js.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
Expand Down
7 changes: 4 additions & 3 deletions test/fixtures/yarn-pnp/test-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"demo": "tsx test.ts",
"lint": "eslint"
"lint": "tsx resolve.cts && eslint"
},
"dependencies": {
"nanoid": "^5.1.5"
Expand All @@ -15,10 +15,11 @@
"@types/node": "^22.15.32",
"@typescript-eslint/parser": "^8.34.1",
"eslint": "^9.29.0",
"eslint-import-resolver-typescript": "^4.4.3",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import-x": "link:../../../..",
"globals": "^16.2.0",
"tsx": "^4.20.3",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"unrs-resolver": "npm:oxc-resolver@^11.7.1"
}
}
22 changes: 22 additions & 0 deletions test/fixtures/yarn-pnp/test-package/resolve.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import path from 'node:path'

import {
defaultConditionNames,
defaultExtensions,
defaultExtensionAlias,
defaultMainFields,
} from 'eslint-import-resolver-typescript'
import { ResolverFactory } from 'unrs-resolver'

const resolver = new ResolverFactory({
conditionNames: defaultConditionNames,
extensions: defaultExtensions,
extensionAlias: defaultExtensionAlias,
mainFields: defaultMainFields,
})

const eslintJsTypes = require.resolve('@eslint/js/types/index.d.ts')

console.log('eslintJs', eslintJsTypes)

console.log(resolver.sync(path.dirname(eslintJsTypes), 'eslint'))
Loading
Loading