2017-05-28 00:38:50 +02:00
|
|
|
import * as ts from "typescript";
|
|
|
|
import { findConfiguration, findConfigurationPath, getRulesDirectories, IConfigurationFile, loadConfigurationFromPath } from "./configuration";
|
|
|
|
import { ILinterOptions, LintResult } from "./index";
|
|
|
|
import { RuleFailure } from "./language/rule/rule";
|
|
|
|
/**
|
|
|
|
* Linter that can lint multiple files in consecutive runs.
|
|
|
|
*/
|
|
|
|
declare class Linter {
|
|
|
|
private options;
|
|
|
|
private program;
|
|
|
|
static VERSION: string;
|
|
|
|
static findConfiguration: typeof findConfiguration;
|
|
|
|
static findConfigurationPath: typeof findConfigurationPath;
|
|
|
|
static getRulesDirectories: typeof getRulesDirectories;
|
|
|
|
static loadConfigurationFromPath: typeof loadConfigurationFromPath;
|
|
|
|
private failures;
|
|
|
|
private fixes;
|
|
|
|
/**
|
|
|
|
* Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
|
|
|
|
*/
|
|
|
|
static createProgram(configFile: string, projectDirectory?: string): ts.Program;
|
|
|
|
/**
|
|
|
|
* Returns a list of source file names from a TypeScript program. This includes all referenced
|
|
|
|
* files and excludes declaration (".d.ts") files.
|
|
|
|
*/
|
|
|
|
static getFileNames(program: ts.Program): string[];
|
2017-08-14 05:01:11 +02:00
|
|
|
constructor(options: ILinterOptions, program?: ts.Program | undefined);
|
2017-05-28 00:38:50 +02:00
|
|
|
lint(fileName: string, source: string, configuration?: IConfigurationFile): void;
|
|
|
|
getResult(): LintResult;
|
|
|
|
private getAllFailures(sourceFile, enabledRules);
|
|
|
|
private applyAllFixes(enabledRules, fileFailures, sourceFile, sourceFileName);
|
|
|
|
protected applyFixes(sourceFilePath: string, source: string, fixableFailures: RuleFailure[]): string;
|
2017-08-14 05:01:11 +02:00
|
|
|
private updateProgram(sourceFilePath);
|
2017-05-28 00:38:50 +02:00
|
|
|
private applyRule(rule, sourceFile);
|
|
|
|
private getEnabledRules(configuration, isJs);
|
|
|
|
private getSourceFile(fileName, source);
|
|
|
|
}
|
|
|
|
declare namespace Linter {
|
|
|
|
}
|
|
|
|
export = Linter;
|