Commit Graph

2143 Commits (8f6a32853cb53fe3e7d31189f91912fb69c2713f)

Author SHA1 Message Date
Lucas Duailibe 01a59eeee3
Wrap conditionals and await in parens in spread property (#3681) 2018-01-09 01:45:51 -02:00
Jed Fox dc4e44968f
Follow redirects in the user URLs (#3672)
(except the ones redirecting to `/en/` or similar)

Also remove trailing slashes on domains
2018-01-08 10:32:33 -05:00
Lucas Azzola eb1096d4af
Add pretty-quick pre-commit docs (#3675) 2018-01-09 02:19:53 +11:00
Ika 5e2e7a2881 feat(playground): add example placeholder (#3657)
* feat(playground): add example placeholder

* Add TypeScript example

* fix: mock process.binding

* fix: add missing comma

* refactor: use legacy function

* fix: mock return `{}`

* Return the error stack when there’s a non-SyntaxError thrown

* Code style

* fix: mock path.resolve

* chore: cache placeholder.js

* fix mock path.resolve attempt 2

* fix: mock path.{parse,join,dirname}

* fix: mock process.cwd

* fix: mock path.parse root
2018-01-07 06:59:14 -05:00
Ika 445b4afc73 docs(readme): travis master badge (#3666) 2018-01-07 20:06:25 +11:00
michele e4e3c757fb Added GumGum to list of users (#3660) 2018-01-05 22:40:00 -02:00
Lucas Azzola b65e679e70 Update plugins docs (#3653) 2018-01-05 10:48:47 -05:00
Tejas Kumar 053202cc16 Added Contiamo to list of users (#3655) 2018-01-06 02:05:02 +11:00
Lucas Azzola e5d6a4704f
Automatically load plugins from package.json (#3624)
* Automatically load plugins from package.json

* Fix build by adding json extension

* Fixup misuse of options argument

* Rewire graceful-fs to fs

* Document graceful-fs issue

* Alias graceful-fs to fs in Rollup
2018-01-05 21:09:51 +11:00
Christopher Chedeau a4dd86436a
[scss] Print comments inside of selector as is (#3649)
Fixes #3647
2018-01-04 19:03:04 -08: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 157df6e3fd
Print imageReference with no alt in Markdown (#3643) 2018-01-03 13:54:53 -03:00
Lucas Duailibe 7d3a30615b
Don't add () in JSX attributes with elements (#3640) 2018-01-03 11:36:25 -03:00
Marcel Jackwerth 6260629f18 [Plugins] Allow custom getCommentChildNodes (#3639)
* [Plugins] Allow plugins to specify their own getChildNodes for comment printing

* Rename getChildNodes -> getCommentChildNodes
2018-01-03 23:58:53 +11:00
Ika dbe0758b48 chore: shorten filename (#3636)
Context: https://github.com/prettier/prettier/pull/3627#issuecomment-354935942
2018-01-02 23:48:46 -05: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
Ika a627ca7b5d
docs: minor tweaks (#3627)
* docs(blog): replace `:emoji:` with `${emoji}`

* docs(blog): move images to assets

* docs(index): move images to assets

* docs(index): fix typo
2018-01-03 00:04:22 +08:00
Christopher Chedeau dcf04187db
Tweak CSS of the blog section (#3625)
* Tweak CSS of the blog section

* light codeblocks

![image](https://user-images.githubusercontent.com/197597/34471012-52212fba-eef2-11e7-8f75-404a3693c87d.png)
2018-01-01 17:08:47 -08:00
Lucas Azzola c00c1cb6e0
Change quoted date back to 2017 2018-01-01 12:40:10 +11:00
Li Siyao c6304fb426 Happy new year 2018! (#3620) 2018-01-01 00:41:21 +01:00
Lucas Duailibe 2cb9498ab6 Output files as-is if ignored (#3618)
* fix --stdin-filepath

* output file as-is without --write

* return early

* use writeOutput
2017-12-31 18:08:09 +01: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
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 800a1cf9d4
Add Blog, Populate with Release Notes (#3604)
* Add blog

* Rename files, add extra #

* Improve formatting

* Convert pull-request links

* Fix typo

* Update links in CHANGELOG.md, lint docs

* Add missing parens

* Remove banner images

* Add 1.0 release blog post

* Fix encoding bug

* Add truncate to 1.0 blog post

* TS syntax highlighting looks better than JS highlighting on Flow

* Add introductory sentences to older posts

* More highlighting fixes

* Fix mistake

* Fix more highlighting errors

* More highlighting fixes

* Add CSS fix

* fix truncate on 1.9.0 post

* fix truncate on 1.0.0 post

* Fix additional # and my name in 1.0.0

* Restore js -> ts on codeblocks
2017-12-31 15:23:17 +11:00
Ika 8a86c0cc9f fix(playground): fix report version (#3614) 2017-12-31 12:12:56 +11:00
Ika 6872ed8310 fix(markdown): replace newlines with hardlines in multiparser (#3611)
* test: add failing test

* fix(markdown): replace newlines with hardlines in multiparser
2017-12-30 10:33:58 -05:00
Ika 0af436cd47 fix(playground): use `prVersion` (#3613) 2017-12-31 00:54:36 +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
Jimmy Jia cfb8987ecd Revert Relay Classic non-support (#3606)
This reverts commit e8551b994d313ea023855a790c87acc4833150f9.
2017-12-29 21:14:08 +01:00
Robert Webb 833666a394 Support handlebars (#3534)
* feat(glimmer): initial HTML/Handlebars/Glimmer support

* feat(glimmer): support un-escaped mustache expressions

* fix(glimmer): add 'as |foo|' syntax

* fix(glimmer): support {{foo bar}} syntax

* feat(glimmer): implement all AST types

* feat(glimmer): implement if/else if/else

* test(glimmer): ignore leading/trailing whitespace from AST_COMPARE

* fix(glimmer): do not use trailing slash for void self-closing elements

* chore(build): disable html tests until we can sort out the glimmer dependency

* feat(html): complete rebase on parse5 addition

* Prettier Support For Glimmer VM/Handlebars

Polished Support for Sub Expressions
Added test cases for glimmer primitives
Added support for concat statements
Attempted to make element nodes work
Attempted block statements
Element Nodes are OK
Added support for block elements that are not else-if related
Added support for Else/If
Cleaning up
Rebase
Switch node 4 syntax
Update build

* Removed dead code/partials

* Added new lines to end of test files.

* Rebase after plugin change

* Added ignores to code coverage
2017-12-29 18:14:31 +01:00
Lipis 6a75f66731 Add Google Analytics on Playground (#3576) 2017-12-29 09:59:49 -05:00
Lucas Azzola bd78b3bfbe
Remove ALL_PARSERS, print ~ printWidth times (#3596) 2017-12-29 08:25:11 +11:00
Jimmy Jia bbfc450cd2 Support Relay Classic (#3595) 2017-12-28 14:20:25 -03:00
Lucas Azzola b0647cb2c9
Fix PR Preview Playground (#3592)
* Fix PR Preview Playground

* Use module.exports for Prettier export

* Keep index for backwards compatibility
2017-12-28 22:37:47 +11:00
Jimmy Jia b63c669ed9 Support plugins field in config (#3584)
* Actually support plugins field in config

* Resolve plugin parsers

* Fix default from CLI for "plugins"
2017-12-28 20:08:58 +11:00
artiebits 15a68394dd Move playground styles to the single CSS file (#3588)
* Move playground styles to the single css file

* Add separateCss property to siteConfig.js
2017-12-27 17:32:37 -05:00
Lucas Azzola 84dd11e875
Bump TypeScript to 2.7-insiders (#3580)
* Bump TypeScript to 2.7-insiders

* Update yarn.lock
2017-12-27 09:06:59 +11:00
Lucas Azzola 3a9b25b8bc
Add JSX to supported language list (#3579) 2017-12-27 00:20:10 +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
Josh Unger 358984ef0c add an example .prettierrc.js config (#3570)
* add an example .prettierrc.js config

* Update configuration.md
2017-12-26 18:26:09 +11:00
Joseph Frazier 7b211eab24 editorconfig: Only search for .editorconfig up to the VCS directory (#3559)
* editorconfig: Only search for .editorconfig up to $PWD

This addresses https://github.com/prettier/prettier/issues/3558

I'm not sure if this is the best way to find the "project root", but it
seems better than before.

* editorconfig: Search for `.editorconfig` up to the VCS directory

This uses [find-project-root] to find the nearest directory containing `.git` or `.hg`

See here for context: https://github.com/prettier/prettier/pull/3559#issuecomment-353756948

[find-project-root]: https://github.com/kirstein/find-project-root

* editorconfig: Add test for finding VCS directory

It's a little hacky in that the .hg file isn't really a Mercurial
repository, but it's enough to illustrate the intent. See here for
context: https://github.com/prettier/prettier/pull/3559#issuecomment-353857109
2017-12-26 18:16:09 +11:00
Jed Fox 1a3248bbc2 Change the changelog link to link to prettier/prettier (#3564)
* Change the changelog link to link to prettier/prettier

* Fix changelog links

* Double quotes
2017-12-26 00:04:02 -05: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
Josh Unger 62bfcac4c5 remove comment in prettier json example since comments are invalid in json (#3567)
remove comment in prettier json file example since comments are invalid in json
2017-12-26 01:15:18 +11:00
Lucas Azzola 9a1f3211c9
Add content{Start,End} to massageAST (#3566) 2017-12-25 20:39:34 +11:00
Jiawen Geng ea4bc9093e fix recursive in script (#3565)
See more here : https://github.com/prettier/prettier/issues/2078.
2017-12-25 20:16:50 +11:00
Christopher Chedeau c40b061b80
[vue] Introduce proper support for Vue Single File Components (SFC) (#3563)
There's a lot of demand for vue sfc (#2097). This introduces partial support for them: all the html is printed as is, except for the script and style tags which are printed using prettier. I believe that this should cover a lot of the use cases while being simple to support and if we want we can extend to more in the future.

I copy pasted the html parser used by vue (it's just a single 400 lines file) so that we don't run the chancesof conflicts. I'm also very conservative: I only print the style and script at the top level and for the lang attributes we support.

I expect this to be landable as is and provide value, review welcome :)
2017-12-25 01:15:33 +01:00