Skip to content

Commit db04503

Browse files
authored
build: use base ts-config (#677)
* build: use base ts-config * remove noImplicitAny (part of strict:true) * remove skipLibCheck:true for more type safity * use es2018 target * remove noUnusedLocals:true (already covered by eslint) * fix: cli ts-config * use useDefineForClassFields + forceConsistentCasingInFileNames * rename prettier config
1 parent 67cba65 commit db04503

9 files changed

+34
-65
lines changed

.prettierrc

-4
This file was deleted.

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
globals: {
33
"ts-jest": {
4-
tsconfig: "tsconfig.jest.json",
4+
tsconfig: "tsconfig.esm.json",
55
},
66
},
77
preset: "ts-jest",

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
},
4444
"homepage": "https://github.com/drwpow/openapi-typescript#readme",
4545
"scripts": {
46-
"build": "rm -rf dist && tsc --build tsconfig.json && tsc --build tsconfig.cjs.json",
46+
"build": "rm -rf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
4747
"format": "npm run prettier -w .",
4848
"lint": "eslint .",
4949
"prepare": "npm run build",
5050
"pregenerate": "npm run build",
5151
"test": "npm run build && jest --no-cache",
5252
"test:coverage": "npm run build && jest --no-cache --coverage && codecov",
53-
"typecheck": "tsc --noEmit",
53+
"typecheck": "tsc --noEmit --project tsconfig.esm.json",
5454
"version": "npm run build"
5555
},
5656
"dependencies": {

prettier.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
printWidth: 120,
3+
proseWrap: "always",
4+
};

tsconfig.base.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./src",
4+
"declaration": true,
5+
"esModuleInterop": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"lib": ["ES2018"],
8+
"moduleResolution": "Node",
9+
"noImplicitReturns": true,
10+
"removeComments": true,
11+
"sourceMap": true,
12+
"strict": true,
13+
"target": "ES2018",
14+
"useDefineForClassFields": true
15+
},
16+
"exclude": ["examples/*", "tests/**/*"],
17+
"include": ["src"]
18+
}

tsconfig.cjs.json

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": "./src",
4-
"declaration": true,
5-
"esModuleInterop": true,
6-
"lib": ["ESNext"],
73
"module": "CommonJS",
8-
"moduleResolution": "node",
9-
"noImplicitAny": true,
10-
"noImplicitReturns": true,
11-
"noUnusedLocals": true,
12-
"outDir": "./dist/cjs",
13-
"removeComments": true,
14-
"skipLibCheck": true,
15-
"sourceMap": true,
16-
"strict": true,
17-
"target": "ES2018"
4+
"outDir": "./dist/cjs"
185
},
19-
"include": ["src"],
20-
"exclude": ["examples/*", "tests/**/*"]
6+
"extends": "./tsconfig.base.json"
217
}

tsconfig.esm.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"module": "ES2020",
4+
"outDir": "./dist/esm"
5+
},
6+
"extends": "./tsconfig.base.json"
7+
}

tsconfig.jest.json

-21
This file was deleted.

tsconfig.json

-21
This file was deleted.

0 commit comments

Comments
 (0)