Commit Graph

25 Commits (master)

Author SHA1 Message Date
fisker Cheung 56a2cd8a1b Refactor createLanguage to use function transform (#6676) 2019-10-29 20:49:44 +02:00
fisker Cheung 5ce16eaa02 Update linguist-languages to v7 (#6367)
* Update linguist-languages to v7

* Trigger build

* Update

* replace `includes` with `indexOf`

* fix `exclude`

* add `nodejs` back
2019-09-14 00:57:16 +03:00
Adrian Zgorzałek 9cb50add5e graphql: Support variable directives. (#6020) 2019-04-04 09:47:05 -03:00
Adrian Zgorzałek 7c9823fcba Teach prettier/graphql about formatting fragment variables. (#6016)
Fragment variables are an experimental extension to GraphQL schema.
Formatting should follow the same rules as formatting an OperationDefinition node,
hence code is the same.
2019-04-04 09:44:52 -03:00
Ika 58d34bb844
refactor: language extend (#4994) 2018-08-22 10:12:57 +08:00
Prashant Andani cdcb7b11c9 Use destructures and refactor code for readability (#4844)
* Use destructuring for readability and optimzations at for loop length property

* Destructure variables for easy maintainability of code

* PR review fix

* refactor: fix linting

* Use destructures and refactor code for better readability

* Remove merge conflict line

* lint before commit
2018-07-17 18:01:44 -03:00
Ika 0df2199688
fix(grahpql): linebreak in non-block stringValue (#4808) 2018-07-05 00:14:09 +08:00
Ika 0b659b898d
feat: update linguist languages (#4741)
Context: https://github.com/prettier/prettier/pull/4734#issue-196702272

Languages should be easy to maintain now.
2018-06-28 08:24:02 +08:00
Ika b99de9811b
feat(graphql): support pragma (#4699) 2018-06-17 14:04:48 +08:00
Ika b55997eb3d
fix(multiparser): no additional trailing newline for graphql in js (#4616)
Fixes #4615

The root cause is the output doc from graphql printer does not match the desired input from `stripTrailingHardline`.

a9b21a01e2/src/doc/doc-utils.js (L167-L180)
2018-06-01 00:38:39 +08:00
Lucas Azzola b0cb63a7bb
Use destructuring for imports (#4554)
* Use destructuring for imports

* Clean up integration tests

* Use moduleNameMapper for require_prettier
2018-05-27 21:36:12 +10:00
Lucas Duailibe 52a2a46b3c
New build system (#4449) 2018-05-24 15:30:45 -03:00
Aakansha Doshi 31f79fbc22 Don't add new lines after unless present in graphql (#4512)
* Don't add new lines after unless present in graphql

* fix logic and add more specs

* use index
2018-05-20 13:44:49 -04:00
Suchipi ec45dc9a4c
(refactor): Move common options out of JS plugin (#4445)
* (refactor): Move common options out of JS plugin

* Add Common category to playground
2018-05-15 14:14:50 -06:00
Ika d0f6aac001
refactor(massageAst): move stripLocation to corresponding plugins (#4477) 2018-05-14 20:52:27 +08:00
Lucas Duailibe 67f1c4877e
Refactoring: better boundaries for different parts of the project (#4364) 2018-04-25 13:29:35 -03:00
Rui Araújo 9da8752585 Allow new interface style for GraphQL. (#4012)
* Allow new interface style for GraphQL.

This is a breaking change since it will upgrade the old style to the new one.

Closes #3600.

* Allow old interface style.

When in present of mixed style, it updates to the new one.
2018-03-27 00:52:57 -06: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 6a953e47b5
Print description of enum and input for GraphQL (#3633) 2018-01-03 01:29:11 -03:00
Christopher Chedeau 5356db0e69
Normalize GraphQL multi-line strings (#3632)
* Normalize GraphQL multi-line strings

See discussion in https://github.com/prettier/prettier/pull/3605#discussion_r159120321

* split
2018-01-02 11:55:53 -08:00
Christopher Chedeau 58e5536741
Update GraphQL parser (#3605)
* Update GraphQL parser

Fixes #3601

This adds support for
- description as strings
- extending all the possible types
- block strings
- allow removing {} if there's no implementation for all graphql types

This is a breaking change but shouldn't be a big issue.
- Empty types are no longer allowed (there's an option to enable it but it hasn't been released yet). The fix is to remove `{}`

Something that hasn't been changed because not released:
- Doesn't support the new `&` separator for implementing multiple interfaces

A bug has been fixed:
- Now properly prints @directives for unions.

* Properly handle triple quotes
2017-12-31 16:45:06 +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 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