File tree Expand file tree Collapse file tree 5 files changed +32
-5
lines changed Expand file tree Collapse file tree 5 files changed +32
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " eslint-plugin-import-x " : patch
3
+ ---
4
+
5
+ fix: align ` pnpapi ` resolved path with ` enhanced-resolve `
Original file line number Diff line number Diff line change 95
95
"@types/json-schema" : " ^7.0.15" ,
96
96
"@types/klaw-sync" : " ^6.0.5" ,
97
97
"@types/node" : " ^20.17.24" ,
98
+ "@types/pnpapi" : " ^0.0.5" ,
98
99
"@typescript-eslint/eslint-plugin" : " ^8.26.1" ,
99
100
"@typescript-eslint/parser" : " ^8.26.1" ,
100
101
"@typescript-eslint/rule-tester" : " ^8.26.1" ,
Original file line number Diff line number Diff line change 1
1
import '@total-typescript/ts-reset'
2
+ import type * as pnpapi from 'pnpapi'
3
+
4
+ declare module 'module' {
5
+ namespace Module {
6
+ function findPnpApi ( source : string ) : typeof pnpapi
7
+ }
8
+ }
Original file line number Diff line number Diff line change 1
- import { isBuiltin } from 'node:module'
1
+ import module from 'node:module'
2
2
import path from 'node:path'
3
3
4
4
import { ResolverFactory } from 'rspack-resolver'
@@ -49,13 +49,19 @@ export function createNodeResolver({
49
49
interfaceVersion : 3 ,
50
50
name : 'eslint-plugin-import-x built-in node resolver' ,
51
51
resolve ( modulePath , sourceFile ) {
52
- if (
53
- isBuiltin ( modulePath ) ||
54
- ( process . versions . pnp && modulePath === 'pnpapi' )
55
- ) {
52
+ if ( module . isBuiltin ( modulePath ) ) {
56
53
return { found : true , path : null }
57
54
}
58
55
56
+ if ( process . versions . pnp && modulePath === 'pnpapi' ) {
57
+ return {
58
+ found : true ,
59
+ path : module
60
+ . findPnpApi ( sourceFile )
61
+ . resolveToUnqualified ( modulePath , null ) ,
62
+ }
63
+ }
64
+
59
65
if ( modulePath . startsWith ( 'data:' ) ) {
60
66
return { found : true , path : null }
61
67
}
Original file line number Diff line number Diff line change @@ -3646,6 +3646,13 @@ __metadata:
3646
3646
languageName : node
3647
3647
linkType : hard
3648
3648
3649
+ " @types/pnpapi@npm:^0.0.5 " :
3650
+ version : 0.0.5
3651
+ resolution : " @types/pnpapi@npm:0.0.5"
3652
+ checksum : 10c0/2ade69b20d0ad5d16e6f709b1a40a8c43034ae5e8ca3b979a7fc7c26fbf0cc75791b7e8539f84e98c0e910b9c31d805fb420840e73482c6ed7bba9760ee938be
3653
+ languageName : node
3654
+ linkType : hard
3655
+
3649
3656
" @types/responselike@npm:^1.0.0 " :
3650
3657
version : 1.0.3
3651
3658
resolution : " @types/responselike@npm:1.0.3"
@@ -5624,6 +5631,7 @@ __metadata:
5624
5631
" @types/json-schema " : " npm:^7.0.15"
5625
5632
" @types/klaw-sync " : " npm:^6.0.5"
5626
5633
" @types/node " : " npm:^20.17.24"
5634
+ " @types/pnpapi " : " npm:^0.0.5"
5627
5635
" @typescript-eslint/eslint-plugin " : " npm:^8.26.1"
5628
5636
" @typescript-eslint/parser " : " npm:^8.26.1"
5629
5637
" @typescript-eslint/rule-tester " : " npm:^8.26.1"
You can’t perform that action at this time.
0 commit comments