Skip to content

Commit

Permalink
infra: improve tsconfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 3, 2023
1 parent ede6ffa commit 03de7b2
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 110 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
39 changes: 4 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,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@v3
Expand All @@ -181,37 +181,6 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 7

- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'

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

- 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@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 7

- name: Set node version to 18
uses: actions/setup-node@v3
Expand All @@ -224,8 +193,8 @@ jobs:
env:
CYPRESS_INSTALL_BINARY: 0

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

codecov:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ If you want to make `Faker` a better, please read the following contribution gui
Please make sure that you run `pnpm run preflight` before making a PR to ensure that everything is working from the start.
This is a shorthand for running the following scripts in order:

<!-- TODO @Shinigami92 2023-04-28: update below -->

- `pnpm install` - installs npm packages defined in package.json
- `pnpm run generate:locales` - generates locale files
- `pnpm run generate:api-doc` - generates API documentation
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 03de7b2

Please sign in to comment.