Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Build tslint with TypeScript 2.7.2. #3819

Merged
merged 2 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"ts-node": "^3.3.0",
"tslint": "^5.8.0",
"tslint-test-config-non-relative": "file:test/external/tslint-test-config-non-relative",
"typescript": "~2.6.1"
"typescript": "~2.7.2"
},
"license": "Apache-2.0",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/completedDocsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function walk(context: Lint.WalkContext<ExclusionsMap>, typeChecker: ts.TypeChec
return;
}

const comments = symbol.getDocumentationComment();
const comments = symbol.getDocumentationComment(typeChecker);
checkComments(node, describeNode(nodeType), comments, requirementNode);
}

Expand Down
2 changes: 1 addition & 1 deletion src/rules/deprecationRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function getDeprecation(node: ts.Identifier, tc: ts.TypeChecker): string | undef
function findDeprecationTag(tags: ts.JSDocTagInfo[]): string | undefined {
for (const tag of tags) {
if (tag.name === "deprecated") {
return tag.text;
return tag.text === undefined ? "" : tag.text;
}
}
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/noRedundantJsdocRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function walk(ctx: Lint.WalkContext<void>): void {
if (typeExpression !== undefined) {
ctx.addFailureAtNode(typeExpression, Rule.FAILURE_STRING_REDUNDANT_TYPE);
}
if (comment === "") {
if (comment === undefined || comment === "") {
// Redundant if no documentation
ctx.addFailureAtNode(tag.tagName, Rule.FAILURE_STRING_NO_COMMENT(tag.tagName.text));
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/typedefWhitespaceRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class TypedefWhitespaceWalker extends Lint.AbstractWalker<Options> {
}

private checkSpace(node: ts.SignatureDeclaration | ts.VariableLikeDeclaration, key: OptionType) {
if (node.type === undefined) {
if (!('type' in node) || node.type === undefined) {
return;
}
const {left, right} = this.options;
Expand Down
2 changes: 1 addition & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async function doLinting(options: Options, files: string[], program: ts.Program
continue;
}

const contents = program !== undefined ? program.getSourceFile(file).text : await tryReadFile(file, logger);
const contents = program !== undefined ? program.getSourceFile(file)!.text : await tryReadFile(file, logger);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i'd prefer to not ! if not necessary. I was actually fixing all the tests and compilation issues as well, and this is what i did:

let contents: string | undefined;
if (program !== undefined) {
    const sourceFile = program.getSourceFile(file);
    if (sourceFile !== undefined) {
        contents = sourceFile.text;
    }
} else {
    contents = await tryReadFile(file, logger);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - done!

if (contents !== undefined) {
linter.lint(file, contents, configFile);
}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1601,9 +1601,9 @@ type-detect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"

typescript@~2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.1.tgz#ef39cdea27abac0b500242d6726ab90e0c846631"
typescript@~2.7.2:
version "2.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"

uglify-js@^2.6:
version "2.8.28"
Expand Down