UNPKG

622 BPlain TextView Raw
1import { ILinterOptions, Linter, LintResult } from 'tslint';
2import { Program, SourceFile } from 'typescript';
3
4// We need to access the program, but Linter has private program already
5// eslint-disable-next-line @typescript-eslint/no-explicit-any
6const TSLintLinter = Linter as any;
7
8export class CustomLinter extends TSLintLinter {
9 constructor(options: ILinterOptions, private readonly program: Program) {
10 super(options, program);
11 }
12
13 getResult(): LintResult {
14 return super.getResult();
15 }
16
17 getSourceFile(fileName: string): SourceFile | undefined {
18 return this.program.getSourceFile(fileName);
19 }
20}