/
TSLintTask.ts
47 lines (44 loc) · 1.04 KB
/
TSLintTask.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { BaseExecTask } from './BaseExecTask';
import { BuildUtils } from './BuildUtils';
/**
* @beta
*/
// tslint:disable-next-line: interface-name
export interface TSLintConfig {
file?: string;
config?: string;
exclude?: string[];
fix?: boolean;
force?: boolean;
init?: boolean;
out?: string;
outputAbsolutePaths?: boolean;
'rules-dir'?: string;
'formatters-dir'?: string;
format?: string;
quiet?: boolean;
test?: boolean;
project?: string;
}
/**
* @beta
*/
export class TSLintTask extends BaseExecTask<TSLintConfig> {
public constructor(packageName?: string) {
super('tslint', 'cutwater-tslint', { file: 'src/**/*.ts' }, false, 'file');
if (packageName) {
this.setConfig({
format: 'junit',
out: `../../reports/junit/${BuildUtils.toSimplePackageName(
packageName
)}-lint-results.xml`
});
}
}
public executeTask(): Promise<void> {
if (this.taskConfig.out) {
BuildUtils.createFilePath(this.taskConfig.out);
}
return super.executeTask();
}
}