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

Upgrade TSLint to support TS 3.1 #4274

Merged
merged 8 commits into from
Dec 15, 2018
Merged

Conversation

bowenni
Copy link
Contributor

@bowenni bowenni commented Nov 7, 2018

PR checklist

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

Overview of change:

Upgrade TSLint to support TS 3.1.6 and also upgrade tsutils to 3.3.1.
Fixes #4102

Is there anything you'd like reviewers to focus on?

TS 2.1 tests are broken by this change:
tsutils v3.0.0+ now requires node >= 6 (link). Therefore it's incompatible with node version specified in the build config of TS 2.1 tests (link). I have tried to pin TS 2.1 tests to use an old version of tsutils (v2.9.0 is the last version that is compatible with node 4) but due to some breaking changes in tsutils APIs (link) it's hard to make some TSLint rules work with both the old and the new APIs. Besides, I think supporting multiple versions of the same utility library is not a great idea. Is it possible to relax the node version requirement for TS 2.1 tests?

CHANGELOG.md entry:

@bowenni bowenni closed this Nov 7, 2018
src/language/utils.ts Show resolved Hide resolved
src/rules/cyclomaticComplexityRule.ts Outdated Show resolved Hide resolved
src/language/utils.ts Show resolved Hide resolved
src/rules/noShadowedVariableRule.ts Outdated Show resolved Hide resolved
src/rules/noStringThrowRule.ts Show resolved Hide resolved
@bowenni
Copy link
Contributor Author

bowenni commented Nov 9, 2018

@JoshuaKGoldberg Can you please take a look?

@JoshuaKGoldberg
Copy link
Contributor

Hi @bowenni, thanks for sending this in!

Most package updates are fine, but changing how TSLint uses tsutils is a breaking change that should be discussed a bit more. A couple examples of it coming into play: microsoft/tslint-microsoft-contrib#470 microsoft/tslint-microsoft-contrib#373. How would this change affect tslint-microsoft-contrib, for example? It'd be good if we could get consensus from the @palantirtech maintainers of this repo on what the upgrade strategy for dependency versions here is.

Increasing the node version to 6 seems fine, as 4 is no longer supported and 6 is barely in LTS.

@bowenni
Copy link
Contributor Author

bowenni commented Nov 9, 2018

Thanks @JoshuaKGoldberg . Understood.

I'd love to hear about the deps management strategy from @palantirtech too.

@bowenni
Copy link
Contributor Author

bowenni commented Nov 20, 2018

Friendly ping @johnwiseheart

@NN---
Copy link
Contributor

NN--- commented Dec 11, 2018

I suggest to update this PR for 3.2 support.

@bowenni
Copy link
Contributor Author

bowenni commented Dec 11, 2018

The TypeScript version upgrade is an incremental process. Upgrading to 3.1 first will make 3.2 to land more easily.
I do plan to look at the 3.2 upgrade too.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

@bowenni I looked a bit into the tsutils upgrade - instead of upgrading tsutils, how about just making copies of the failing methods from that repo's 2.27 version, and copying them to tslint under utils, marking them as deprecated?

For example, instead of import { getPropertyText } from "tsutils",

// util/util.ts
/**
 * @deprecated This will be removed once TSLint requires tsutils^3.3
 */
export function getPropertyName(propertyName: ts.PropertyName): string | undefined {
    // whatever it looked like in 2.27.2
}

If you don't have the time to go through this, I can update this PR. Let me know!

Agreed that it would be nice to have the newer tsutils 😄, I'll file an issue track the upgrade.

ericanderson pushed a commit that referenced this pull request Dec 11, 2018
@ericanderson
Copy link
Member

Lets not introduce a breaking change on tsutils in case someone was transitively depending on it for their custom rules.

@bowenni
Copy link
Contributor Author

bowenni commented Dec 14, 2018

Done. PTAL.

@bowenni
Copy link
Contributor Author

bowenni commented Dec 14, 2018

Some mysterious formatting changes are probably due to prettier, I think.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

mysterious formatting changes

Agh, the Prettier thing keeps coming up... Not a problem there.

The yarn.lock changes are pretty minimal so I can change those now. Thanks for this!

yarn.lock Outdated Show resolved Hide resolved
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Super, thanks @bowenni! Very exciting to no longer need to node.parent! in all those places! 😄

@JoshuaKGoldberg JoshuaKGoldberg merged commit c7fc99b into palantir:master Dec 15, 2018
@bowenni bowenni deleted the ts-upgrade branch December 15, 2018 00:08
@bowenni
Copy link
Contributor Author

bowenni commented Dec 15, 2018

Thanks for reviewing the PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants