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

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;
}
}

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*/");

View File

@@ -701,7 +701,7 @@ namespace ts.FindAllReferences {
}
});
}
};
}
return result;
}

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;
}
}

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

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;
}

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

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;
}