-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor type-checking setup #1969
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
af75f13
Refactor type-checking setup
shadowspawn 8c72994
Refactor tsconfig particularly to enable loose check in VSCode, stric…
shadowspawn d2e9cbe
Simplify includes for tsconfig
shadowspawn 7e33546
Explicitly separate the tsconfig for use with npm run-scripts
shadowspawn caf721c
Improve comment
shadowspawn b4f4a03
Resolved couple of work-in-progress comments
shadowspawn de951f4
Update tsconfig to recommended node16 lib/module/target
shadowspawn d4abb89
Make checks strict by default and opt-out
shadowspawn 43e3881
Restore broken code to merge later changes
shadowspawn d1e73ce
Merge branch 'develop' into feature/type-checking
shadowspawn 91664de
Updates after merge
shadowspawn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" | ||
], | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
typecheck:ts
instead oftypecheck-ts
?We already use
lint:typescript
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been following a pattern I saw and liked long ago, but it is arbitrary. I use the colon for sub-scripts which are the parts of a combo script. So
lint:typescript
is one part oflint
.