Merge pull request #15021 from RyanCavanaugh/lintFixes

Update linting to avoid typechecking for booleanTriviaRule
This commit is contained in:
Ryan Cavanaugh
2017-04-05 12:26:58 -07:00
committed by GitHub
28 changed files with 95 additions and 108 deletions
+4 -4
View File
@@ -9709,7 +9709,7 @@ namespace ts {
const original = getTypeOfSymbol(property);
const updated = f(original);
members.set(property.name, updated === original ? property : createSymbolWithType(property, updated));
};
}
return members;
}
@@ -9753,7 +9753,7 @@ namespace ts {
// Since get accessors already widen their return value there is no need to
// widen accessor based properties here.
members.set(prop.name, prop.flags & SymbolFlags.Property ? getWidenedProperty(prop) : prop);
};
}
const stringIndexInfo = getIndexInfoOfType(type, IndexKind.String);
const numberIndexInfo = getIndexInfoOfType(type, IndexKind.Number);
return createAnonymousType(type.symbol, members, emptyArray, emptyArray,
@@ -15129,7 +15129,7 @@ namespace ts {
if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) {
break;
}
const index = excludeArgument ? indexOf(excludeArgument, true) : -1;
const index = excludeArgument ? indexOf(excludeArgument, /*value*/ true) : -1;
if (index < 0) {
return candidate;
}
@@ -18757,7 +18757,7 @@ namespace ts {
case SyntaxKind.ConstructorType:
checkUnusedTypeParameters(<FunctionLikeDeclaration>node);
break;
};
}
}
}
}
+1 -1
View File
@@ -1580,7 +1580,7 @@ namespace ts {
delete wildcardDirectories[key];
}
}
};
}
}
return wildcardDirectories;
+1 -1
View File
@@ -590,7 +590,7 @@ namespace ts {
currentIdentifiers = node.identifiers;
isCurrentFileExternalModule = isExternalModule(node);
enclosingDeclaration = node;
emitDetachedComments(currentText, currentLineMap, writer, writeCommentRange, node, newLine, true /* remove comments */);
emitDetachedComments(currentText, currentLineMap, writer, writeCommentRange, node, newLine, /*removeComents*/ true);
emitLines(node.statements);
}
+1 -1
View File
@@ -1845,7 +1845,7 @@ namespace ts {
case ParsingContext.JSDocTupleTypes: return Diagnostics.Type_expected;
case ParsingContext.JSDocRecordMembers: return Diagnostics.Property_assignment_expected;
}
};
}
// Parses a comma-delimited list of elements
function parseDelimitedList<T extends Node>(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray<T> {
+6 -6
View File
@@ -54,10 +54,10 @@ namespace ts {
referenceCount: number;
}
declare var require: any;
declare var process: any;
declare var global: any;
declare var __filename: string;
declare const require: any;
declare const process: any;
declare const global: any;
declare const __filename: string;
export function getNodeMajorVersion() {
if (typeof process === "undefined") {
@@ -74,7 +74,7 @@ namespace ts {
return parseInt(version.substring(1, dot));
}
declare var ChakraHost: {
declare const ChakraHost: {
args: string[];
currentDirectory: string;
executingFile: string;
@@ -368,7 +368,7 @@ namespace ts {
if (eventName === "rename") {
// When deleting a file, the passed baseFileName is null
callback(!relativeFileName ? relativeFileName : normalizePath(combinePaths(directoryName, relativeFileName)));
};
}
}
);
},
+2 -2
View File
@@ -1162,7 +1162,7 @@ namespace ts {
statement = createStatement(
createExportExpression(
createIdentifier("__esModule"),
createLiteral(true)
createLiteral(/*value*/ true)
)
);
}
@@ -1175,7 +1175,7 @@ namespace ts {
createIdentifier("exports"),
createLiteral("__esModule"),
createObjectLiteral([
createPropertyAssignment("value", createLiteral(true))
createPropertyAssignment("value", createLiteral(/*value*/ true))
])
]
)
+1 -1
View File
@@ -336,7 +336,7 @@ namespace ts {
// is an absolute file name.
directory == "" ? "." : directory,
watchedDirectoryChanged, /*recursive*/ true);
};
}
}
return configParseResult;
}
+1 -1
View File
@@ -51,7 +51,7 @@ class CompilerBaselineRunner extends RunnerBase {
const path = ts.toPath(name, root, (fileName) => Harness.Compiler.getCanonicalFileName(fileName));
const pathStart = ts.toPath(Harness.IO.getCurrentDirectory(), "", (fileName) => Harness.Compiler.getCanonicalFileName(fileName));
return pathStart ? path.replace(pathStart, "/") : path;
};
}
public checkTestCodeOutput(fileName: string) {
describe("compiler tests for " + fileName, () => {
+1 -1
View File
@@ -1694,7 +1694,7 @@ namespace FourSlash {
if (ch === "\r") {
this.currentCaretPosition--;
}
};
}
}
private applyEdits(fileName: string, edits: ts.TextChange[], isFormattingEdit = false): number {
@@ -203,4 +203,4 @@ namespace ts {
assert.isTrue(diags.length === 0);
});
});
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace ts {
});
it("Converts simple code snippet correctly", () => {
runTest(`/// <reference path="file.ts" />
runTest(`/// <reference path="file.ts" />
var x: string = "string";
console.log(x);`);
});
+1 -1
View File
@@ -151,7 +151,7 @@ namespace ts {
it("module name as directory - handle invalid 'typings'", () => {
testTypingsIgnored(["a", "b"]);
testTypingsIgnored({ "a": "b" });
testTypingsIgnored(true);
testTypingsIgnored(/*typings*/true);
/* tslint:disable no-null-keyword */
testTypingsIgnored(null);
/* tslint:enable no-null-keyword */
+3 -3
View File
@@ -326,7 +326,7 @@ namespace ts.server {
send(msg: protocol.Message) {
this.lastSent = msg;
}
};
}
it("can override methods such as send", () => {
const session = new TestSession();
@@ -367,7 +367,7 @@ namespace ts.server {
assert(this.projectService);
expect(this.projectService).to.be.instanceOf(ProjectService);
}
};
}
new ServiceSession();
});
});
@@ -462,7 +462,7 @@ namespace ts.server {
});
this.callbacks[this.seq] = callback;
}
};
}
it("can be constructed and respond to commands", (done) => {
const cli = new InProcClient();
@@ -174,7 +174,7 @@ namespace ts.projectSystem {
request.type = "request";
return this.executeCommand(<T>request);
}
};
}
export function createSession(host: server.ServerHost, typingsInstaller?: server.ITypingsInstaller, projectServiceEventHandler?: server.ProjectServiceEventHandler, cancellationToken?: server.ServerCancellationToken, throttleWaitMilliseconds?: number) {
if (typingsInstaller === undefined) {
@@ -381,7 +381,7 @@ namespace ts.projectSystem {
fileExists(s: string) {
const path = this.toPath(s);
return this.fs.contains(path) && isFile(this.fs.get(path));
};
}
getFileSize(s: string) {
const path = this.toPath(s);
@@ -476,11 +476,11 @@ namespace ts.projectSystem {
// TOOD: record and invoke callbacks to simulate timer events
setTimeout(callback: TimeOutCallback, _time: number, ...args: any[]) {
return this.timeoutCallbacks.register(callback, args);
};
}
clearTimeout(timeoutId: any): void {
this.timeoutCallbacks.unregister(timeoutId);
};
}
checkTimeoutQueueLength(expected: number) {
const callbacksCount = this.timeoutCallbacks.count();
@@ -501,7 +501,7 @@ namespace ts.projectSystem {
clearImmediate(timeoutId: any): void {
this.immediateCallbacks.unregister(timeoutId);
};
}
createDirectory(directoryName: string): void {
this.createFileOrFolder({ path: directoryName });
+1 -1
View File
@@ -191,7 +191,7 @@ namespace ts.server {
const l = lf.scriptInfo.fileName;
const r = rf.scriptInfo.fileName;
return (l < r ? -1 : (l > r ? 1 : 0));
};
}
static addToReferenceList(array: ModuleBuilderFileInfo[], fileInfo: ModuleBuilderFileInfo) {
if (array.length === 0) {
+1 -1
View File
@@ -718,7 +718,7 @@ namespace ts.server {
}
catch (e) {
cancellationToken = nullCancellationToken;
};
}
let eventPort: number;
{
+7 -7
View File
@@ -300,7 +300,7 @@ namespace ts.server {
}
}
private setTimerHandle(timerHandle: any) {;
private setTimerHandle(timerHandle: any) {
if (this.timerHandle !== undefined) {
this.operationHost.getServerHost().clearTimeout(this.timerHandle);
}
@@ -1544,17 +1544,17 @@ namespace ts.server {
[CommandNames.OpenExternalProject]: (request: protocol.OpenExternalProjectRequest) => {
this.projectService.openExternalProject(request.arguments, /*suppressRefreshOfInferredProjects*/ false);
// TODO: report errors
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.OpenExternalProjects]: (request: protocol.OpenExternalProjectsRequest) => {
this.projectService.openExternalProjects(request.arguments.projects);
// TODO: report errors
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.CloseExternalProject]: (request: protocol.CloseExternalProjectRequest) => {
this.projectService.closeExternalProject(request.arguments.projectFileName);
// TODO: report errors
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.SynchronizeProjectList]: (request: protocol.SynchronizeProjectListRequest) => {
const result = this.projectService.synchronizeProjectList(request.arguments.knownProjects);
@@ -1578,7 +1578,7 @@ namespace ts.server {
this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles);
this.changeSeq++;
// TODO: report errors
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.Exit]: () => {
this.exit();
@@ -1689,7 +1689,7 @@ namespace ts.server {
},
[CommandNames.Cleanup]: () => {
this.cleanup();
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.SemanticDiagnosticsSync]: (request: protocol.SemanticDiagnosticsSyncRequest) => {
return this.requiredResponse(this.getSemanticDiagnosticsSync(request.arguments));
@@ -1763,7 +1763,7 @@ namespace ts.server {
},
[CommandNames.CompilerOptionsForInferredProjects]: (request: protocol.SetCompilerOptionsForInferredProjectsRequest) => {
this.setCompilerOptionsForInferredProjects(request.arguments);
return this.requiredResponse(true);
return this.requiredResponse(/*response*/ true);
},
[CommandNames.ProjectInfo]: (request: protocol.ProjectInfoRequest) => {
return this.requiredResponse(this.getProjectInfo(request.arguments));
+2 -2
View File
@@ -542,12 +542,12 @@ namespace ts.codefix {
}
function getRelativePathIfInDirectory(path: string, directoryPath: string) {
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
return isRootedDiskPath(relativePath) || startsWith(relativePath, "..") ? undefined : relativePath;
}
function getRelativePath(path: string, directoryPath: string) {
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
return moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath;
}
}
+1 -1
View File
@@ -173,7 +173,7 @@ namespace ts.Completions {
// a['/*completion position*/']
return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log);
}
else if (node.parent.kind === SyntaxKind.ImportDeclaration || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isRequireCall(node.parent, false)) {
else if (node.parent.kind === SyntaxKind.ImportDeclaration || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// import x = require("/*completion position*/");
+1 -1
View File
@@ -701,7 +701,7 @@ namespace ts.FindAllReferences {
}
});
}
};
}
return result;
}
+1 -1
View File
@@ -568,7 +568,7 @@ namespace ts.formatting {
function getEffectiveDelta(delta: number, child: TextRangeWithKind) {
// Delta value should be zero when the node explicitly prevents indentation of the child node
return SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0;
return SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0;
}
}
+2 -2
View File
@@ -13,7 +13,7 @@ namespace ts.JsTyping {
fileExists: (fileName: string) => boolean;
readFile: (path: string, encoding?: string) => string;
readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[];
};
}
interface PackageJson {
_requiredBy?: string[];
@@ -23,7 +23,7 @@ namespace ts.JsTyping {
optionalDependencies?: MapLike<string>;
peerDependencies?: MapLike<string>;
typings?: string;
};
}
// A map of loose file names to library names
// that we are confident require typings
+1 -1
View File
@@ -1226,7 +1226,7 @@ namespace ts {
// Here we expose the TypeScript services as an external module
// so that it may be consumed easily like a node module.
declare var module: any;
declare const module: any;
if (typeof module !== "undefined" && module.exports) {
module.exports = ts;
}
+1 -1
View File
@@ -421,7 +421,7 @@ namespace ts.textChanges {
let changesInFile = changesPerFile.get(c.sourceFile.path);
if (!changesInFile) {
changesPerFile.set(c.sourceFile.path, changesInFile = []);
};
}
changesInFile.push(c);
}
// convert changes
+1 -1
View File
@@ -1334,7 +1334,7 @@ namespace ts {
name.charCodeAt(0) === name.charCodeAt(length - 1) &&
(name.charCodeAt(0) === CharacterCodes.doubleQuote || name.charCodeAt(0) === CharacterCodes.singleQuote)) {
return name.substring(1, length - 1);
};
}
return name;
}