rule.d.ts
2.52 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import * as ts from "typescript";
import { RuleWalker } from "../walker/ruleWalker";
export interface IRuleMetadata {
ruleName: string;
type: RuleType;
description: string;
descriptionDetails?: string;
optionsDescription?: string;
options: any;
optionExamples?: string[];
rationale?: string;
requiresTypeInfo?: boolean;
}
export declare type RuleType = "functionality" | "maintainability" | "style" | "typescript";
export interface IOptions {
ruleArguments?: any[];
ruleName: string;
disabledIntervals: IDisabledInterval[];
}
export interface IDisabledInterval {
startPosition: number;
endPosition: number;
}
export interface IRule {
getOptions(): IOptions;
isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): RuleFailure[];
applyWithWalker(walker: RuleWalker): RuleFailure[];
}
export declare class Replacement {
private innerStart;
private innerLength;
private innerText;
static applyAll(content: string, replacements: Replacement[]): string;
constructor(innerStart: number, innerLength: number, innerText: string);
start: number;
length: number;
end: number;
text: string;
apply(content: string): string;
}
export declare class Fix {
private innerRuleName;
private innerReplacements;
static applyAll(content: string, fixes: Fix[]): string;
constructor(innerRuleName: string, innerReplacements: Replacement[]);
ruleName: string;
replacements: Replacement[];
apply(content: string): string;
}
export declare class RuleFailurePosition {
private position;
private lineAndCharacter;
constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
getPosition(): number;
getLineAndCharacter(): ts.LineAndCharacter;
toJson(): {
character: number;
line: number;
position: number;
};
equals(ruleFailurePosition: RuleFailurePosition): boolean;
}
export declare class RuleFailure {
private sourceFile;
private failure;
private ruleName;
private fix;
private fileName;
private startPosition;
private endPosition;
constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string, fix?: Fix);
getFileName(): string;
getRuleName(): string;
getStartPosition(): RuleFailurePosition;
getEndPosition(): RuleFailurePosition;
getFailure(): string;
hasFix(): boolean;
getFix(): Fix;
toJson(): any;
equals(ruleFailure: RuleFailure): boolean;
private createFailurePosition(position);
}