-
Notifications
You must be signed in to change notification settings - Fork 885
Conversation
Updates the package.json, fixes some compiler issues where some typescript APIs changed, and makes 2 rules work under 2.7.2.
Thanks for your interest in palantir/tslint, @LucasSloan! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
src/runner.ts
Outdated
@@ -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); |
There was a problem hiding this comment.
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);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - done!
Thanks for the PR @LucasSloan! I was also working on this but I think we can just use this PR. Can you fix the lint issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the lint as well.
src/runner.ts
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - done!
Fixed a lint issue (' => "). Actually checked for undefined, instead of just asserting.
* Build tslint with TypeScript 2.7.2. Updates the package.json, fixes some compiler issues where some typescript APIs changed, and makes 2 rules work under 2.7.2. * Fixes from code review. Fixed a lint issue (' => "). Actually checked for undefined, instead of just asserting.
PR checklist
Overview of change:
Updates the package.json, fixes some compiler issues where some typescript APIs changed, and makes 2 rules work under 2.7.2.