File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 18
18
" typescript" ,
19
19
" verify"
20
20
],
21
- "version" : " 1.0.1 " ,
21
+ "version" : " 1.1.0 " ,
22
22
"main" : " dist/index.js" ,
23
23
"bin" : " ./dist/bin/compile-typescript-docs.js" ,
24
24
"license" : " Apache-2.0" ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class CodeBlockExtractor {
22
22
23
23
private static extractCodeBlocksFromMarkdown ( markdown : string ) : string [ ] {
24
24
const codeBlocks : string [ ] = [ ]
25
- markdown . replace ( this . TYPESCRIPT_CODE_PATTERN , ( fullMatch , code ) => {
25
+ markdown . replace ( this . TYPESCRIPT_CODE_PATTERN , ( _ , code ) => {
26
26
codeBlocks . push ( code )
27
27
return code
28
28
} )
Original file line number Diff line number Diff line change @@ -25,10 +25,20 @@ export class SnippetCompiler {
25
25
private readonly runner : TypeScriptRunner
26
26
27
27
constructor ( private readonly workingDirectory : string ) {
28
- const configOptions = tsconfig . loadSync ( process . cwd ( ) )
28
+ const configOptions = SnippetCompiler . loadTypeScriptConfig ( )
29
29
this . runner = new TypeScriptRunner ( this . workingDirectory , configOptions . config )
30
30
}
31
31
32
+ private static loadTypeScriptConfig ( ) : any {
33
+ const typeScriptConfig = tsconfig . loadSync ( process . cwd ( ) )
34
+ if ( typeScriptConfig &&
35
+ typeScriptConfig . config &&
36
+ typeScriptConfig . config . compilerOptions ) {
37
+ typeScriptConfig . config . compilerOptions . noUnusedLocals = false
38
+ }
39
+ return typeScriptConfig
40
+ }
41
+
32
42
compileSnippets ( documentationFiles : string [ ] ) : Bluebird < SnippetCompilationResult [ ] > {
33
43
return Bluebird . resolve ( )
34
44
. then ( ( ) => this . cleanWorkingDirectory ( ) )
Original file line number Diff line number Diff line change 28
28
"alwaysStrict" : true , /* Parse in strict mode and emit "use strict" for each source file. */
29
29
30
30
/* Additional Checks */
31
- // "noUnusedLocals": true, /* Report errors on unused locals. */
32
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
31
+ "noUnusedLocals" : true , /* Report errors on unused locals. */
32
+ "noUnusedParameters" : true , /* Report errors on unused parameters. */
33
33
"noImplicitReturns" : true , /* Report error when not all code paths in function return a value. */
34
34
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
35
35
You can’t perform that action at this time.
0 commit comments