linter.d.ts 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import * as ts from "typescript";
  2. import { findConfiguration, findConfigurationPath, getRulesDirectories, IConfigurationFile, loadConfigurationFromPath } from "./configuration";
  3. import { ILinterOptions, LintResult } from "./index";
  4. import { RuleFailure } from "./language/rule/rule";
  5. /**
  6. * Linter that can lint multiple files in consecutive runs.
  7. */
  8. export declare class Linter {
  9. private readonly options;
  10. private program;
  11. static VERSION: string;
  12. static findConfiguration: typeof findConfiguration;
  13. static findConfigurationPath: typeof findConfigurationPath;
  14. static getRulesDirectories: typeof getRulesDirectories;
  15. static loadConfigurationFromPath: typeof loadConfigurationFromPath;
  16. private failures;
  17. private fixes;
  18. /**
  19. * Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
  20. */
  21. static createProgram(configFile: string, projectDirectory?: string): ts.Program;
  22. /**
  23. * Returns a list of source file names from a TypeScript program. This includes all referenced
  24. * files and excludes declaration (".d.ts") files.
  25. */
  26. static getFileNames(program: ts.Program): string[];
  27. constructor(options: ILinterOptions, program?: ts.Program | undefined);
  28. lint(fileName: string, source: string, configuration?: IConfigurationFile): void;
  29. getResult(): LintResult;
  30. private getAllFailures(sourceFile, enabledRules);
  31. private applyAllFixes(enabledRules, fileFailures, sourceFile, sourceFileName);
  32. protected applyFixes(sourceFilePath: string, source: string, fixableFailures: RuleFailure[]): string;
  33. private updateProgram(sourceFilePath);
  34. private applyRule(rule, sourceFile);
  35. private getEnabledRules(configuration, isJs);
  36. private getSourceFile(fileName, source);
  37. }