Skip to content

Commit 5ef37f1

Browse files
committed
fix: yarn pnp with patch for demo
1 parent e228b32 commit 5ef37f1

27 files changed

+81
-41
lines changed

.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dist
22
lib
33
CHANGELOG.md
4-
!/.*.cjs
5-
/.pnp.*
4+
.pnp.*
5+
!.*.cjs

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"root": true,
3+
"env": {
4+
"node": true
5+
},
36
"parserOptions": {
47
"ecmaVersion": "latest"
58
},

.gitignore

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
.type-coverage
2-
.yarn
32
lib
43
node_modules
54
*.log
65
.eslintcache
7-
!/.yarn/plugins
8-
!/.yarn/releases
9-
!/.yarn/versions
10-
!/.pnp.*
6+
!.pnp.*
7+
.yarn
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions

.pnp.cjs

+13-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.type-coverage
2+
dist
13
lib
24
node_modules
35
CHANGELOG.md
6+
.pnp.*
7+
.yarn

.yarn/patches/get-tsconfig-npm-4.1.0-625beb501f.patch

+11
Large diffs are not rendered by default.

dummy.js/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "dummy.js",
3-
"version": "1.0.0",
4-
"main": "index.js",
5-
"private": true
2+
"name": "dummy.js",
3+
"version": "1.0.0",
4+
"private": true,
5+
"main": "index.js"
66
}

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,21 @@
115115
"@types/node": "^18.0.0",
116116
"@types/unist": "^2.0.6",
117117
"commitlint": "^17.0.3",
118+
"cross-env": "^7.0.3",
118119
"dummy.js": "link:dummy.js",
119120
"eslint": "^8.19.0",
120121
"eslint-import-resolver-typescript": "link:.",
121122
"eslint-plugin-import": "^2.26.0",
122-
"esprima": "^4.0.1",
123123
"lint-staged": "^13.0.3",
124124
"npm-run-all": "^4.1.5",
125+
"prettier": "^2.7.1",
125126
"react": "^18.2.0",
126127
"simple-git-hooks": "^2.8.0",
127128
"type-coverage": "^2.21.2",
128129
"typescript": "^4.7.4"
129130
},
130131
"resolutions": {
132+
"get-tsconfig": "patch:get-tsconfig@npm:4.1.0#.yarn/patches/get-tsconfig-npm-4.1.0-625beb501f.patch",
131133
"prettier": "^2.7.1"
132134
},
133135
"dependenciesMeta": {

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const isFile = (path?: string | undefined): path is string => {
265265
function getMappedPath(
266266
source: string,
267267
file: string,
268-
extensions = defaultExtensions,
268+
extensions: string[] = defaultExtensions,
269269
retry?: boolean,
270270
): string | undefined {
271271
const originalExtensions = extensions

tests/baseEslintConfig.js renamed to tests/baseEslintConfig.cjs

+8
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ module.exports = project => ({
3434
'node/no-extraneous-import': 0,
3535
'node/no-missing-import': 0,
3636
},
37+
overrides: [
38+
{
39+
files: '**/.*.cjs',
40+
rules: {
41+
'@typescript-eslint/no-var-requires': 'off',
42+
},
43+
},
44+
],
3745
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../../baseEslintConfig.cjs')(__dirname)

tests/multipleEslintrcs/module-a/.eslintrc.js

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../../baseEslintConfig.cjs')(__dirname)

tests/multipleEslintrcs/module-b/.eslintrc.js

-1
This file was deleted.

tests/multipleTsconfigs/.eslintrc.cjs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const path = require('path')
2+
3+
const globPattern = './packages/*/tsconfig.json'
4+
5+
// in normal cases this is not needed because the __dirname would be the root
6+
const absoluteGlobPath = path.join(__dirname, globPattern)
7+
8+
module.exports = require('../baseEslintConfig.cjs')(absoluteGlobPath)

tests/multipleTsconfigs/.eslintrc.js

-8
This file was deleted.

tests/withJsExtension/.eslintrc.js renamed to tests/withJsExtension/.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-env node */
22
/* eslint-disable @typescript-eslint/no-var-requires */
3-
const config = require('../baseEslintConfig')(__dirname)
3+
const config = require('../baseEslintConfig.cjs')(__dirname)
44

55
module.exports = {
66
...config,

tests/withJsExtension/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ assertResolve('bar', 'bar/index.tsx')
124124

125125
assertResolve(
126126
'typescript/lib/typescript.js',
127-
'../../node_modules/typescript/lib/typescript.js',
127+
path.relative(__dirname, require.resolve('typescript/lib/typescript.js')),
128128
)
129129

130130
// resolves symlinks by default

tests/withPaths/.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../baseEslintConfig.cjs')(__dirname)

tests/withPaths/.eslintrc.js

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../baseEslintConfig.cjs')(__dirname)

tests/withPathsAndNestedBaseUrl/.eslintrc.js

-1
This file was deleted.

tests/withQuerystring/.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../baseEslintConfig.cjs')(__dirname)

tests/withQuerystring/.eslintrc.js

-1
This file was deleted.

tests/withoutPaths/.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../baseEslintConfig.cjs')(__dirname)

tests/withoutPaths/.eslintrc.js

-1
This file was deleted.

yarn.lock

+10-2
Original file line numberDiff line numberDiff line change
@@ -6399,19 +6399,20 @@ __metadata:
63996399
"@types/node": ^18.0.0
64006400
"@types/unist": ^2.0.6
64016401
commitlint: ^17.0.3
6402+
cross-env: ^7.0.3
64026403
debug: ^4.3.4
64036404
dummy.js: "link:dummy.js"
64046405
enhanced-resolve: ^5.10.0
64056406
eslint: ^8.19.0
64066407
eslint-import-resolver-typescript: "link:."
64076408
eslint-plugin-import: ^2.26.0
6408-
esprima: ^4.0.1
64096409
get-tsconfig: ^4.1.0
64106410
globby: ^13.1.2
64116411
is-core-module: ^2.9.0
64126412
is-glob: ^4.0.3
64136413
lint-staged: ^13.0.3
64146414
npm-run-all: ^4.1.5
6415+
prettier: ^2.7.1
64156416
react: ^18.2.0
64166417
simple-git-hooks: ^2.8.0
64176418
synckit: ^0.7.1
@@ -7624,13 +7625,20 @@ __metadata:
76247625
languageName: node
76257626
linkType: hard
76267627

7627-
"get-tsconfig@npm:^4.1.0":
7628+
"get-tsconfig@npm:4.1.0":
76287629
version: 4.1.0
76297630
resolution: "get-tsconfig@npm:4.1.0"
76307631
checksum: a1a29cdf53609a1e9e111bf863ea209494c03e425964ed2603e3a2657ed1d38213d4a8e3efbfd945f2ec908fe99b76d3ee87422fac5d8ec4fdd858bbb502efbf
76317632
languageName: node
76327633
linkType: hard
76337634

7635+
"get-tsconfig@patch:get-tsconfig@npm:4.1.0#.yarn/patches/get-tsconfig-npm-4.1.0-625beb501f.patch::locator=eslint-import-resolver-typescript%40workspace%3A.":
7636+
version: 4.1.0
7637+
resolution: "get-tsconfig@patch:get-tsconfig@npm%3A4.1.0#.yarn/patches/get-tsconfig-npm-4.1.0-625beb501f.patch::version=4.1.0&hash=2ea638&locator=eslint-import-resolver-typescript%40workspace%3A."
7638+
checksum: 2906b7505f3a322f2d30e80cc08ba86d6d28c38f3df02c96ea0d6afb5d247a8a0f5dbd36f5ad23771d90e7800780fac8dfa0c6f5dc5672a6388667d10043a842
7639+
languageName: node
7640+
linkType: hard
7641+
76347642
"git-raw-commits@npm:^2.0.0":
76357643
version: 2.0.11
76367644
resolution: "git-raw-commits@npm:2.0.11"

0 commit comments

Comments
 (0)