@@ -3,6 +3,13 @@ import remark from "remark";
3
3
import remarkHTML from "remark-html" ;
4
4
import ts from "typescript" ;
5
5
6
+ declare module "typescript" {
7
+ const optionDeclarations : CommandLineOption [ ] ;
8
+ const optionsForWatch : CommandLineOption [ ] ;
9
+ const typeAcquisitionDeclarations : CommandLineOption [ ] ;
10
+ const defaultInitCompilerOptions : ts . CompilerOptions ;
11
+ }
12
+
6
13
export interface CommandLineOption {
7
14
name : string ;
8
15
type :
@@ -14,15 +21,10 @@ export interface CommandLineOption {
14
21
| Map < string , number | string > ;
15
22
defaultValueDescription ?: string | number | boolean | ts . DiagnosticMessage ;
16
23
category ?: ts . DiagnosticMessage ;
24
+ strictFlag ?: true ;
17
25
element : CommandLineOption ;
18
26
}
19
27
20
- declare module "typescript" {
21
- const optionDeclarations : CommandLineOption [ ] ;
22
- const optionsForWatch : CommandLineOption [ ] ;
23
- const typeAcquisitionDeclarations : CommandLineOption [ ] ;
24
- }
25
-
26
28
/**
27
29
* Changes to these rules should be reflected in the following files:
28
30
* https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/tsconfig.json
@@ -72,18 +74,17 @@ export const buildOptionCompilerOptNames: string[] = ts.buildOpts
72
74
export const rootOptNames = [ "files" , "extends" , "include" , "exclude" , "references" ] ;
73
75
74
76
/** You should use this! They are off by default */
75
- export const recommended : CompilerOptionName [ ] = [
76
- "strict" ,
77
- "forceConsistentCasingInFileNames" ,
78
- "alwaysStrict" ,
79
- "strictNullChecks" ,
80
- "strictBindCallApply" ,
81
- "strictFunctionTypes" ,
82
- "strictPropertyInitialization" ,
83
- "noImplicitThis" ,
84
- "noImplicitAny" ,
85
- "esModuleInterop" ,
86
- "skipLibCheck" ,
77
+ export const recommended = [
78
+ // Options enabled by --init
79
+ ...Object . entries ( ts . defaultInitCompilerOptions )
80
+ . filter ( ( [ , value ] ) => value === true )
81
+ . map ( ( [ name ] ) => name ) ,
82
+ // Options enabled by --strict
83
+ ...ts . optionDeclarations
84
+ . filter ( ( option ) => option . strictFlag )
85
+ . map ( ( option ) => option . name ) ,
86
+ // Not included in --init yet:
87
+ // https://github.com/microsoft/TypeScript/issues/44524#:~:text=--init%20should%20include%20it%20once%20the%20ecosystem%20catches%20up.
87
88
"exactOptionalPropertyTypes" ,
88
89
] ;
89
90
0 commit comments