Commit Graph

20 Commits (f60bae61b801a5baf97c1e18cb3b58ff902d87b9)

Author SHA1 Message Date
Eric Anderson 051a488bbd fix(typescript): properly chain when there is a TSNonNullExpression (#4005)
* fix(typescript): properly chain when there is a TSNonNullExpression

* No need to pass args

* PR feedback

* Fix lint
2018-02-20 12:37:11 -03:00
Brian Ng a8fe401b26 Fix cases with missing semi when printing DeclareExportDeclaration (#3979) 2018-02-17 17:40:43 +11:00
Ika 4a4bd2faed
fix(typescript): support `unique symbol` (#3967)
* test(typescript): add failing test

* chore(deps): update typescript-eslint-parser to v13.0.0

* fix(typescript): support `unique symbol`
2018-02-14 01:03:53 +08:00
Lucas Azzola 2313574fcc
Fix flow maybe object return type (#3948) 2018-02-11 17:46:00 +11:00
Christian Zosel fac08034e7 Split out location extraction into plugin config (#3777)
* 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
2018-02-09 23:17:48 +11:00
Ika 47714f5d4b
feat(plugins): change external options to be plugin-level (#3924) 2018-02-09 00:06:38 +08:00
Lucas Duailibe aac38fca49 Force break if comment in return argument (#3665)
* Force break if comment in return argument

* add test case
2018-01-31 12:00:29 -05:00
Salem 8c792121f2 Treat define calls like require (#3830)
* 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
2018-01-29 16:44:32 -05:00
Ika 03292a6488
fix(javascript): ternary with `--use-tabs` (#3745)
* 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
2018-01-26 10:02:42 +08:00
Ika 2dd311d554
fix(javascript): indentation for sub-ternaries (#3747)
* 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`
2018-01-16 11:32:25 +08:00
Thorben von Hacht 1a1de60491 Prettier extends and implements when not fitting in same line (#3689)
* 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
2018-01-13 16:31:51 +11:00
Quinn Hoyer aa0437cc60 Add support for skip() (#3706) (#3735)
* Add support for skip() (#3706)

* Fix regex & add tests
2018-01-13 13:02:31 +11:00
Lucas Duailibe 7f75499dd2 Prevent adding softline after arrow attribute with comments (#3641)
* failing test

* fix
2018-01-03 12:12:01 -08:00
Lucas Duailibe 7d3a30615b
Don't add () in JSX attributes with elements (#3640) 2018-01-03 11:36:25 -03:00
Lucas Duailibe 51744e1008 Print parens in FunctionTypeAnnotation when arrowParens is "always" (#3616)
* add test case

* print parens in function type annotation
2017-12-31 16:01:21 +01:00
Ika 6c0dd74518 feat(support-info): add `options` field (#3433)
* refactor: rename supportTable with supportLanguages

* refactor: use `dedent`

* test: reduce unnecessary data

* feat(support-info): add `options` field

* add `showDeprecated` option
* add `showUnreleased` option

* test: snapshot diff

* fix(support): add missing `since`

* fix: add missing `category`

* refactor: use template tag

* fix: `trailingComma:true` should redirect to `trailingComma:es5`

* refactor: reorder parser

* refactor: fix linting

* refactor: move options

* refactor: move options to printers
2017-12-31 15:34:37 +11:00
Lucas Azzola a041914551
Extract cleanAST to language-specific files (#3610)
* Extract cleanAST to language-specific files

* Fix lint

* Fix clean-ast for vue and glimmer
2017-12-30 21:30:09 +11:00
Christopher Chedeau 7eca8011bc Inline do expressions inside of JSX (#3607)
Fixes #3602
2017-12-29 18:58:01 -03:00
Lucas Azzola ee148bfded
Split up comment printing (#3575)
* 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
2017-12-27 00:04:09 +11:00
Lucas Azzola 4c9d4061da
Prettier Plugin API (#3536)
* Move files around in preparation for refactor

* Update paths in build script

* Extract generic printing logic from the JavaScript printer

* Conform printer API

* Fixup decorator handling

* Fix multiparser

* Create plugin entry for markdown

* Create plugin entry for javascript/typescript

* Create plugin entry for html

* Create plugin entry for graphql

* Create plugin entry for css/less/scss

* Move JSON to JS plugin entry

* Integrate plugins into getSupportInfo()

* Move astFormat to parser definition

* Move util to common

* Implement parser loading

* remark -> mdast

* Rename cli/cli -> cli/index

* Rename builder -> doc package, fix printer resolution

* Fix doc shape assumption in CSS-in-JS logic

* Fix third-party.js prod resolution

* Fixup build-docs script

* Distribute multiparser code

* Remove requirement to forward options

* Flatten closure

* Remove debug directory

* Expose doc

* Add external plugins

* Pass options to loadPlugins

* Export getParsers

* Pin resolve version

* Use getSupportInfo in Markdown embed

* Document plugin API

* Update build-docs

* Add CLI for plugins

* Lint docs

* Fixup build.js

* Add vue language

* Fixup multiparser for vue

* Upgrade rollup and rollup-plugin-commonjs

* Fixup third-party build

* Change AST format in docs
2017-12-26 12:23:50 +11:00