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

Fix [ban]: wrong logic matching deeply nested methods #4383

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

lpaladin
Copy link
Contributor

@lpaladin lpaladin commented Dec 15, 2018

PR checklist

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

Overview of change:

Fix a bug where a.b.c() may also match with a.c().

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

CHANGELOG.md entry:

[bugfix] ban: Fix a false positive which would occur when banning method calls nested inside objects. Previously, banning ["a", "b", "c"] would trigger lint failures on the syntax b.c(), which was not the intent of this rule.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @zhouhaoyu! 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.

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.

LGTM, thanks @zhouhaoyu!

@JoshuaKGoldberg
Copy link
Contributor

Note: this would be a breaking change, as some users may be accidentally relying on the old (technically incorrect) behavior. This PR will have to wait until TSLint is ready to merge in PRs for a next major version.

Generally it'd be better to have an issue filed before a PR for changes, but this seems small enough to discuss here. Great catch @zhouhaoyu!

@alexluecke
Copy link

Any idea when this will be released?

@JoshuaKGoldberg
Copy link
Contributor

/cc @adidahiya

@adidahiya
Copy link
Contributor

We usually treat fixes to rule behavior like this as non-breaking, even though users might be relying on the old faulty behavior. I just want to confirm that the false positive existed before this change and then I'll merge this.

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

updated the changelog entry to be more precise, let me know if that looks ok

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.

5 participants