Skip to content

Commit b48e7e5

Browse files
committed
Standardize tsconfig files
This project has two kinds of TypeScript config files, which is consistent with the module template. However, whereas in the module template, the default config file (`tsconfig.json`) is the one used for development and `tsconfig.build.json` is used to build the project, in this repo it's reversed (`tsconfig.test.json` used for development). This commit aligns the kinds of TypeScript configuration files with the module template. It also normalizes the existing options to fit the module template. There should be no differences to `dist/`.
1 parent d5fc8da commit b48e7e5

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

.eslintrc.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ module.exports = {
2525

2626
{
2727
files: ['*.test.ts', '*.test.js'],
28-
parserOptions: {
29-
project: ['./tsconfig.test.json'],
30-
tsconfigRootDir: __dirname,
31-
},
3228
extends: ['@metamask/eslint-config-jest'],
3329
},
3430
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dist/"
1414
],
1515
"scripts": {
16-
"build": "tsc --project .",
16+
"build": "tsc --project tsconfig.build.json",
1717
"build:clean": "rm -rf dist && yarn build",
1818
"build:link": "yarn build && cd dist && yarn link && rm -rf node_modules && cd ..",
1919
"lint": "yarn lint:eslint && yarn lint:misc --check",

tsconfig.build.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"inlineSources": true,
7+
"noEmit": false,
8+
"outDir": "dist",
9+
"rootDir": "src",
10+
"sourceMap": true
11+
},
12+
"include": ["./src/**/*.ts"],
13+
"exclude": [
14+
"./src/**/__fixtures__/**/*",
15+
"./src/**/__mocks__/**/*",
16+
"./src/**/__test__/**/*",
17+
"./src/**/__tests__/**/*",
18+
"./src/**/__snapshots__/**/*",
19+
"./src/**/*.test.ts",
20+
"./src/**/*.test-d.ts",
21+
"./src/**/*.test.*.ts"
22+
]
23+
}

tsconfig.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
{
22
"compilerOptions": {
3-
"declaration": true,
43
"esModuleInterop": true,
5-
"inlineSources": true,
64
"lib": ["DOM", "ES2020"],
75
"module": "CommonJS",
8-
"moduleResolution": "Node",
9-
"outDir": "dist",
10-
"rootDir": "src",
11-
"sourceMap": true,
12-
"strict": true,
13-
"target": "ES2017",
6+
"moduleResolution": "node",
7+
"noEmit": true,
8+
"resolveJsonModule": true,
149
"skipLibCheck": true,
15-
"resolveJsonModule": true
10+
"strict": true,
11+
"target": "es2017"
1612
},
17-
"exclude": ["./src/**/*.test.ts"],
18-
"include": ["./src/**/*.ts"]
13+
"exclude": ["./dist", "**/node_modules"]
1914
}

tsconfig.test.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)