Fix "semicolon" lint rule options (was not enabled)

This commit is contained in:
Andy Hanson 2017-02-10 12:24:10 -08:00
parent 2fc634f460
commit 91421c8dbc
19 changed files with 32 additions and 34 deletions

View file

@ -19760,7 +19760,7 @@ namespace ts {
}
if (potentialNewTargetCollisions.length) {
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope)
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope);
potentialNewTargetCollisions.length = 0;
}

View file

@ -84,7 +84,7 @@ namespace ts {
this.index++;
return { value: this.selector(this.data, this.keys[index]), done: false };
}
return { value: undefined as never, done: true }
return { value: undefined as never, done: true };
}
}
@ -140,7 +140,7 @@ namespace ts {
action(this.data[key], key);
}
}
}
};
}
export function createFileMap<T>(keyMapper?: (key: string) => string): FileMap<T> {

View file

@ -958,7 +958,7 @@ namespace ts {
const result = cache && cache.get(containingDirectory);
if (result) {
if (traceEnabled) {
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName)
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
}
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } };
}

View file

@ -2581,7 +2581,7 @@ namespace ts {
if (loopOutParameters.length) {
copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements);
}
addRange(statements, lexicalEnvironment)
addRange(statements, lexicalEnvironment);
loopBody = createBlock(statements, /*multiline*/ true);
}

View file

@ -571,7 +571,7 @@ namespace FourSlash {
}
private getGoToDefinition(): ts.DefinitionInfo[] {
return this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition)
return this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
}
public verifyGoToType(arg0: any, endMarkerNames?: string | string[]) {
@ -912,7 +912,7 @@ namespace FourSlash {
function rangeToReferenceEntry(r: Range) {
let { isWriteAccess, isDefinition } = (r.marker && r.marker.data) || { isWriteAccess: false, isDefinition: false };
isWriteAccess = !!isWriteAccess; isDefinition = !!isDefinition;
return { fileName: r.fileName, textSpan: { start: r.start, length: r.end - r.start }, isWriteAccess, isDefinition }
return { fileName: r.fileName, textSpan: { start: r.start, length: r.end - r.start }, isWriteAccess, isDefinition };
}
}

View file

@ -44,7 +44,7 @@ declare namespace NodeJS {
declare var window: {};
declare var XMLHttpRequest: {
new(): XMLHttpRequest;
}
};
interface XMLHttpRequest {
readonly readyState: number;
readonly responseText: string;

View file

@ -495,7 +495,7 @@ namespace ts.projectSystem {
const emitOutput = host.readFile(path + ".js");
assert.equal(emitOutput, f.content + newLine, "content of emit output should be identical with the input + newline");
}
})
});
it("should emit specified file", () => {
const file1 = {

View file

@ -9,7 +9,7 @@ namespace ts {
Harness.Baseline.runBaseline(`printerApi/${prefix}.${name}.js`, () =>
printCallback(createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed, ...options })));
});
}
};
}
describe("printFile", () => {

View file

@ -65,6 +65,6 @@ namespace ts.textStorage {
ts1.getLineInfo(0);
assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 2");
})
});
});
}

View file

@ -600,7 +600,7 @@ namespace ts.projectSystem {
checkProjectActualFiles(service.configuredProjects[0], []);
checkProjectActualFiles(service.inferredProjects[0], [f1.path]);
})
});
it("create configured project without file list", () => {
const configFile: FileOrFolder = {
@ -1153,7 +1153,7 @@ namespace ts.projectSystem {
const host = createServerHost([f1, f2, libFile]);
const service = createProjectService(host);
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: toExternalFiles([f1.path, f2.path]), options: {} })
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: toExternalFiles([f1.path, f2.path]), options: {} });
service.openClientFile(f1.path);
service.openClientFile(f2.path, "let x: string");
@ -1185,7 +1185,7 @@ namespace ts.projectSystem {
const host = createServerHost([f1, f2, libFile]);
const service = createProjectService(host);
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: [{ fileName: f1.path }, { fileName: f2.path, hasMixedContent: true }], options: {} })
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: [{ fileName: f1.path }, { fileName: f2.path, hasMixedContent: true }], options: {} });
service.openClientFile(f1.path);
service.openClientFile(f2.path, "let somelongname: string");
@ -1868,7 +1868,7 @@ namespace ts.projectSystem {
for (const f of [f2, f3]) {
const scriptInfo = projectService.getScriptInfoForNormalizedPath(server.toNormalizedPath(f.path));
assert.equal(scriptInfo.containingProjects.length, 0, `expect 0 containing projects for '${f.path}'`)
assert.equal(scriptInfo.containingProjects.length, 0, `expect 0 containing projects for '${f.path}'`);
}
});
@ -1984,7 +1984,7 @@ namespace ts.projectSystem {
projectFileName,
rootFiles: [toExternalFile(f1.path)],
options: {}
})
});
projectService.openClientFile(f1.path, "let x = 1;\nlet y = 2;");
projectService.checkNumberOfProjects({ externalProjects: 1 });

View file

@ -56,7 +56,7 @@ namespace ts.projectSystem {
path: "/a/config.js",
content: "export let x = 1"
};
const typesCache = "/cache"
const typesCache = "/cache";
const typesConfig = {
path: typesCache + "/node_modules/@types/config/index.d.ts",
content: "export let y: number;"
@ -74,7 +74,7 @@ namespace ts.projectSystem {
super(host, { typesRegistry: createTypesRegistry("config"), globalTypingsCacheLocation: typesCache });
}
installWorker(_requestId: number, _args: string[], _cwd: string, _cb: server.typingsInstaller.RequestCompletedAction) {
assert(false, "should not be called")
assert(false, "should not be called");
}
})();
const service = createProjectService(host, { typingsInstaller: installer });

View file

@ -140,7 +140,7 @@ namespace ts.server {
getScriptKind: _ => undefined,
hasMixedContent: (fileName, extraFileExtensions) => {
const mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, item => item.isMixedContent), item => item.extension);
return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension))
return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension));
}
};
@ -1377,7 +1377,7 @@ namespace ts.server {
// close projects that were missing in the input list
forEachKey(projectsToClose, externalProjectName => {
this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true)
this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true);
});
this.refreshInferredProjects();

View file

@ -689,7 +689,7 @@ namespace ts.server {
const fileName = resolvedTypeReferenceDirective.resolvedFileName;
const typeFilePath = toPath(fileName, currentDirectory, getCanonicalFileName);
referencedFiles.set(typeFilePath, true);
})
});
}
const allFileNames = arrayFrom(referencedFiles.keys()) as Path[];
@ -711,7 +711,7 @@ namespace ts.server {
const id = nextId;
nextId++;
return makeInferredProjectName(id);
}
};
})();
private _isJsInferredProject = false;

View file

@ -48,7 +48,7 @@ namespace ts.server {
public reloadFromFile(tempFileName?: string) {
if (this.svc || (tempFileName !== this.fileName)) {
this.reload(this.getFileText(tempFileName))
this.reload(this.getFileText(tempFileName));
}
else {
this.setText(undefined);

View file

@ -46,14 +46,14 @@ namespace ts.server {
if (process.env.XDG_CACHE_HOME) {
return process.env.XDG_CACHE_HOME;
}
const usersDir = platformIsDarwin ? "Users" : "home"
const usersDir = platformIsDarwin ? "Users" : "home";
const homePath = (os.homedir && os.homedir()) ||
process.env.HOME ||
((process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}`) ||
os.tmpdir();
const cacheFolder = platformIsDarwin
? "Library/Caches"
: ".cache"
: ".cache";
return combinePaths(normalizeSlashes(homePath), cacheFolder);
}

View file

@ -61,9 +61,7 @@ namespace ts.server.typingsInstaller {
return combinePaths(normalizeSlashes(globalTypingsCacheLocation), `node_modules/${TypesRegistryPackageName}/index.json`);
}
type ExecSync = {
(command: string, options: { cwd: string, stdio?: "ignore" }): any
}
type ExecSync = (command: string, options: { cwd: string, stdio?: "ignore" }) => any;
export class NodeTypingsInstaller extends TypingsInstaller {
private readonly execSync: ExecSync;

View file

@ -3,8 +3,8 @@ namespace ts.codefix {
type ImportCodeActionKind = "CodeChange" | "InsertingIntoExistingImport" | "NewImport";
interface ImportCodeAction extends CodeAction {
kind: ImportCodeActionKind,
moduleSpecifier?: string
kind: ImportCodeActionKind;
moduleSpecifier?: string;
}
enum ModuleSpecifierComparison {
@ -75,7 +75,7 @@ namespace ts.codefix {
getAllActions() {
let result: ImportCodeAction[] = [];
for (const key in this.symbolIdToActionMap) {
result = concatenate(result, this.symbolIdToActionMap[key])
result = concatenate(result, this.symbolIdToActionMap[key]);
}
return result;
}

View file

@ -414,7 +414,7 @@ namespace ts.FindAllReferences {
name,
textSpan: createTextSpan(0, 1),
displayParts: [{ text: name, kind: ScriptElementKind.keyword }]
}
};
const references: ReferenceEntry[] = [];
for (const sourceFile of sourceFiles) {
cancellationToken.throwIfCancellationRequested();
@ -610,7 +610,7 @@ namespace ts.FindAllReferences {
const result: Node[] = [];
for (const decl of classSymbol.members.get("__constructor").declarations) {
const ctrKeyword = ts.findChildOfKind(decl, ts.SyntaxKind.ConstructorKeyword, sourceFile)!
const ctrKeyword = ts.findChildOfKind(decl, ts.SyntaxKind.ConstructorKeyword, sourceFile)!;
Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword);
result.push(ctrKeyword);
}

View file

@ -17,7 +17,7 @@
"double",
"avoid-escape"
],
"semicolon": [true, "ignore-bound-class-methods"],
"semicolon": [true, "always", "ignore-bound-class-methods"],
"whitespace": [true,
"check-branch",
"check-decl",