Commit Graph

171 Commits (240f09794bacf028915198f2638f8847d1120d2c)

Author SHA1 Message Date
Stephen Scott 6f6d974d27 Bump own prettier dependency version to 1.11.1 2018-02-28 15:26:27 -07:00
suchipi 74a132c4ba
Bump own prettier dependency version to 1.11.0 (#4058) 2018-02-26 22:03:56 -07:00
Zhongliang Wang d18da53e87 feat(typescript): Support conditional types (#4007)
* 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
2018-02-23 12:34:23 -07:00
Ika 8f6a32853c
feat(typescript): support definite assignment (`!:`) (#4020) 2018-02-22 01:40:57 +08: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
Evilebot Tnawi 17c0f9bfe1
feat(css): lowercase html tags (#3954) 2018-02-13 18:41:55 +03:00
Evilebot Tnawi c30d28003b
chore(css): update `postcss-values-parser` to latest version (#3960) 2018-02-12 20:46:54 +03:00
Lucas Azzola f87cbcf76e
Bump jest-docblock to 22.2.2 (#3947) 2018-02-11 17:42:08 +11:00
Christopher Chedeau 9ba0d69cb9
Upgrade flow to 0.64 (#3899)
* Upgrade flow to 0.64

This also enables spread operator on jsx on the flow parser:

```js
<div>{...list}</div>
```

I had no idea it was even a thing.

I had to comment out a flow test that no longer parses, but it's no longer in the flow repo and the comment said that it shouldn't be working anyway so I don't think it's going to be a problem.

* Fix build script
2018-02-06 09:01:58 -08:00
Evilebot Tnawi f5e74cd70a
fix(css): at rules improve formatting and tests (#3828) 2018-02-02 18:06:47 +03:00
Ika 84c603623d
feat: support external options (#3775)
* refactor: wrap

* refactor: replace

* refactor: replace

* refactor: replace

* refactor: extract

* refactor: logger

* refactor

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* feat(support): add `showInternal` option

* refactor: use internal

* refactor

* refactor: extract

* refactor: extract

* refactor

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: reorder

* refactor: remove unnecessary

* refactor: reorder

* refactor: move

* refactor

* refactor

* refactor

* refactor: remove unnecessary

* feat: external options from CLI

* refactor: push/pop plugins

* feat: external options from config file

* refactor: remove unnecessary

* refactor

* refactor

* refactor

* fix: use `json-stable-stringify`

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: move

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: extract

* refactor: move

* refactor: extract

* docs: add comments

* refactor: sort

* refactor: sort

* refactor: rename

* refactor: remove unnecessary

* style: remove trailing whitespace
2018-01-28 00:24:25 +08:00
Evilebot Tnawi a3bf378259
fix: handle YAML front matter block (#3802) 2018-01-24 19:44:09 +03:00
Ika 08b9e07207
fix(markdown): update remark-parse to v5.0.0 (#3780)
* fix(markdown): update remark-parse to v5.0.0

* test(markdown): ensure links with entities printed correctly

* test(markdown): ensure lists  interrupted by headings
2018-01-21 12:31:30 +08:00
Ika dc26445e51
refactor(options): use supportOptions to generate CLI options (#3622)
* refactor(cli-constant): use supportOptions

* refactor(options): use supportOptions

* refactor(cli-util): use supportOptions

* fix: do not infer parser in multiparser

* chore: remove unnecessary package

* chore: trigger another travis build

* test: add kebab-case test to ensure no regression

* test: update snapshots
2018-01-18 15:26:27 +08:00
Lucas Azzola dd78f31aaf
Run production tests on npm package (#3730)
* Run production tests on npm package

* Put back fast finish
2018-01-13 03:19:20 +11:00
Lucas Duailibe d0d5845af1 Bump prettier's prettier to 1.10.2 2018-01-11 00:04:30 -02:00
Lucas Azzola a10418ee80
Bump Prettier to 1.10.1 (#3699)
* Bump Prettier to 1.10.1

* Fix relative paths
2018-01-11 01:13:09 +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 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
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
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
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
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
Simen Bekkhus 36727421c2 chore: use scoped babel package (#3529) 2017-12-20 19:36:33 +11:00
Lucas Azzola 5e81e75601
Add plugin:prettier/recommended (#3508)
* Add plugin:prettier/recommended

* Revert eslint-plugin-prettier docs changes
2017-12-18 08:39:31 +11:00
James Henry 5feb76f13f Update tsep to v11 and update snapshot (#3471)
* Update tsep to v11 and update snapshot

* Remove unneeded TSNamespaceFunctionDeclaration
2017-12-14 17:44:59 +11:00
Lucas Duailibe 4090bd6303 Update prettier's prettier to 1.9.2 2017-12-12 01:55:44 -02:00
James Henry dc91108453 Update tsep and apply breaking changes (#3455) 2017-12-12 01:20:54 -02:00
Joseph Frazier 4f24892e53 Treat absent .editorconfig correctly (#3439)
This fixes https://github.com/prettier/prettier/issues/3432, I think.
2017-12-08 09:03:49 +11:00
Lucas Duailibe 36c6e8368f
Bump prettier to 1.9.1 (#3416) 2017-12-05 21:56:49 -02:00
Lucas Duailibe c34608f8ed
Bump editorconfig-to-prettier (#3412) 2017-12-05 19:01:48 -02:00
Lucas Azzola c7c1d2e7a4 Upgrade Prettier to Prettier 1.9 (#3395)
* Upgrade to prettier@1.9.0

* Run eslint --fix

* Run prettylint --fix

* Fix playground with editorconfig script
2017-12-05 08:14:03 -02:00
Joseph Frazier cecf0657a5 Re-add EditorConfig support (undo #3213) (#3255)
* Revert "Revert "Respect EditorConfig settings" (#3213)"

This reverts commit d2241fc0d5.

* Comment out EditorConfig docs

See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769

* editorconfig: Support `indent_size = 0`

See https://github.com/prettier/prettier/pull/2760#discussion_r137447715
and c38b84c42a

* Revert "Comment out EditorConfig docs"

This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f.

* Mark EditorConfig functionality as v1.9.0+

See https://github.com/prettier/prettier/pull/3255#discussion_r150432508

* editorconfig: Upgrade editorconfig-to-prettier to 0.0.4

* editorconfig: Only enable for CLI, by default

https://github.com/prettier/prettier/pull/3255#issuecomment-348420546

* editorconfig: Add tests confirming that editorconfig is ignored by default in the API

https://github.com/prettier/prettier/pull/3255#issuecomment-348420546

* editorconfig: Add/fix CLI option parsing

* editorconfig: Move docs from configuration.md to options.md

* editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig`

Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792

* editorconfig: Update test snapshots

* editorconfig: Remove unnecessary options parsing code

Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560

* editorconfig: Move docs from options.md to api.md and cli.md

Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979

* resolveConfig: return null if both .prettierrc and .editorconfig are missing

Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613

* Don't add now-failing tests

The way these tests work, both `tests_integration/cli/config/.prettierrc`
and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`,
so the test wouldn't work even on master. Here's a way to confirm that:

```js
const path = require('path')
const assert = require('assert')
const prettier = require('./')

const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist'
console.log(prettier.resolveConfig.sync(file))
assert(prettier.resolveConfig.sync(file) === null)
```
2017-12-05 09:28:27 +11:00
Lipis 475b2ab630 chore: Update packages to the latest patches (#3377) 2017-12-04 13:28:56 -07:00
Brian Ng d52d721cd1 Bump babylon to 7.0.0-beta.33 (#3372) 2017-12-02 09:39:10 +11:00
Lucas Duailibe b2cca7eacc
Add support for JSX fragments (#3237) 2017-11-30 00:09:45 -03:00
Lucas Duailibe a778667a4f Bump typescript-eslint-parser 2017-11-29 18:27:19 -03:00
Lucas Duailibe d8f54b0f13 Use released version instead of insiders 2017-11-28 10:06:28 -03:00
Lucas Duailibe 2953ad0d03 Bump versions 2017-11-26 23:23:09 -03:00
Lucas Duailibe f9f056612f
Update flow to 0.59.0 (#3238) 2017-11-26 23:14:45 -03:00
Ika 76efb33e75 chore: setup markdown formatting (#3224)
* chore(deps): upgrade prettier to v1.8.2

* chore: setup lint-docs script

* docs: add `<!-- prettier-ignore -->`s

* docs: format docs

* Revert "docs: format docs"

This reverts commit 6dba903987dddc498cb589ca311905f25b6aee53.

* chore(prettierrc): set `--no-prose-wrap`

* docs: format docs

* Revert "docs: format docs"

This reverts commit 139bd744b6921916be8fac4fa3bab83bae5d12df.

* docs: tweak

* docs: format docs

* chore: rename .prettierrc

* chore: rename back to .prettierrc

* chore: split out third-party

* refactor: fix linting

* chore: do not split out third-party on website
2017-11-22 22:27:40 +11:00
Ika d08df0b221
fix(markdown): handle punctuation variants (#3254)
* fix(markdown): handle punctuation variants

* docs: add comment
2017-11-13 00:09:04 +08:00
Lucas Azzola d2241fc0d5
Revert "Respect EditorConfig settings" (#3213)
* Revert "Respect EditorConfig settings (#2760)"

This reverts commit 8f58ca0f48.
2017-11-09 11:38:58 +11:00
Joseph Frazier 8f58ca0f48
Respect EditorConfig settings (#2760)
This fixes https://github.com/prettier/prettier/issues/42.
It adds support for .editorconfig's `indent_style`, `indent_size`, `tab_width`,
and `max_line_length` properties.

It doesn't support the `end_of_line` property as described in
https://github.com/prettier/prettier/issues/42#issuecomment-327073326,
but that could be added later. The same goes for `quote_type`
(https://github.com/prettier/prettier-atom/issues/293#issue-267288335).

* Make test .prettierrc not set config for all file extensions

This makes it easier to keep tests isolated.
2017-11-08 14:30:28 -05:00
Ika 76ee59a191
chore(deps): update prettier to 1.8.0 (#3167)
* chore(deps): update prettier to 1.8.0

* refactor: fix linting
2017-11-07 16:42:38 +08:00
Lucas Azzola 71a5533c4e
Move all docs to website (#3139)
* Sync README -> docs/options.md

* Sync README -> docs/*.md

* Misc fixups

* Remove markdown-toc

* Remove insert-pragma from ToC

* Never again!

* Move all docs to ./docs

* Remove yarn toc

* Fix inter-doc links

* Fix links in footer

* Clean up README.md

* Add basic description to README.md

* Use flat badges

* Move editor guides to website

* Improve prettier-ignore docs

* Fixup bad find/replace

* Add JSON to README

* Fix custom parser API link

* Fixup GitHub centering, add downloads badge

* Add 1.8 docs

* docs(website): mention markdown on homepage (#1)

* Add intro

* Add watching-files.md

* Fix markdown syntax highlighting

* Switch back to .md links
2017-11-07 14:39:07 +11:00
Ika 1d4848b37c chore(deps): upgrade patch-level dependencies (#3153)
* chore(deps): update jest-docblock to 21.3.0-beta.7

* chore(deps): upgrade patch-level dependencies

* test: update snapshot
2017-11-07 00:38:37 +11:00
Brian Ng d90aec1a1d Add test for nested ternary with arrow func (#3039) 2017-10-16 09:09:57 +11:00
Ika c27cc7ff45 feat(markdown): support CJK and emoji (#3026)
* refactor: extract `splitText`

* fix: respcet CJK width in table

* test: add failing test

* fix: support emoji

* test: add failing test

* feat: support CJK character

* feat: enable adding whitespace between non-CJK/CJK-character by default

* fix: do not print softline at node that is sensitive to its identifier

* fix: treat full-width whitespace as CJK punctuation

* disallow leading/trailing full-width whitespace

* feat: remove `--split-cjk-text` option and enable it by default

* refactor: simplify regex and remove unnecessary `g` flag
2017-10-14 23:57:31 -05:00