Skip to content

Commit

Permalink
Use latest compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya committed Aug 21, 2015
1 parent 0a9e4a5 commit 0ef6f4b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/language/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Lint {
const compilerOptions = createCompilerOptions();

const compilerHost: ts.CompilerHost = {
fileExists: () => true,
getCanonicalFileName: (filename: string) => filename,
getCurrentDirectory: () => "",
getDefaultLibFileName: () => "lib.d.ts",
Expand All @@ -31,6 +32,7 @@ module Lint {
return ts.createSourceFile(filenameToGet, source, compilerOptions.target, true);
}
},
readFile: () => null,
useCaseSensitiveFileNames: () => true,
writeFile: () => null
};
Expand Down
1 change: 0 additions & 1 deletion src/rules/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"../../lib/tslint.d.ts",
"../../typings/node.d.ts",
"../../typings/typescriptServices.d.ts",
"../../typings/typescriptServicesScanner.d.ts",
"./alignRule.ts",
"./banRule.ts",
"./classNameRule.ts",
Expand Down
1 change: 0 additions & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"files": [
"../typings/node.d.ts",
"../typings/typescriptServices.d.ts",
"../typings/typescriptServicesScanner.d.ts",
"./language/walker/syntaxWalker.ts",
"./language/walker/ruleWalker.ts",
"./language/walker/scopeAwareRuleWalker.ts",
Expand Down
32 changes: 27 additions & 5 deletions typings/typescriptServices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare namespace ts {
contains(fileName: string): boolean;
remove(fileName: string): void;
forEachValue(f: (v: T) => void): void;
clear(): void;
}
interface TextRange {
pos: number;
Expand Down Expand Up @@ -945,7 +946,7 @@ declare namespace ts {
getSourceFile(fileName: string): SourceFile;
getCurrentDirectory(): string;
}
interface ParseConfigHost {
interface ParseConfigHost extends ModuleResolutionHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
}
interface WriteFileCallback {
Expand All @@ -959,6 +960,10 @@ declare namespace ts {
throwIfCancellationRequested(): void;
}
interface Program extends ScriptReferenceHost {
/**
* Get a list of root file names that were passed to a 'createProgram'
*/
getRootFileNames(): string[];
/**
* Get a list of files in the program
*/
Expand Down Expand Up @@ -1368,7 +1373,16 @@ declare namespace ts {
fileNames: string[];
errors: Diagnostic[];
}
interface CompilerHost {
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
readFile(fileName: string): string;
}
interface ResolvedModule {
resolvedFileName: string;
failedLookupLocations: string[];
}
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
getCancellationToken?(): CancellationToken;
getDefaultLibFileName(options: CompilerOptions): string;
Expand All @@ -1377,6 +1391,7 @@ declare namespace ts {
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
}
interface TextSpan {
start: number;
Expand Down Expand Up @@ -1454,6 +1469,7 @@ declare namespace ts {
function getShebang(text: string): string;
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare namespace ts {
function getDefaultLibFileName(options: CompilerOptions): string;
Expand Down Expand Up @@ -1493,13 +1509,14 @@ declare namespace ts {
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
declare namespace ts {
/** The version of the TypeScript compiler release */
const version: string;
function findConfigFile(searchPath: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare namespace ts {
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
Expand Down Expand Up @@ -1605,6 +1622,7 @@ declare namespace ts {
interface PreProcessedFileInfo {
referencedFiles: FileReference[];
importedFiles: FileReference[];
ambientExternalModules: string[];
isLibFile: boolean;
}
interface HostCancellationToken {
Expand All @@ -1625,6 +1643,7 @@ declare namespace ts {
trace?(s: string): void;
error?(s: string): void;
useCaseSensitiveFileNames?(): boolean;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
}
interface LanguageService {
cleanupSemanticCache(): void;
Expand Down Expand Up @@ -1755,6 +1774,7 @@ declare namespace ts {
InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
Expand Down Expand Up @@ -2089,17 +2109,19 @@ declare namespace ts {
fileName?: string;
reportDiagnostics?: boolean;
moduleName?: string;
renamedDependencies?: Map<string>;
}
interface TranspileOutput {
outputText: string;
diagnostics?: Diagnostic[];
sourceMapText?: string;
}
function transpileModule(input: string, transpileOptions?: TranspileOptions): TranspileOutput;
function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput;
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
let disableIncrementalParsing: boolean;
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
Expand Down
6 changes: 0 additions & 6 deletions typings/typescriptServicesScanner.d.ts

This file was deleted.

0 comments on commit 0ef6f4b

Please sign in to comment.