-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor declaration emitter into declaration transformer #21930
Merged
weswigham
merged 21 commits into
microsoft:master
from
weswigham:declaration-emit-refactor
Mar 16, 2018
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
62ee91d
Refactor declaration emitter into declaration transformer
weswigham 9f42eb8
Merge branch 'master' into declaration-emit-refactor
weswigham 4c639b8
Merge branch 'master' into declaration-emit-refactor
weswigham 3adcbc7
Slight cleanup from code review feedback
weswigham 9e34a3f
Merge branch 'master' into declaration-emit-refactor
weswigham db8e239
Merge branch 'master' into declaration-emit-refactor
weswigham 7844547
Merge branch 'master' into declaration-emit-refactor
weswigham d1359ee
Merge branch 'master' into declaration-emit-refactor
weswigham 165e6bb
Incorporate fix for new test
weswigham b84cbe4
Merge branch 'master' into declaration-emit-refactor
weswigham 63923e2
Merge branch 'declaration-emit-refactor' of github.com:weswigham/Type…
weswigham e8a64bd
Merge branch 'master' into declaration-emit-refactor
weswigham d67ddc1
Merge branch 'master' into declaration-emit-refactor
weswigham a2f1a8a
Swaths of PR feedback
weswigham 036c65a
Merge public methods
weswigham 289e3e5
Per-file output
weswigham 08ffcc8
Preserve input import ordering more often
weswigham cb69963
Unify jsdoc comment start detection under more lenient rule
weswigham 1a699b8
Merge branch 'per-file-output' into declaration-emit-refactor
weswigham f83bc81
Move to per-file transformations to reduce the memory that msut be re…
weswigham 6d729cf
Fix typo
weswigham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Deduplicate this with
isJsDocStart
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.
Can't. They behave meaningfully differently.
isJSDocLikeText
matches anything that starts with**
and isn't an empty comment.isJsDocStart
only matches comments starting with**
but not***
and doesn't filter empty comments at all.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.
Why does
isJsDocStart
check for/***
? If we don't consider/***
to be JSDoc there, then we shouldn't allow it here either.Assuming the last condition in
isJsDocStart
is not a typo (e.g. checking for*
instead of/
), it seems like both of these could be the same function: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.
Honestly no idea. It just seems as if we decided at some point that extra stars (like if, for example, you put line-length star guards around your comment) don't count as jsdoc as far as the parser is concerned. However I definitely think it's still correct to preserve such a comment in declaration emit, hence the difference.
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've unified them both under the previous
isJSDocLikeText
implementation, since it seems like the parser definition has just sat around since its introduction three years ago, and the only justification for why/*** @type {Foo} */
is any less jsdoc than/** @type {Foo} */
I've found is a remark on usejsdoc.org; but we're typically more lenient than it says (plus, closure compiler allows it (you can see the type annotation still getting applied under the advanced mode error)) cc @DanielRosenwasser it makes sense to be more lenient here, right?