Skip to content

Commit

Permalink
re-arrange base tsconfigs, ensure that type checking results are the …
Browse files Browse the repository at this point in the history
…same between 'typecheck' and 'build:types'
  • Loading branch information
kevinbarabash committed Feb 16, 2023
1 parent e51de8c commit 44067b1
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: yarn build

- name: Build Types
run: yarn build:types
run: yarn build:types && rm -rf packages/*/dist/**/__types__

# Linting / type checking
- name: Eslint
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@
"build:prodsizecheck": "rollup -c build-settings/rollup.config.js --configPlatforms='browser' --configFormats='esm' --configEnvironment='production'",
"build:types": "yarn tsc --build --verbose tsconfig-build.json",
"watch": "rollup -c build-settings/rollup.config.js --watch",
"watch:types": "yarn build:types --watch",
"clean": "rm -rf packages/wonder-stuff-*/dist && rm -rf packages/wonder-stuff-*/node_modules && rm -f packages/*/tsconfig.tsbuildinfo",
"coverage": "yarn run jest --coverage",
"format": "prettier --write .",
"lint": "eslint --config .eslintrc.js packages",
"lint:ci": "eslint --config .eslintrc.js",
"publish:ci": "node utils/pre-publish-check-ci.js && git diff --stat --exit-code HEAD && yarn build && changeset publish",
"test": "yarn jest",
"typecheck": "tsc --noEmit",
"typecheck": "tsc --project tsconfig-check.json",
"nochangeset": "yarn changeset add --empty"
}
}
16 changes: 3 additions & 13 deletions packages/tsconfig-shared.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file is used by the tsconfig.json files in each package.
/* Visit https://aka.ms/tsconfig to read more about this file */
{
"exclude": ["dist"],
"extends": "../tsconfig-common.json",
"compilerOptions": {
"composite": true,
"incremental": true, // Required for composite projects
Expand All @@ -10,20 +11,9 @@
"declaration": true,
"emitDeclarationOnly": true,

"target": "ES2016",
// Required for dynamic imports even though we aren't using
// tsc to output any modules.
"module": "esnext",
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",

"strict": true,
"noImplicitAny": true,

"paths": {
"@khanacademy/*": [
"./packages/*/src"
"./*/src"
]
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/wonder-stuff-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/wonder-stuff-i18n/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/wonder-stuff-sentry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/wonder-stuff-server-google/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/wonder-stuff-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "./dist",
Expand Down
3 changes: 2 additions & 1 deletion packages/wonder-stuff-testing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"exclude": ["dist"],
"exclude": ["dist", "**/*.flowtest.ts"],
"extends": "../tsconfig-shared.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is used by the `build:types` command in package.json
/* Visit https://aka.ms/tsconfig to read more about this file */
{
// Intentionally empty, all files are covered by tsconfig.json files
Expand All @@ -10,5 +11,5 @@
{"path": "./packages/wonder-stuff-server"},
{"path": "./packages/wonder-stuff-server-google"},
{"path": "./packages/wonder-stuff-testing"},
]
],
}
13 changes: 13 additions & 0 deletions tsconfig-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This file is used by the `typecheck` command in package.json
/* Visit https://aka.ms/tsconfig to read more about this file */
{
"exclude": ["**/dist", "**/*.flowtest.ts"],
"extends": "./tsconfig-common.json",
"compilerOptions": {
"noEmit": true,

"paths": {
"@khanacademy/*": ["./packages/*/src"]
},
}
}
30 changes: 30 additions & 0 deletions tsconfig-common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This file contains common compiler options that are used by all tsconfigs
/* Visit https://aka.ms/tsconfig to read more about this file */
{
"compilerOptions": {
/* Language and Environment */
"target": "ES2016",

/* Modules */
// Required for dynamic imports even though we aren't using
// tsc to output any modules.
"module": "ESNext",
"moduleResolution": "node",

/* Interop Constraints */
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,

/* Type Checking */
"strict": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitAny": true,

/* Completeness */
"skipDefaultLibCheck": true, // it's safe to assume that built-in .d.ts files are correct
"skipLibCheck": false
}
}
33 changes: 0 additions & 33 deletions tsconfig.json

This file was deleted.

0 comments on commit 44067b1

Please sign in to comment.