Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Add check for node.body in referencer #2

Merged
merged 10 commits into from
Feb 11, 2017
Merged

Add check for node.body in referencer #2

merged 10 commits into from
Feb 11, 2017

Conversation

corbinu
Copy link
Contributor

@corbinu corbinu commented Jan 14, 2017

So happy to make this PR!! Obviously this fixes issues for scoping typescript methods without a body per eslint/typescript-eslint-parser#92

@jsf-clabot
Copy link

jsf-clabot commented Jan 14, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

Ha I had a bit of a WTF moment when I came to submit my PR, and you had already done it. Apparently you see everything 👀

The only thing I did differently, and would request that you do, is add a comment as to why we are adding the check:

 // In TypeScript there are a number of function-like constructs which have no body,
 // so check it exists before traversing
 if (node.body) {

@corbinu
Copy link
Contributor Author

corbinu commented Jan 15, 2017

@JamesHenry hah yes sorry I am a lurker have been wanting to help more, but you know work :/ figured this one took me all of 5 min :)

Should be all set!

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

Can you please add a test for this change?

@corbinu
Copy link
Contributor Author

corbinu commented Jan 15, 2017

@nzakas Sure may take me some digging but once the rest of my work is done today will try to take a crack at it.

@corbinu
Copy link
Contributor Author

corbinu commented Jan 18, 2017

@JamesHenry I am going to be super busy till the weekend. If you want to do this instead before then is totally fine with me :)

@JamesHenry
Copy link
Member

@corbinu any update on this?

@corbinu
Copy link
Contributor Author

corbinu commented Feb 6, 2017

@JamesHenry sorry work has gotten away from me. I should have some time thrusday but if somebody else wants to pickup the tests is fine :)

@soda0289
Copy link
Member

soda0289 commented Feb 7, 2017

I don't mind writing tests. Would love to help. I'll take a shot at it later today.

@corbinu
Copy link
Contributor Author

corbinu commented Feb 7, 2017

@soda0289 Sure thanks that would really help!

We will remove this soon but need to add tests for new features
in the mean time.
This used in tests for typescript features.
This fixes an issue with typescript having an empty body
for some functions
@soda0289
Copy link
Member

soda0289 commented Feb 8, 2017

I added some tests for typescript. Pull request can be found here:
https://github.com/corbinu/eslint-scope/pull/1

I dont think the scope is correct. For example the abstract class is not found in the scope. I think the other test, for multiple function declartion, are correct just need to double check.

I also had to add a check to scope.js to return false when body is not found in the function isStrictScope().

@corbinu
Copy link
Contributor Author

corbinu commented Feb 8, 2017

Thanks will add them to mine.

soda0289 and others added 2 commits February 8, 2017 19:05
This includes a test for multiple call signatures.
@corbinu
Copy link
Contributor Author

corbinu commented Feb 9, 2017

@JamesHenry @nzakas @soda0289 Was nice enough to get some tests working this should be good to go. @soda0289 Is going to do another PR that adds changes and tests to eslint-scope to properly scope Typescript Abstract classes.

@JamesHenry
Copy link
Member

Thanks so much for your efforts on this guys!

I was never a contributor to escope, and I do not feel I am in a good position to be able to pass judgement on how well these test cases match expectations. The code itself certainly seems fine 👍

@nzakas Requested them originally, and certainly has been an important contributor to escope in the past, so his review here is key.

@corbinu The main thing from me is to make sure that this branch is up to date, there are currently conflicts

@corbinu
Copy link
Contributor Author

corbinu commented Feb 10, 2017

@JamesHenry should be all set!

Add comment explaining the node.body check

Allow tests to run with babel

We will remove this soon but need to add tests for new features
in the mean time.

Add typescript-eslint-parser as dev dependency

This used in tests for typescript features.

Strict scope should be false when there is no body

This fixes an issue with typescript having an empty body
for some functions

Add tests for typescript scope analysis

This includes a test for multiple call signatures.

Add comment explaining the node.body check

Allow tests to run with babel

We will remove this soon but need to add tests for new features
in the mean time.

Strict scope should be false when there is no body

This fixes an issue with typescript having an empty body
for some functions

Add tests for typescript scope analysis

This includes a test for multiple call signatures.
@corbinu
Copy link
Contributor Author

corbinu commented Feb 10, 2017

@JamesHenry Sorry if I jacked the rebase is that better?

Copy link
Member

@nzakas nzakas 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!

@nzakas
Copy link
Member

nzakas commented Feb 11, 2017

Hmm, it's not letting me merge for some reason. Will try again later.

@corbinu thanks for your help. In the future, please be sure to follow our commit message guidelines. It helps the process be a bit smoother.

@ilyavolodin ilyavolodin dismissed JamesHenry’s stale review February 11, 2017 18:36

All requests have been addressed.

@ilyavolodin
Copy link
Member

@nzakas Merge was disabled because @JamesHenry have requested changes and review was not approved. I'll merge this in as "Update"

@ilyavolodin ilyavolodin merged commit c647f65 into eslint:master Feb 11, 2017
@JamesHenry
Copy link
Member

👍

@nzakas
Copy link
Member

nzakas commented Feb 11, 2017

Ah weird, that request for changes didn't show up in the mobile view. Thanks!

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.

6 participants