@@ -16,49 +16,49 @@ import { knipToCpReport } from './utils';
16
16
*
17
17
*/
18
18
export const knipReporter = async ( knipReporterOptions : ReporterOptions ) => {
19
- const { options, report, issues } = knipReporterOptions ;
20
- const customReporterOptions = parseCustomReporterOptions ( options ) ;
21
- const {
22
- verbose,
23
- outputFile = KNIP_REPORT_NAME ,
19
+ const { options, report, issues } = knipReporterOptions ;
20
+ const customReporterOptions = parseCustomReporterOptions ( options ) ;
21
+ const {
22
+ verbose,
23
+ outputFile = KNIP_REPORT_NAME ,
24
+ rawOutputFile,
25
+ } = customReporterOptions ;
26
+ if ( verbose ) {
27
+ ui ( ) . logger . info (
28
+ `Reporter called with options: ${ JSON . stringify (
29
+ customReporterOptions ,
30
+ null ,
31
+ 2 ,
32
+ ) } `,
33
+ ) ;
34
+ }
35
+ if ( rawOutputFile != null ) {
36
+ await ensureDirectoryExists ( dirname ( rawOutputFile ) ) ;
37
+ await writeFile (
24
38
rawOutputFile ,
25
- } = customReporterOptions ;
26
- if ( verbose ) {
27
- ui ( ) . logger . info (
28
- `Reporter called with options: ${ JSON . stringify (
29
- customReporterOptions ,
30
- null ,
31
- 2 ,
32
- ) } `,
33
- ) ;
34
- }
35
- if ( rawOutputFile != null ) {
36
- await ensureDirectoryExists ( dirname ( rawOutputFile ) ) ;
37
- await writeFile (
38
- rawOutputFile ,
39
- JSON . stringify (
40
- {
41
- ...knipReporterOptions ,
42
- issues : {
43
- ...issues ,
44
- files : [ ...issues . files ] , // files is a Set<string>
45
- } ,
46
- options : customReporterOptions ,
39
+ JSON . stringify (
40
+ {
41
+ ...knipReporterOptions ,
42
+ issues : {
43
+ ...issues ,
44
+ files : [ ...issues . files ] , // files is a Set<string>
47
45
} ,
48
- null ,
49
- 2 ,
50
- ) ,
51
- ) ;
52
- if ( verbose ) {
53
- ui ( ) . logger . info ( `Saved raw report to ${ rawOutputFile } ` ) ;
54
- }
46
+ options : customReporterOptions ,
47
+ } ,
48
+ null ,
49
+ 2 ,
50
+ ) ,
51
+ ) ;
52
+ if ( verbose ) {
53
+ ui ( ) . logger . info ( `Saved raw report to ${ rawOutputFile } ` ) ;
55
54
}
55
+ }
56
56
57
- const result = await knipToCpReport ( { issues, report } ) ;
57
+ const result = await knipToCpReport ( { issues, report } ) ;
58
58
59
- await ensureDirectoryExists ( dirname ( outputFile ) ) ;
60
- await writeFile ( outputFile , JSON . stringify ( result , null , 2 ) ) ;
61
- if ( verbose ) {
62
- ui ( ) . logger . info ( `Saved report to ${ outputFile } ` ) ;
63
- }
59
+ await ensureDirectoryExists ( dirname ( outputFile ) ) ;
60
+ await writeFile ( outputFile , JSON . stringify ( result , null , 2 ) ) ;
61
+ if ( verbose ) {
62
+ ui ( ) . logger . info ( `Saved report to ${ outputFile } ` ) ;
63
+ }
64
64
} ;
0 commit comments