-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor type-checking setup (#1969)
* Refactor type-checking setup * Refactor tsconfig particularly to enable loose check in VSCode, strict checks run separately for type definitions * Simplify includes for tsconfig * Explicitly separate the tsconfig for use with npm run-scripts * Improve comment * Resolved couple of work-in-progress comments * Update tsconfig to recommended node16 lib/module/target * Make checks strict by default and opt-out * Restore broken code to merge later changes * Updates after merge --------- Co-authored-by: Wee Bit <[email protected]>
- Loading branch information
1 parent
744ee3f
commit 96c6c25
Showing
12 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// @ts-check | ||
|
||
/** | ||
* CommanderError class | ||
* @class | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ /* | ||
Simple override including just JavaScript files. | ||
Used by npm run-script typecheck-js | ||
*/ | ||
/* Visit https://aka.ms/tsconfig to read more about tsconfig configuration. */ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
/* All JavaScript targets from tsconfig.json include. */ | ||
"*.js", | ||
"*.mjs", | ||
"lib/**/*.js" | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,47 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": [ | ||
"es6" | ||
], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"types": [ | ||
"node", | ||
"jest" | ||
], | ||
"esModuleInterop": true, // Mainly so can test an import problem which only occurs with this option on! | ||
"noEmit": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": ["**/*.ts"], | ||
/* | ||
TypeScript is being used to do type checking across both JavaScript and TypeScript files. | ||
In particular, this picks up some problems in the JSDoc in the JavaScript files, and validates the code | ||
is consistent with the JSDoc. | ||
The settings here are used by VSCode. | ||
See also tsconfig.js.json and tsconfig.ts.json. | ||
*/ | ||
/* Visit https://aka.ms/tsconfig to read more about tsconfig configuration. */ | ||
"compilerOptions": { | ||
"lib": ["es2021"], | ||
"module": "node16", | ||
"target": "es2021", | ||
|
||
"allowJs": true, | ||
"checkJs": true, | ||
|
||
/* Strict by default, but dial it down to reduce churn in our JavaScript code. */ | ||
"strict": true, | ||
"noImplicitAny": false, | ||
"strictNullChecks": false, | ||
"useUnknownInCatchVariables": false, | ||
|
||
"types": [ | ||
"node", | ||
"jest" | ||
], | ||
"noEmit": true, /* just type checking and not emitting transpiled files */ | ||
"skipLibCheck": false, /* we want to check our hand crafted definitions */ | ||
"forceConsistentCasingInFileNames": true, | ||
"esModuleInterop": true /* common TypeScript config */ | ||
}, | ||
"include": [ | ||
/* JavaScript. Should match includes in tsconfig.js.json. */ | ||
"*.js", | ||
"*.mjs", | ||
"lib/**/*.js", | ||
/* TypeScript. Should match includes in tsconfig.ts.json. */ | ||
"**/*.ts", | ||
"**/*.mts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ /* | ||
Override to include just TypeScript files and use stricter settings than we do with JavaScript. | ||
Used by: | ||
- npm run-script typecheck-ts | ||
- eslint | ||
*/ | ||
/* Visit https://aka.ms/tsconfig to read more about tsconfig configuration. */ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
/* Full strict is fine for the TypeScript files, so turn back on the checks we turned off for mixed-use. */ | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"useUnknownInCatchVariables": true, | ||
}, | ||
"include": [ | ||
/* All TypeScript targets from tsconfig.json include. */ | ||
"**/*.ts", | ||
"**/*.mts" | ||
], | ||
} |