Skip to content

Commit 8192976

Browse files
authoredFeb 20, 2025··
fix: force tiniglobby to expand dot directories (#360)
* fix: force tiniglobby to expand dot directories * chore: changeset * chore(deps): update tinyglobby to latest version
1 parent 4f47f8a commit 8192976

36 files changed

+175
-11
lines changed
 

‎.changeset/fast-parrots-applaud.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-import-resolver-typescript': patch
3+
---
4+
5+
Force tiniglobby to expand dot directories

‎.changeset/forty-beans-tickle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-import-resolver-typescript': patch
3+
---
4+
5+
Update tinyglobby to latest version

‎package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"prepare": "simple-git-hooks",
5252
"release": "changeset publish",
5353
"test": "run-p 'test:*'",
54+
"test:dotInclude": "eslint --ext ts,tsx tests/dotInclude --ignore-pattern \"!.dot\"",
55+
"test:dotPaths": "eslint --ext ts,tsx tests/dotPaths --ignore-pattern \"!.dot\"",
56+
"test:dotProject": "eslint --ext ts,tsx tests/dotProject --ignore-pattern \"!.dot\"",
5457
"test:importXResolverV3": "eslint --config=tests/importXResolverV3/eslint.config.js tests/importXResolverV3",
5558
"test:multipleEslintrcs": "eslint --ext ts,tsx tests/multipleEslintrcs",
5659
"test:multipleTsconfigs": "eslint --ext ts,tsx tests/multipleTsconfigs",
@@ -82,7 +85,7 @@
8285
"get-tsconfig": "^4.10.0",
8386
"is-bun-module": "^1.0.2",
8487
"stable-hash": "^0.0.4",
85-
"tinyglobby": "^0.2.11"
88+
"tinyglobby": "^0.2.12"
8689
},
8790
"devDependencies": {
8891
"@1stg/eslint-config": "7.0.1",

‎src/index.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,10 @@ function initMappers(options: InternalResolverOptions) {
402402
...globSync(
403403
configPaths.filter(path => isDynamicPattern(path)),
404404
{
405+
absolute: true,
406+
dot: true,
405407
expandDirectories: false,
406408
ignore: defaultIgnore,
407-
absolute: true,
408409
},
409410
),
410411
]),
@@ -438,12 +439,13 @@ function initMappers(options: InternalResolverOptions) {
438439
tsconfigResult.config.include === undefined
439440
? // Include everything if no files or include options
440441
globSync(defaultInclude, {
442+
absolute: true,
443+
cwd: path.dirname(tsconfigResult.path),
444+
dot: true,
441445
ignore: [
442446
...(tsconfigResult.config.exclude ?? []),
443447
...defaultIgnore,
444448
],
445-
absolute: true,
446-
cwd: path.dirname(tsconfigResult.path),
447449
})
448450
: [
449451
// https://www.typescriptlang.org/tsconfig/#files
@@ -459,12 +461,13 @@ function initMappers(options: InternalResolverOptions) {
459461
...(tsconfigResult.config.include !== undefined &&
460462
tsconfigResult.config.include.length > 0
461463
? globSync(tsconfigResult.config.include, {
464+
absolute: true,
465+
cwd: path.dirname(tsconfigResult.path),
466+
dot: true,
462467
ignore: [
463468
...(tsconfigResult.config.exclude ?? []),
464469
...defaultIgnore,
465470
],
466-
absolute: true,
467-
cwd: path.dirname(tsconfigResult.path),
468471
})
469472
: []),
470473
]

‎tests/dotInclude/.dot/index.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// import relative
2+
import './tsImportee'
3+
import './tsxImportee'
4+
import './subfolder/tsImportee'
5+
import './subfolder/tsxImportee'
6+
7+
// import using tsconfig.json path mapping
8+
import 'folder/tsImportee'
9+
import 'folder/tsxImportee'
10+
import 'folder/subfolder/tsImportee'
11+
import 'folder/subfolder/tsxImportee'
12+
13+
// import module with typings set in package.json
14+
import 'folder/module'
15+
16+
// import from node_module
17+
import 'typescript'
18+
import 'dummy.js'
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "commonjs",
3+
"typings": "./module.d.ts",
4+
"private": true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

‎tests/dotInclude/.dot/tsImportee.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'

‎tests/dotInclude/.dot/tsxImportee.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

‎tests/dotInclude/.eslintrc.cjs

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

‎tests/dotInclude/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./.dot",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": ["*"],
7+
"*": ["../../node_modules/*"]
8+
}
9+
},
10+
"include": ["./**/*.ts", "./**/*.tsx"]
11+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "commonjs",
3+
"typings": "./module.d.ts",
4+
"private": true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

‎tests/dotPaths/.dot/tsImportee.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'

‎tests/dotPaths/.dot/tsxImportee.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

‎tests/dotPaths/.eslintrc.cjs

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

‎tests/dotPaths/index.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// import relative
2+
import './.dot/tsImportee'
3+
import './.dot/tsxImportee'
4+
import './.dot/subfolder/tsImportee'
5+
import './.dot/subfolder/tsxImportee'
6+
7+
// import using tsconfig.json path mapping
8+
import 'folder/tsImportee'
9+
import 'folder/tsxImportee'
10+
import 'folder/subfolder/tsImportee'
11+
import 'folder/subfolder/tsxImportee'
12+
13+
// import module with typings set in package.json
14+
import 'folder/module'
15+
16+
// import from node_module
17+
import 'typescript'
18+
import 'dummy.js'

‎tests/dotPaths/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": [".dot/*"],
7+
"*": ["../../node_modules/*"]
8+
}
9+
},
10+
"files": ["index.ts", ".dot/tsImportee.ts", ".dot/tsxImportee.tsx"]
11+
}

‎tests/dotProject/.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)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "../",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": ["*"],
7+
"*": ["../../../../node_modules/*"]
8+
}
9+
},
10+
"files": ["../index.ts", "../tsImportee.ts", "../tsxImportee.tsx"]
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// import relative
2+
import './tsImportee'
3+
import './tsxImportee'
4+
import './subfolder/tsImportee'
5+
import './subfolder/tsxImportee'
6+
7+
// import using tsconfig.json path mapping
8+
import 'folder/tsImportee'
9+
import 'folder/tsxImportee'
10+
import 'folder/subfolder/tsImportee'
11+
import 'folder/subfolder/tsxImportee'
12+
13+
// import from node_module
14+
import 'typescript'
15+
import 'dummy.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "../",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": ["*"],
7+
"*": ["../../../../node_modules/*"]
8+
}
9+
},
10+
"files": ["../index.ts", "../tsImportee.ts", "../tsxImportee.tsx"]
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// import relative
2+
import './tsImportee'
3+
import './tsxImportee'
4+
import './subfolder/tsImportee'
5+
import './subfolder/tsxImportee'
6+
7+
// import using tsconfig.json path mapping
8+
import 'folder/tsImportee'
9+
import 'folder/tsxImportee'
10+
import 'folder/subfolder/tsImportee'
11+
import 'folder/subfolder/tsxImportee'
12+
13+
// import from node_module
14+
import 'typescript'
15+
import 'dummy.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'yes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

‎yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -6170,7 +6170,7 @@ __metadata:
61706170
size-limit: "npm:^11.0.0"
61716171
size-limit-preset-node-lib: "npm:^0.3.0"
61726172
stable-hash: "npm:^0.0.4"
6173-
tinyglobby: "npm:^0.2.11"
6173+
tinyglobby: "npm:^0.2.12"
61746174
type-coverage: "npm:^2.27.0"
61756175
typescript: "npm:^5.3.2"
61766176
peerDependencies:
@@ -13513,13 +13513,13 @@ __metadata:
1351313513
languageName: node
1351413514
linkType: hard
1351513515

13516-
"tinyglobby@npm:^0.2.11":
13517-
version: 0.2.11
13518-
resolution: "tinyglobby@npm:0.2.11"
13516+
"tinyglobby@npm:^0.2.12":
13517+
version: 0.2.12
13518+
resolution: "tinyglobby@npm:0.2.12"
1351913519
dependencies:
1352013520
fdir: "npm:^6.4.3"
1352113521
picomatch: "npm:^4.0.2"
13522-
checksum: 8f10a0cd527041155c0dadd9febb5afc97a95649521f550554868c09beb4cb62ceca1d97536108efe53957967eb54f83a7bed59867f666b325fc3f00ca72fd24
13522+
checksum: 4ad28701fa9118b32ef0e27f409e0a6c5741e8b02286d50425c1f6f71e6d6c6ded9dd5bbbbb714784b08623c4ec4d150151f1d3d996cfabe0495f908ab4f7002
1352313523
languageName: node
1352413524
linkType: hard
1352513525

0 commit comments

Comments
 (0)
Please sign in to comment.