Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Fix: Calculate end position of TypeInstantiation (fixes #406) #405

Merged
merged 2 commits into from
Nov 29, 2017
Merged

Fix: Calculate end position of TypeInstantiation (fixes #406) #405

merged 2 commits into from
Nov 29, 2017

Conversation

duailibe
Copy link
Contributor

When updating prettier to use the 9.0.0 version, I've noticed a comment is moved because the end position of the TypeInstantiation inside a TypeReference is being reported incorrectly.

If you review the two commits separately, you can notice the position change in the snapshot.

This is my first contribution here and I don't actually use TS, so let me know if I did something wrong! Thanks!

@jsf-clabot
Copy link

jsf-clabot commented Nov 27, 2017

CLA assistant check
All committers have signed the CLA.

@duailibe
Copy link
Contributor Author

I believe it's related to #395

cc @JamesHenry

@duailibe duailibe changed the title Fix end position of TypeAnnotation inside TypeReference Fix: Calculate end position of TypeInstantiation inside TypeReference correctly Nov 27, 2017
@duailibe
Copy link
Contributor Author

Should I've created an issue first?

@duailibe duailibe changed the title Fix: Calculate end position of TypeInstantiation inside TypeReference correctly Fix: Calculate end position of TypeInstantiation inside TypeReference correctly (fixes #406) Nov 29, 2017
@JamesHenry
Copy link
Member

We have just switched over to @eslintbot being a status check, rather than it commenting on the PR directly.

In this case, the feedback is not very explicit in the status check. My guess is the PR title is too long right now.

There is a 72 character limit in the contributing guidelines: https://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes

(But I don't blame you for not spotting that)

I am chatting through with the rest of the team how we can improve the feedback here.

I think the only other point on this PR is getting the ast-alignment-tests to pass. In this case you are using an interface (a construct which is not yet 100% aligned) so you will need to ignore your new spec in the ast-alignment-tests suite.

You should add it into the ignore block here: https://github.com/eslint/typescript-eslint-parser/blob/master/tests/ast-alignment/fixtures-to-test.js#L339

@duailibe duailibe changed the title Fix: Calculate end position of TypeInstantiation inside TypeReference correctly (fixes #406) Fix: Calculate end position of TypeInstantiation (fixes #406) Nov 29, 2017
@duailibe
Copy link
Contributor Author

There is a 72 character limit in the contributing guidelines: https://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes

I read that document but missed somehow this character limit. Really sorry!

I think the only other point on this PR is getting the ast-alignment-tests to pass.

I was already trying to figure out that so I went through the tests and tried other constructs and already had it working with a simple class, so I went with it. (hope it's ok!)

Thank you for the review!!

@JamesHenry
Copy link
Member

I was already trying to figure out that so I went through the tests and tried other constructs and already had it working with a simple class, so I went with it. (hope it's ok!)

I'm afraid I don't understand your response. From my comment above, you need to add your spec name into the ignore block here: https://github.com/eslint/typescript-eslint-parser/blob/master/tests/ast-alignment/fixtures-to-test.js#L339

...in order to get the ast-alignment-tests to pass. That is the remaining point blocking your build.

You can run npm run ast-alignment-tests locally to verify

@duailibe
Copy link
Contributor Author

duailibe commented Nov 29, 2017

Sorry I wasn't clear. I simply changed from interface to class since that's unrelated to the bug. Tests pass now locally, but travis is failing because of #407.

As it looks in travis some of the jobs are already running with TS 2.6.2, which is why they fail.

@JamesHenry
Copy link
Member

Ah I see!

It seems that's just because SyntaxKind 117 from the relevant TypeScript enum now has two names - it is still the AbstractKeyword, but it is also now the FirstContextualKeyword.

I will open a PR to fix this and we can merge that ahead of yours.

@duailibe
Copy link
Contributor Author

Thank you! That'll solve both of our issues on upgrading TS version on prettier :)

@JamesHenry
Copy link
Member

Great, that's merged. Please go ahead and rebase this against master and force push and it will trigger the travis build to rerun

@duailibe
Copy link
Contributor Author

Done!

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.

Awesome stuff, thanks a lot!

@JamesHenry JamesHenry merged commit 153cdb8 into eslint:master Nov 29, 2017
@duailibe duailibe deleted the fix-type-reference-end-pos branch November 29, 2017 21:17
@duailibe
Copy link
Contributor Author

Thank you! Do you think we can cut a release with those fixes soon?

@JamesHenry
Copy link
Member

I have already cut a release, but we always use commit hashes for typescript-eslint-parser versions in prettier anyway

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.

3 participants