* 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
* feat(typescript): support for conditonal types
* refactor(js): reuse conditional expression logic
* chore(typescript): update snapshot for typescript conditional type test suite
* chore(js): make code support Node 4
* chore(js): rename utility functions
* chore(js): add comments for formatTernaryOperator
* fix(ts): support infer keyword
* chore(js): new line
* chore(js): improve readablity a little bit
* Split out location extraction into plugin config
* Reduce set of exported function, rebase to current master
* Pass custom locStart/locEnd fn's directly to affected methods
* (wip) always use locStart/locEnd from plugin
* Convert graphql implementation
* Convert HTML implementation
* (wip) convert JS implementation
* Remove unused variables
* Continue conversion of JS implementation
* Replace "util.locStart" with direct call to "options.locStart"
* Remove util closure
* Add unit test for structure of shared util
* Fix linting error, simplify locStart/End implementations