Skip to content

Commit 0708eb4

Browse files
authored
infra: reduce tsconfig complexity (#2102)
1 parent c6323f8 commit 0708eb4

13 files changed

+41
-107
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = defineConfig({
2121
],
2222
parser: '@typescript-eslint/parser',
2323
parserOptions: {
24-
project: ['./tsconfig.lint.json'],
24+
project: ['./tsconfig.json'],
2525
sourceType: 'module',
2626
warnOnUnsupportedTypeScriptVersion: false,
2727
},

.github/workflows/ci.yml

+3-30
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ jobs:
167167
- name: Check formatting
168168
run: pnpm prettier --check .
169169

170-
ts-check-scripts:
170+
ts-check:
171171
runs-on: ubuntu-latest
172172
timeout-minutes: 10
173-
name: 'TS-Check Scripts: node-18, ubuntu-latest'
173+
name: 'TS-Check: node-18, ubuntu-latest'
174174
steps:
175175
- name: Checkout
176176
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
@@ -192,34 +192,7 @@ jobs:
192192
CYPRESS_INSTALL_BINARY: 0
193193

194194
- name: Check scripts
195-
run: pnpm run ts-check:scripts
196-
197-
ts-check-tests:
198-
runs-on: ubuntu-latest
199-
timeout-minutes: 10
200-
name: 'TS-Check Tests: node-18, ubuntu-latest'
201-
steps:
202-
- name: Checkout
203-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
204-
with:
205-
fetch-depth: 0
206-
207-
- name: Install pnpm
208-
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
209-
210-
- name: Set node version to 18
211-
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
212-
with:
213-
node-version: 18
214-
cache: 'pnpm'
215-
216-
- name: Install deps
217-
run: pnpm install
218-
env:
219-
CYPRESS_INSTALL_BINARY: 0
220-
221-
- name: Check tests
222-
run: pnpm run ts-check:tests
195+
run: pnpm run ts-check
223196

224197
codecov:
225198
runs-on: ubuntu-latest

CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ This is a shorthand for running the following scripts in order:
1616
- `pnpm run build:code` - builds the code, both CommonJS and ESM versions
1717
- `pnpm run build:types` - builds the TypeScript type definitions
1818
- `pnpm run test:update-snapshots ` - runs all tests, and updates any snapshots if needed
19-
- `pnpm run ts-check:scripts` - checks that there are no TypeScript errors in script files
20-
- `pnpm run ts-check:tests` - checks that there are no TypeScript errors in test or script files
19+
- `pnpm run ts-check` - checks that there are no TypeScript errors in any files
2120

2221
## Good to know
2322

docs/.vitepress/tsconfig.json

-8
This file was deleted.

package.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@
5353
},
5454
"files": [
5555
"CHANGELOG.md",
56-
"CHANGELOG_old.md",
5756
"dist",
58-
"locale",
59-
"tsconfig.json"
57+
"locale"
6058
],
6159
"scripts": {
6260
"clean": "rimraf coverage .eslintcache dist docs/.vitepress/dist pnpm-lock.yaml node_modules",
6361
"build:clean": "rimraf dist",
6462
"build:code": "tsx ./scripts/bundle.ts",
65-
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
63+
"build:types": "tsc --project tsconfig.build.json",
6664
"build": "run-s build:clean build:code build:types",
6765
"generate": "run-s generate:locales generate:api-docs",
6866
"generate:api-docs": "tsx ./scripts/apidoc.ts",
@@ -77,9 +75,7 @@
7775
"docs:diff": "tsx ./scripts/diff.ts",
7876
"format": "prettier --cache --write .",
7977
"lint": "eslint --cache --cache-strategy content --report-unused-disable-directives .",
80-
"ts-check": "run-s ts-check:scripts ts-check:tests",
81-
"ts-check:scripts": "tsc --project tsconfig.check-scripts.json",
82-
"ts-check:tests": "tsc --project tsconfig.check-tests.json",
78+
"ts-check": "tsc",
8379
"test": "vitest",
8480
"test:update-snapshots": "vitest run -u",
8581
"coverage": "vitest run --coverage",

test/scripts/apidoc/tsconfig.json

-6
This file was deleted.

test/scripts/apidoc/utils.ts

-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export function loadExampleMethods(): Record<string, SignatureReflection> {
3434
return loadProjectModules(
3535
{
3636
entryPoints: ['test/scripts/apidoc/signature.example.ts'],
37-
tsconfig: 'test/scripts/apidoc/tsconfig.json',
3837
},
3938
true
4039
)['SignatureTest'][1];
@@ -47,7 +46,6 @@ export function loadExampleModules(): Record<string, DeclarationReflection> {
4746
const modules = loadProjectModules(
4847
{
4948
entryPoints: ['test/scripts/apidoc/module.example.ts'],
50-
tsconfig: 'test/scripts/apidoc/tsconfig.json',
5149
},
5250
true
5351
);

tsconfig.base.json

-20
This file was deleted.

tsconfig.build.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"target": "ES2019",
5+
"noEmit": false,
6+
"emitDeclarationOnly": true,
7+
"rootDir": "src",
8+
"outDir": "dist/types",
9+
10+
// This negates what is set in the extended tsconfig.json
11+
"noImplicitAny": true,
12+
"skipLibCheck": false,
13+
"allowSyntheticDefaultImports": false,
14+
"resolveJsonModule": false
15+
},
16+
"include": ["src"]
17+
}

tsconfig.check-scripts.json

-4
This file was deleted.

tsconfig.check-tests.json

-4
This file was deleted.

tsconfig.json

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2019",
4-
"moduleResolution": "Node",
5-
"rootDir": "src",
6-
"outDir": "dist",
3+
"target": "ESNext",
4+
"moduleResolution": "node",
5+
"module": "ESNext",
6+
"strict": true,
7+
"noEmit": true,
78
"declaration": true,
8-
"esModuleInterop": true,
9-
"allowJs": true,
10-
"alwaysStrict": true,
11-
"strictFunctionTypes": true,
12-
"noImplicitAny": true,
13-
"noImplicitThis": true,
14-
"useUnknownInCatchVariables": true,
159
"stripInternal": true,
16-
"baseUrl": "."
10+
11+
// We need to disable these for now, and need to tackle them in another PR
12+
"strictNullChecks": false,
13+
"strictBindCallApply": false,
14+
"noImplicitAny": false,
15+
16+
// These are configs specifically for !build and have to be reverted in the tsconfig.build.json
17+
"skipLibCheck": true,
18+
"allowSyntheticDefaultImports": true,
19+
"resolveJsonModule": true
1720
},
18-
"include": ["src/**/*"],
19-
"exclude": ["node_modules"]
21+
"exclude": ["node_modules", "dist", "locale"]
2022
}

tsconfig.lint.json

-9
This file was deleted.

0 commit comments

Comments
 (0)