Skip to content

Commit 6954be1

Browse files
committedAug 3, 2019
add test for multiple tsconfigs
1 parent 7c85bfa commit 6954be1

14 files changed

+77
-1
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"typescript": "^3.1.1"
3939
},
4040
"scripts": {
41-
"test": "eslint ./tests/withPaths/index.ts && eslint ./tests/withoutPaths/index.ts",
41+
"test": "eslint ./tests/withPaths/index.ts && eslint ./tests/withoutPaths/index.ts && eslint ./tests/multipleTsconfigs/**/index.ts",
4242
"check-format": "prettier --config prettier.config.js index.js -l",
4343
"format": "prettier --config prettier.config.js index.js --write"
4444
}

‎tests/multipleTsconfigs/.eslintrc.js

+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')(absoluteGlobPath);
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,15 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": ["*"],
7+
"*": ["../../../../node_modules/*"]
8+
},
9+
},
10+
"files": [
11+
"index.ts",
12+
"tsImportee.ts",
13+
"tsxImportee.tsx"
14+
]
15+
}
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,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,15 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"jsx": "react",
5+
"paths": {
6+
"folder/*": ["*"],
7+
"*": ["../../../../node_modules/*"]
8+
},
9+
},
10+
"files": [
11+
"index.ts",
12+
"tsImportee.ts",
13+
"tsxImportee.tsx"
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'React Component'

0 commit comments

Comments
 (0)
Please sign in to comment.