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

Conversation

LucasSloan
Copy link
Contributor

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
  • Includes tests
  • Documentation update

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.

Updates the package.json, fixes some compiler issues where some typescript APIs changed, and makes 2 rules work under 2.7.2.
@palantirtech
Copy link
Member

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);
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!

@suchanlee
Copy link
Contributor

Thanks for the PR @LucasSloan! I was also working on this but I think we can just use this PR.
I would love to just make the jump to TS 2.8 but it looks like a ton of tests break in 2.8, which I'm looking into.

Can you fix the lint issue? ' -> "

Copy link
Contributor Author

@LucasSloan LucasSloan left a 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);
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!

Fixed a lint issue (' => ").
Actually checked for undefined, instead of just asserting.
@suchanlee suchanlee merged commit 8e13390 into palantir:master Apr 6, 2018
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
* 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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants