* Add various tests for ts type annotated function properties.
* Improve format when passing ts arrow function with return type
* Add test for case from #2581.
We landed a change that added a new `InterpreterDirective` AST node type for hashbangs, and no longer add it as a comment/leadingComment.
Ref: https://github.com/babel/babel/pull/7928
I mimicked what we do in `@babel/generator` here, since I found it better than trying to add comments to the ast in `parser-include-shebang.js`). Definitely open to a better/cleaner option though!
Note: I'll follow this up with enabling tests for https://github.com/prettier/prettier/pull/4543 and https://github.com/prettier/prettier/pull/4540 once they land too.
* Support new node types for optionals
* Update babylon
* Fix decorator tests
* fix manual errors
* Update flow
* pretty print
* enable option for flow to support ??
* fix AST_COMPARE=1
* fix lint and explicitly test 1_2_3 syntax for flow
* Add tests showing existing behavior of various TS casts.
* Improve formatting of TS casts with generics and unions.
By adding a soft break between the cast and the expression. Also
includes wrapping parentheses for clarity as suggested in #4171.
Avoids changing behavior at all though if casting an array or object
literal because those already have good behavior where the array or
object literal breaks before the cast does so including them would just
result in a pointless extra layer of parentheses that would add no
clarity.
* Update tests in prepation for updating long cast format.
* Update so nested breaks inside type cast are indented.
* Add tests where expression being cast is too long itself.
* Update cast formatting to only sometimes break after cast.
Specifically it will break after the cast if that makes the cast itself
fit on a single line. If the cast itself won't fit on a single line then
the expression being cast will be placed directly after the `>` at the
end of the cast.
* Add heuristic to format functional composition more nicely
* Regex -> array
* Use object instead of array for faster lookup
* Remove empty lines
* Add redux connect
Also add comments for libraries
* feat(typescript): support generic JSX element
* fix(playground): `buffer is not defined` in `--parser typescript`
* chore(deps): update typescript-eslint-parser
* d3 counts as a constructor
* adds test
* Tweak wording
* docs: fix linting
* updates test
* no $ special case
* renames function
* shorter function name
* removes trailing white space
* feat: enable plugin-specific comment functionality
This change enables language plugins to provide their own "handleComment" function. To do so, we're exposing the addLeadingComment, addTrailingComment, and addDangling comment functions which attach comment nodes correctly in the ast which will get handled by prettier core when printing.
* moving js comment functionality to plugin