Skip to content

Commit

Permalink
infra: reduce tsconfig complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Jul 14, 2023
1 parent c6323f8 commit d28e7dd
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = defineConfig({
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.lint.json'],
project: ['./tsconfig.json'],
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false,
},
Expand Down
31 changes: 2 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ jobs:
- name: Check formatting
run: pnpm prettier --check .

ts-check-scripts:
ts-check:
runs-on: ubuntu-latest
timeout-minutes: 10
name: 'TS-Check Scripts: node-18, ubuntu-latest'
name: 'TS-Check: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
Expand All @@ -194,33 +194,6 @@ jobs:
- name: Check scripts
run: pnpm run ts-check:scripts

ts-check-tests:
runs-on: ubuntu-latest
timeout-minutes: 10
name: 'TS-Check Tests: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4

- name: Set node version to 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 18
cache: 'pnpm'

- name: Install deps
run: pnpm install
env:
CYPRESS_INSTALL_BINARY: 0

- name: Check tests
run: pnpm run ts-check:tests

codecov:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ This is a shorthand for running the following scripts in order:
- `pnpm run build:code` - builds the code, both CommonJS and ESM versions
- `pnpm run build:types` - builds the TypeScript type definitions
- `pnpm run test:update-snapshots ` - runs all tests, and updates any snapshots if needed
- `pnpm run ts-check:scripts` - checks that there are no TypeScript errors in script files
- `pnpm run ts-check:tests` - checks that there are no TypeScript errors in test or script files
- `pnpm run ts-check` - checks that there are no TypeScript errors in any files

## Good to know

Expand Down
8 changes: 0 additions & 8 deletions docs/.vitepress/tsconfig.json

This file was deleted.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,14 @@
},
"files": [
"CHANGELOG.md",
"CHANGELOG_old.md",
"dist",
"locale",
"tsconfig.json"
"locale"
],
"scripts": {
"clean": "rimraf coverage .eslintcache dist docs/.vitepress/dist pnpm-lock.yaml node_modules",
"build:clean": "rimraf dist",
"build:code": "tsx ./scripts/bundle.ts",
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
"build:types": "tsc --project tsconfig.build.json",
"build": "run-s build:clean build:code build:types",
"generate": "run-s generate:locales generate:api-docs",
"generate:api-docs": "tsx ./scripts/apidoc.ts",
Expand All @@ -77,9 +75,7 @@
"docs:diff": "tsx ./scripts/diff.ts",
"format": "prettier --cache --write .",
"lint": "eslint --cache --cache-strategy content --report-unused-disable-directives .",
"ts-check": "run-s ts-check:scripts ts-check:tests",
"ts-check:scripts": "tsc --project tsconfig.check-scripts.json",
"ts-check:tests": "tsc --project tsconfig.check-tests.json",
"ts-check": "tsc",
"test": "vitest",
"test:update-snapshots": "vitest run -u",
"coverage": "vitest run --coverage",
Expand Down
6 changes: 0 additions & 6 deletions test/scripts/apidoc/tsconfig.json

This file was deleted.

2 changes: 0 additions & 2 deletions test/scripts/apidoc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export function loadExampleMethods(): Record<string, SignatureReflection> {
return loadProjectModules(
{
entryPoints: ['test/scripts/apidoc/signature.example.ts'],
tsconfig: 'test/scripts/apidoc/tsconfig.json',
},
true
)['SignatureTest'][1];
Expand All @@ -47,7 +46,6 @@ export function loadExampleModules(): Record<string, DeclarationReflection> {
const modules = loadProjectModules(
{
entryPoints: ['test/scripts/apidoc/module.example.ts'],
tsconfig: 'test/scripts/apidoc/tsconfig.json',
},
true
);
Expand Down
20 changes: 0 additions & 20 deletions tsconfig.base.json

This file was deleted.

17 changes: 17 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2019",
"noEmit": false,
"emitDeclarationOnly": true,
"rootDir": "src",
"outDir": "dist/types",

// This negates what is set in the extended tsconfig.json
"noImplicitAny": true,
"skipLibCheck": false,
"allowSyntheticDefaultImports": false,
"resolveJsonModule": false
},
"include": ["src"]
}
4 changes: 0 additions & 4 deletions tsconfig.check-scripts.json

This file was deleted.

4 changes: 0 additions & 4 deletions tsconfig.check-tests.json

This file was deleted.

30 changes: 16 additions & 14 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"compilerOptions": {
"target": "ES2019",
"moduleResolution": "Node",
"rootDir": "src",
"outDir": "dist",
"target": "ESNext",
"moduleResolution": "node",
"module": "ESNext",
"strict": true,
"noEmit": true,
"declaration": true,
"esModuleInterop": true,
"allowJs": true,
"alwaysStrict": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"stripInternal": true,
"baseUrl": "."

// We need to disable these for now, and need to tackle them in another PR
"strictNullChecks": false,
"strictBindCallApply": false,
"noImplicitAny": false,

// These are configs specifically for !build and have to be reverted in the tsconfig.build.json
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "dist", "locale"]
}
9 changes: 0 additions & 9 deletions tsconfig.lint.json

This file was deleted.

0 comments on commit d28e7dd

Please sign in to comment.