-
-
Notifications
You must be signed in to change notification settings - Fork 75
Breaking: Convert Signature types to be more ESTree like (fixes #262) #264
Conversation
LGTM |
5421cea
to
ddeaaea
Compare
LGTM |
We can move optional and computed to the Identifier node. I think that might make more sense |
@@ -0,0 +1,15 @@ | |||
interface Foo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A number of these aren't semantically valid TypeScript, but I guess we are further evaluating errorRecovery here, so it should be ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can split them into two test. Not sure which ones are invalid exactly but I think the computed property don't make sense in interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. Are you planning any more breaking changes after this?
It would be great if we could have a period of stability to allow for the prettier implementation to catch up a bit.
We done a lot of breaking changes recently (albeit a lot of those were in response to prettier issues 😄 )
lib/convert.js
Outdated
case SyntaxKind.MethodSignature: { | ||
Object.assign(result, { | ||
type: AST_NODE_TYPES.TSMethodSignature, | ||
optional: (node.questionToken) ? (node.questionToken.kind === SyntaxKind.QuestionToken) : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a util function?
lib/convert.js
Outdated
Object.assign(result, { | ||
type: AST_NODE_TYPES.TSMethodSignature, | ||
optional: (node.questionToken) ? (node.questionToken.kind === SyntaxKind.QuestionToken) : false, | ||
computed: node.name.kind === SyntaxKind.ComputedPropertyName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a util function?
@JamesHenry Thanks for the review. Will make the changes. The only other breaking changes we could do are:
|
LGTM |
I added two functions to node-utils:
|
Again, just want to check how/if the AST alignment work affects this? |
I need to change this so that only |
I think we should look to finalise this after #292 gets resolved right? |
fa7e22a
to
a361063
Compare
LGTM |
LGTM |
LGTM |
@JamesHenry Should be good. |
This LGTM, @vjeux there are a lot of changes here, would you mind just confirming that this is all what you are expecting? |
Yup, I actually made prettier use this branch :) Shipit! |
Thanks, chaps! Awesome work |
I noticed that optional is used twice. Once in identifier and once in the TSPropertySignature. Maybe we should clean that up.
Here is what this produces:
#262 (comment)