* 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
* Treat define calls like require
See issue #3829. This commit keeps define calls as a unit when possible,
to prevent an extra indent in the body of an AMD-style define.
Rather than adding the "define" check in the same case as the existing
"require" check, I added a separate condition to explicitly call out the
fact that this checks for both AMD and CommonJS modules.
`yarn test -u` yields no changes, and `yarn lint` passes successfully.
* Added tests for define and require amd formatting
This tests the solution for issue #3829.
* Add babylon interpreter to require-amd test
* Merge require and define checks
* test: add test cases
* test: add test cases
* fix(javascript): ternary with `--use-tabs`
* chore: add istanbul ignore comment
* fix: remove unnecessary condition
* docs(commands): update `align`
* fix: do not transform the middle part
* refactor: markAsRoot
* fix: print tabs in sub-ternaries
* docs(commands): update
* test: add a cool test case
* test: add test cases
* test: add test cases
* fix(javascript): indentation for sub-ternaries
* test: update test cases
* fix: no extra tab for `tabWidth: 4`
* Added prettier layout for class extends and implements
* Added prettier layout for class extends and implements, fix with keeping it in online if it fits
* Added prettier layout for class extends and implements, fixed tests as a side change
* Extends implements comments in same line fix
* Extends implements comments in same line without ugly workaround
* added empty line to test typescript_class/extends_implements.ts
* If only one extends keep old behaviour
* Removed console logs
* Split up comment printing
* Refactor plugin handling
* Allow multiparser to use options normalization
* Rename to canAttachComment
* Add inline comment
* Format code
* Use prettier.__debug to get AST