Commit Graph

459 Commits (e742a1c80bb4959832887c651e03ba574769f1b0)

Author SHA1 Message Date
Lucas Duailibe d0d5845af1 Bump prettier's prettier to 1.10.2 2018-01-11 00:04:30 -02:00
Lucas Duailibe 63a9561807 1.10.2 2018-01-10 23:55:34 -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 cf511ec2e9 1.10.1 2018-01-10 23:39:06 +11:00
Lucas Azzola bae21cb166 1.10.0 2018-01-10 23:08:15 +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
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
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
Lucas Duailibe 76c5d91ce6 1.9.2 2017-12-12 01:15:12 -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 a2c0a78cef 1.9.1 2017-12-05 21:33:19 -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
Lucas Azzola 35fc6a6671 1.9.0 2017-12-05 10:23:51 +11: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 4d0acacb81 Merge branch 'master' into update-ts 2017-11-28 10:05:24 -03:00
Lucas Duailibe f514d1e93f Docs build script (#3332)
* Remove artifacts from repo

* Remove docs stuff from build script

* Add new docs build script

* Add 'third-party' shim in playground worker

* Build from src if it's a PR

* Add command to package.json and remove old stuff from travis
2017-11-28 09:27:25 +11: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
Anton a0c95cf862 UTF8-BOM - if input string has BOM that mean output string also should have it (#3283)
The issue that prettier lost BOM and mean convert UTF-8 with BOM to just UTF-8
2017-11-21 14:38:21 -07: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 fba2e6c92d 1.8.2 2017-11-09 21:28:38 +11: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
Lucas Azzola fdd0dbfdd2 1.8.1 2017-11-07 23:38:55 +11: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 d5666f2b92 1.8.0 2017-11-07 14:58:44 +11: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
Lucas Azzola e436adae04
Implement getSupportInfo() and use it for inference (#3033)
* Implement getSupportInfo() and use it for inference

* Add comment with source of languages.yml

* Fix build, pin semver

* Simplify test snapshots

* Remove stray 'type' property

* Fix parser being overwritten

* Don't infer unreleased parser from extension

* Add CLI and docs for support info
2017-11-03 18:06:25 +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
Ika f009a96ae4 fix(doc-printer): use `string-width` (#3015)
* refactor(doc-printer): use `string-width`

* test: add test case
2017-10-12 02:27:02 -05:00
Ika 9f6f3e7355 feat: support markdown (#2943)
* feat(markdown): inital implementation

* feat(markdown): support strong

* fix: add missing default value

* feat(markdown): support inlineCode

* feat: support delete

* feat: support link

* feat: support image

* feat: support blockquote

* feat: support heading

* feat: support code

* feat: support yaml

* feat: support html

* feat: support list

* feat: support thematicBreak

* feat: support table

* feat: support linkReference

* feat: support imageReference

* feat: support definition

* feat: support footnote

* feat: support footnoteReference

* feat: support footnoteDefinition

* test(cli): update snapshots

* refactor: extract SINGLE_LINE_NODE_TYPES

* refactor: printChildren

* fix: correct newlines

* test: add trailing newline

* fix: blockquote formatting

* fix: node types

* fix: break line correctly

* fix: remove unnecessary properties to make AST_COMPARE happy

* fix: escape `|` in tableCell content

* fix: unexpected line break

* fix: ast difference from loose list

* fix: html break lines

* refactor: fix linting

* fix: normalize ast

* fix: escape specific chars

* test: add more tests

* fix: build markdown parser

* chore: remove unnecessary *.log

* fix: escape html entity

* feat: support prettier-ignore

* fix: line break for non-loose listItem

* feat: support formatting `code` based on `lang`

* fix: add `jsx` and `tsx`

* fix: use multiparser

* refactor: fix linting

* test: update test case 😉

* feat: switch to `_` style emphasis

* fix: sequence list should use different prefix

* test: add tests

* fix: do not print additional new line after `prettier-ignore`

* fix(list): enforce `1.` to avoid unnecessary git diff

* feat: enable `commonmark` option

* feat: support `break`
* fix: escape backslash
* refactor: escape html entity using backslash

* fix: respect autolink-style link

* feat: support md`...` and markdown`...`

* docs: replace ands with commas

* fix: respect indented code block

* fix: respect html entity

* docs: add docs for modified MDAST

* fix: inlineCode is breakline-able

* feat: support backtick in inlineCode

* feat: support a-lot-of-backtick in fenced code block

* feat: use `~~~`-style code block in js template

* fix: respect escaped chars

* fix: use `*`-style emphasis for invalid `_`-style output

* test: add test cases

* fix: use `- - -`-style thematicBreak to avoid conflict with yaml

* fix: remain the same content for linkReference identifier

* fix: `inlineCode` gap can be a line break

* fix: `html` should not print trailing spaces if it's in root

* refactor: fix typo

* fix: wrap `definition`'s url if there's whitespace

* fix: remove unnecessary whitespace at the end of paragraph

* fix: fix: remove unnecessary whitespace at the start of paragraph

* fix: setence children length is possible 0

* fix: support continuous ordered list

* fix: do not print addtional hardline after loose list

* fix: use double-backtick style for single-backtick value in inlineCode

* fix: support nested emphasis

* fix: support space-url in link/image

* fix: escape `)` in link/image url

* fix: support single-quote in link/image/definition title

* fix: respect alt in image/imageReference

* fix: use `*`-style thematicBreak in list

* fix: loose/tight list linebreaks

* fix: print third linebreak before indented code block with a tight list in the previous

* test: move bug cases

* fix: remove unnecessary linebreaks

* refactor: fix typo
2017-10-12 09:46:44 +11:00
Ika f7907b9282 fix(doc-printer): respect CJK width (#3003)
* test: add failing test

* fix(doc-printer): respect CJK width
2017-10-11 00:32:45 -05:00
Jake 50f3e646c7 Add option to insert @format to first docblock if absent (#2865)
* Add option to insert @format pragma if absent

prependPragma --> insertPragma

add tst dir, move stripBom, add to README, update snapshots

remove noise from test + update snapshots

use jest@test new functions, update docs, rerun snapshots

fix accidental upgrade to jest@test

update jest-docblock again to latest with strip()

updated snapshot

* updated snapshots

* revert jest dep change

* apply a trim to parsed comments

* remove empty object

* Revert "apply a trim to parsed comments"

This reverts commit 467f71ce5f4b4f8a1b5c4474ee0484bc96c92141.

* rerun snapshots with proper jest version

* pin jest-docblock to latest @test release

* comment out docs for new feature from readme

* remove leading newlines

* ensure blank line between docblock and rest of file

* remove backtick string
2017-10-06 19:37:14 +11:00
Lucas Azzola 2e655a3755 1.7.4 2017-10-03 19:46:42 +10:00
Lucas Azzola 33a1f59e01 Ensure package is published from dist/ with correct version number (#2963) 2017-10-03 19:34:08 +11:00
Ika d9737e6ffa test: fix snapshots (#2957)
* test: trigger test to check its status

* test: update snapshots

* refactor: use strip-ansi
2017-10-02 19:56:34 +02:00
Ika 26254ece0f chore(deps): pin dependencies (#2953) 2017-10-02 17:58:21 +02:00
Ika c7f9bb5731 chore(deps): update cosmiconfig to v3.1.0 (#2952) 2017-10-02 13:01:32 +11:00
Lucas Azzola 3329ee022f Upgrade prettier to 1.7.3 (#2940) 2017-09-30 14:28:53 +02:00
Lucas Azzola ecf0281b31 1.7.3 2017-09-30 20:48:10 +10:00
Simon Lydell 51d123b3f1 Update postcss-values-parser (#2928)
My PR has been merged and released to npm, so no need to depend on my
fork anymore.
2017-09-28 19:59:14 +02:00
Stephen Scott 75781a6d16 1.7.2 2017-09-27 17:20:13 -06:00
Stephen Scott c2bc33b3ad 1.7.1 2017-09-27 11:00:29 -06:00
Lucas Azzola f77e471b0c Upgrade to ts2.5.3-insiders (#2842) 2017-09-27 15:43:17 +10:00
Simon Lydell c6bac7cfe6 Split Less and SCSS parsing into different parsers (#2844)
* Split Less and SCSS parsing into different parsers

Now, .less files are always parsed with postcss-less, and .scss files
areare always parsed with postcss-scss. This:

- Is less hacky.
- Is meant to avoid issues like #2829.
- Is probably more performant.

`parser: "postcss"` and `--parser postcss` continue to work like before:
First trying postcss-less, and if that fails, postcss-scss, unless a
regex says that we should try in the opposite order. The new values for
the parser option are "postcss-less" and "postcss-scss".

* Remove postcss from package.json since it is not used

* Rename parser-less to less and parser-scss to scss

* Deprecate parser:postcss in favor of parser:css

* Fix CSS tests
2017-09-26 07:08:11 +02:00
Ika 70f5165bb1 fix(typescript): allow symbol type (#2899) 2017-09-26 12:34:31 +10:00
Ika 4435ecbc7b fix(cli): validate options for every `config-precedence` (#2894)
* fix(cli): validate options for every `config-precedence`

* refactor: use camelcase

* refactor: reduce duplicate code

* refactor: rename function

* refactor: rename parameter
2017-09-25 21:04:25 +02:00
Ika 184e368a9a feat: support detailed `--help` (#2847)
* feat: support detailed --help

* refactor: put alias first, separate with comma

* feat: support detailed --help for --no-option

* docs: add missing type

* docs: remove `This requires node 8 or a transform`

* docs: remove config-precedence's choice descriptions in option.description

* docs: replace `option-name` with `flag`

* docs: update docs for `choices`

* docs: update `help` description

* docs: update error message

* docs: replace `undocumented` with empty string

* refactor: extract `getOptionDefaultValue`

* refactor: dynamically generate `defaults to ...`

* refactor: extract `getOptionWithLevenSuggestion`

* refactor: extract `createChoiceUsages`

* refactor: remove `optionTitleName`

* test: add `--help` tests for all options

* fix: handle `--help --help`

* feat: support `--help <alias>`

* refactor: use `flattenArray`

* feat: handle `--help <unknown>`

* docs: add description for `semi`, `color` and `bracket-spacing`

* fix: remove unnecessary option in `--help`
2017-09-21 07:54:13 +02:00
Daniel Tschinder eb776b7635 Update cosmiconfig to 3.0.1 to avoid memory leak (#2848) 2017-09-18 09:09:07 +10:00
Nick Ribal 592f99fde6 Enable cosmiconfig rcExtensions (#2749)
* Enable cosmiconfig rcExtensions; add two tests

* Remove default value; make integration input files self descripting; update all integration snapshots

* Add engines field to package.json
2017-09-17 02:47:53 +10:00
Lucas Azzola 48899289da Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem (#2843)
* Upgrade cosmiconfig to v3, remove hardcoded combinatoric problem

* Fix indendation change from 1.7

* Ensure default value for useCache is true

* Pin mem version
2017-09-16 20:24:08 +10:00
Joseph Frazier 2c59fb2f07 Upgrade prettier dependency to 1.7.0, fix lint (#2821) 2017-09-15 15:49:55 -04:00
Brian Ng 5bd8ca472b Bump Babylon (#2831) 2017-09-15 17:26:35 +02:00
Stephen Scott bcb4224205 1.7.0
🎉
2017-09-14 11:21:33 -06:00
Simon Lydell 1be06af923 Merge pull request #2814 from ikatyang/chore/jest-21
chore(deps): update jest-* to v21.1.0
2017-09-14 13:21:50 +02:00
Ika c100911bbc chore(deps): pin cosmiconfig (#2815) 2017-09-14 19:10:55 +08:00
ikatyang 6f9da6441c chore(deps): update jest-* to v21.1.0 2017-09-14 13:13:03 +08:00
Will Binns-Smith d5e5d66407 Add option to require @prettier or @format pragma (#2772)
* Add option to require @prettier or @format pragma

Fixes #2397.

Inspired by `eslint-plugin-prettier` and the discussion in #2397, this
implements requiring a special comment pragma to be present in a file's
first comment in order to be formatted.

This will help large codebases gradually transition to prettier over
time without tons of churn or large code reviews.

I implemented this as a standard prettier "option", not just a typical
`argv` flag, as it is relevant in both the cli and the api. This way it
can be provided programmatically, on the command line, or standardized
in a prettierrc file so like the style options, every user can use this
setting consistently and only apply prettier to relevant files, no
mattier their editor integration.

This requires the pragma begin with `@` (in fact it's inserted if the
user doesn't provide it). Currently the usage implies it must be
"prettier" or "format", but it can technically be any value other than
"none", which is similar to the `trailingCommas` option.

cc @vjeux

* Don't quote anything in runPrettier; this is usually handled by a shell

* Make --require-pragma a boolean option

* Use jest-docblock to find pragmas without parsing the ast

* Clarify docs

* includes -> indexOf

* Move test out of integration
2017-09-13 09:03:18 -07:00
James Henry 9c4ec68afd Fix: TypeScript never keyword (fixes #2718) (#2756) 2017-09-05 11:37:22 -07:00
Ika c1707cf40c chore(deps): remove `cross-spawn` (#2739) 2017-09-03 16:10:58 +02:00
Joseph Frazier a9520d31b1 Upgrade chalk to v2.1.0 (#2732)
This fixes a warning when installing prettier from github:

    warning prettier > chalk@2.0.1: Please upgrade to Chalk 2.1.0 - template literals in this version (2.0.1) are quite buggy.
2017-09-03 14:18:27 +10:00
Joseph Frazier b50946f59b Fix cosmiconfig dependency branch (#2731)
The `3.0` branch was [merged] and [deleted],
so we should use the default branch now.

[merged]: https://github.com/davidtheclark/cosmiconfig/pull/78#event-1232367869
[deleted]: https://github.com/davidtheclark/cosmiconfig/pull/78#event-1232367884
2017-09-03 10:47:28 +10:00
Ika 088aa71b07 feat(resolve-config): add `.sync()` method (#2722)
* feat(resolve-config): add `sync` option

* docs(readme): add `sync` option

* fix(clearCache):  always clear both

* chore(deps): switch to 3.0 branch

* feat: replace `sync` option with `.sync()`

* docs(readme): update `.sync()`
2017-09-01 20:17:07 +10:00
Levi Thomason 828a7b8f0d docs(readme): add and sort cli options (#2700)
* chore(build): auto generate toc

* docs(readme): add and sort cli options

* refactor(build): move toc to seperate task
2017-08-29 13:39:49 -07:00
Christopher Chedeau c3506198c0 1.6.1
Small regression fixes
2017-08-29 09:00:14 -07:00
Brian Ng 8bb8eaf941 Bump babylon to 7.0.0-beta.22 (#2687) 2017-08-29 09:11:32 +10:00
Joseph Frazier 82ad911ddc Upgrade prettier dependency to v1.6.0, fix lint (#2681) 2017-08-28 12:22:51 -07:00
Christopher Chedeau 571d92c5f7 1.6.0
https://github.com/prettier/prettier/releases/tag/1.6.0
2017-08-28 09:04:42 -07:00
Lucas Azzola 1e2da6c727 Support TypeScript 2.5 RC (#2672) 2017-08-26 05:36:50 -07:00
Simon Lydell 302d1d89cb Switch to postcss-values-parser with support for exponential notation 2017-08-22 18:50:10 +02:00
James Henry 23e0e90779 Update tsep and account for AST differences (#2647) 2017-08-21 12:27:35 -07:00
James Henry 5c539b06a4 Update: tsep version upgrade and changes to TS enum structure (#2641) 2017-08-19 11:10:38 -07:00
Lucas Azzola 3eed1933e1 Don't pass config path through to cosmiconfig (#2547) 2017-07-27 21:59:57 +10:00
Brian Ng 24e1aec306 Add support for flow opaque types (#2543) 2017-07-25 19:47:54 -07:00
Joseph Frazier a78d1389f6 Use babylon.parseExpression for JSON (#2476)
* Add comments showing parser arguments

Since this is how they are invoked, the comments make it easier to maintain.

* Use babylon.parseExpression for JSON

See https://github.com/prettier/prettier/issues/2378#issuecomment-314600778

Note that this doesn't yet print comments:

    echo '{/*comment*/"K":"V"}' | ./bin/prettier.js --parser json

* Remove parser-json.js

This reduces duplicate code in the built package.
See https://github.com/prettier/prettier/pull/2476#pullrequestreview-50181398

* Add test with block comment in JSON

* Fix test with block comment in JSON

* Add test with line comment in JSON

* Don't build now-redundant parser-json.js
2017-07-24 11:43:49 +10:00
James Henry 1c9962df67 Update tsep and account for TSTypeReference change (#2520)
* Update tsep and account for TSTypeReference change

* Check TSTypeReference in shouldHugType
2017-07-20 12:54:43 +02:00
Lucas Azzola b7fa01af17 Enable code coverage in CI (#2497)
* Enable code coverage in CI

* Disable codecov comment

* Ignore some statements from coverage reports
2017-07-16 21:49:37 +10:00
Lucas Azzola acab856b96 Integrate 1.5.3 hotfix (#2489) 2017-07-15 20:16:41 +10:00
Evilebot Tnawi 469059dc20 CLI: Support .ignore files (#2412)
Closes #2294
2017-07-11 23:33:46 +10:00
James Henry ee822f99b9 Update tsep and add test for destructuring assignment (#2443)
Fixes #2229
2017-07-11 09:11:18 +10:00
Lucas Azzola dcccfed366 Implement cosmiconfig for workspace configuration (#2434)
* Implement cosmiconfig

* Add resolveOptions API and extname support

* Add --resolve-config and --config, rename resolveOptions to resolveConfig

* Move color to top-level CLI options

* Fix unknown param warning

* Change from {} to null when no config is found

* Change override API to emulate eslint

* Add test for eslint-style overrides

* Delete overrides from resolveConfig
2017-07-10 22:26:36 +10:00
Simen Bekkhus 1b4846b67d Format prettier with newer prettier (#2431) 2017-07-08 14:07:39 +02:00
Simen Bekkhus 3e184d8f37 Upgrade chalk (#2432) 2017-07-08 14:07:03 +02:00
Evilebot Tnawi a0cadad222 feat(cli): support multiple patterns with ignore pattern (#2356) 2017-07-04 17:55:06 +02:00
Joseph Frazier ead0bc0a9c Use eslint-plugin-import to detect devDependencies used in production (#2387)
This solves the same problem as https://github.com/prettier/prettier/pull/2386,
but at lint-time, rather than only on Travis.
2017-07-04 17:53:45 +02:00
Joseph Frazier 782835de75 Move strip-bom from devDependencies to dependencies 2017-07-03 17:35:28 -04:00
Lucas Azzola 65bbbaec58 Add content to website (#2377)
* Add content to website

* Fix linting error

* Cleanup, extract content to JSON files
2017-07-03 12:48:05 +02:00
Frank Li 80f38ce75b Website (#2241)
* initial docusaurus set-up

* Delete why-prettier.md

* Update README.md

* Update Docusaurus structure

* Update package.json

* Update siteConfig.js

* Remove ~ files

* chore(website): update build script

* Add redirect script

* Get eslint working on website

* Fix to allow for baseUrl of '/'

* Update docusaurus version

* Update README.md

* Change redirect script to use baseUrl of '/'

* Fix index.js formatting

* Load redirect script

* General cleanup

* Add projects using prettier
* Update service worker to just scope to playground
* Reduce link repeatition
* Link "Try it out" button to /playground/
* Make header of playground approximately same as main site
* Remove .html from URLs (e.g. users.html -> users/)
* Link Gitter Chat

* Add circleci.yml

* Only run builds on master

* Do deployment using Travis
2017-07-02 10:14:24 +10:00
Lucas Azzola 6f9824778d Strip BOM before parsing, fixes #2362 (#2373) 2017-07-01 18:11:13 +02:00
Simon Lydell 20a0723fc1 Convert build.sh into build.js using shelljs
For better cross platform compatibility.
2017-06-28 22:34:59 +02:00
Simon Lydell ba51d2dfa8 Enable linting of build scripts 2017-06-28 21:37:33 +02:00
Christopher Chedeau 5db9407d78 1.5.2 2017-06-27 20:33:35 -07:00
Christopher Chedeau adc71ef6ae 1.5.1 2017-06-27 13:42:31 -07:00
Christopher Chedeau 6f4eade422 Go back to babylon beta 13 (#2289)
Fixes #2286
2017-06-27 11:51:23 -07:00
Christopher Chedeau 500cf98c06 1.5.0 2017-06-27 10:09:59 -07:00
Joseph Frazier 785970a265 Use eslint-friendly-formatter to make errors clickable (#2200)
This changes the eslint error formatting from:

    /Users/josephfrazier/workspace/prettier/src/printer-postcss.js
      3:31  error  Insert `;`  prettier/prettier

to:

    ✘  prettier/prettier  Insert `;`
    src/printer-postcss.js:3:31
    const util = require("./util")
                                   ^

which makes them clickable in terminals like iTerm2 and Guake. See
[eslint-friendly-formatter] for details.

[eslint-friendly-formatter]: https://github.com/royriojas/eslint-friendly-formatter
2017-06-20 18:38:33 -07:00
Brian Ng 7cef77433a Bump babylon version (#2205) 2017-06-20 08:36:14 -07:00
Lucas Azzola eccb17495a Website: speed up load time, enable service worker (#2172)
* feat(website): speed up website load 💥

* chore(package): fix bad merge
2017-06-18 20:25:27 +10:00
Lucas Azzola 82a0bb5c5e fix(typescript): upgrade tsep, fixes #2143 (#2183) 2017-06-17 17:10:22 -10:00
Joseph Frazier a42db30946 Add JSON support (#2173)
* Add JSON support

This fixes https://github.com/prettier/prettier/issues/1973 by using
[json-to-ast] to parse JSON, then converting the AST into a
mostly-Babylon AST, so as to piggyback on the existing printer logic.

Identifiers and literals are currently printed verbatim from the input,
but this could be improved upon later (at least for literals, not sure
about identifiers).

[json-to-ast]: https://github.com/vtrushin/json-to-ast

* Rename `json-to-ast` parser to `json`

See https://github.com/prettier/prettier/pull/2173#discussion_r122574644

* json: Use createError to have a pretty error

See https://github.com/prettier/prettier/pull/2173#discussion_r122574748

* json: Transform AST without mutations

See https://github.com/prettier/prettier/pull/2173#discussion_r122574690
2017-06-17 10:36:42 -10:00
Joseph Frazier 59a294fcc9 Fix dist/ build by upgrading typescript to nightly (#2174)
Before, this error happened upon `yarn build`:

    🚨   (commonjs plugin) Binding arguments in strict mode (49161:16) in /Users/josephfrazier/workspace/prettier/node_modules/typescript/lib/typescript.js
2017-06-17 09:00:21 -10:00
Iaroslav Voloshchuk 89971285e4 Move devDependencies to dependencies (#2124)
fixes https://github.com/prettier/prettier/issues/2121

* move runtime deps to npm deps

* Fix (dev)dependencies

See https://github.com/prettier/prettier/pull/2124#discussion_r121795774

* Remove dependencies from dist/package.json

See https://github.com/prettier/prettier/pull/2124#issuecomment-308259138
2017-06-17 10:36:50 -04:00
James Henry d8f29d2d5b Update tsep (#2153)
* [WIP] Update tsep

* Fix TypeParameter union parens
2017-06-15 08:55:23 -10:00
James Henry 0410949984 Lock tsep to specific commit (#2152) 2017-06-15 22:45:38 +10:00
Joseph Frazier cb44125a21 Let `prettier --stdin` work with keyboard input (#2147)
This uses [get-stream] instead of [get-stdin], since the latter just
gives an empty string if process.stdin is a TTY
(see https://github.com/sindresorhus/get-stdin/issues/21)

[get-stream]: https://github.com/sindresorhus/get-stream
[get-stdin]: https://github.com/sindresorhus/get-stdin
2017-06-15 09:57:29 +10:00
Christopher Chedeau abfdbe1896 Upgrade typescript to 2.4 (#2120)
Fixes #2117
2017-06-13 09:47:40 -07:00
Lucas Azzola d00956d51d feat(html): add parse5/htmlparser2 printer (#2083) 2017-06-09 19:22:59 -07:00
Christopher Chedeau 4758f5a80d 1.4.4
Oops, I forgot to re-run the build scripts, this broke postcss
2017-06-07 16:38:05 -07:00
Christopher Chedeau f702c2c614 1.4.3
* Fix support for node 4 (#1988)
* Fix website on iOS Safari (#1970)

Formatting change:
* Position JSX whitespace (`{" "}`) at the end of lines (#1964)

Lots of small fixes, mainly for TypeScript.
2017-06-07 15:48:34 -07:00
Martin V 820e39b2b3 Clean up build script, add Babel for docs js bundles (#1970)
* Clean up build script, add Babel for docs js bundles

* Update package.json
2017-06-07 15:20:48 -07:00
Joseph Frazier 1f3665fba0 Upgrade prettier to v1.4.2, fix lint issues (#2018)
This corrects the regressions seen in commit
26e829b (https://github.com/prettier/prettier/pull/1888)
2017-06-06 18:05:22 -07:00
Jon Wong e33d6773d6 Adding support for `graphql` (#1982)
* Initial GraphQL implementation

This is the bare minimum amount of code to make graphql work. Turns out it's pretty easy to add support for other languages :)

* Fixing support for `graphql` parsing

There was a few structural changes with the addition of CSS and Typescript that we had to take into account.

* Fixing file glob, adding `graphql` to yarn.lock

* Removing extraneous file

* Adding `graphql` parser, style changes

* Splitting out graphql printer

* Removing merge conflict

* Fixing yarn.lock

* Addressing code review, using `createError`

* Adding release config

* Using exact version

* Removing destructuring
2017-06-05 12:34:08 -07:00
James Henry 5f5980b217 Revert to official tsep and bump TS to 2.3.4 (#1972) 2017-06-05 22:15:00 +10:00
Christopher Chedeau 86febfe797 1.4.2 2017-06-03 08:54:22 -07:00
Christopher Chedeau f56f9e5e8f 1.4.1
This fixes all the TypeScript problems reported and a few regressions from 1.4.0.
2017-06-02 16:25:57 -07:00
Christopher Chedeau 2b6c1cd27e Update typescript-eslint (#1924)
This applies https://github.com/eslint/typescript-eslint-parser/pull/308 and https://github.com/eslint/typescript-eslint-parser/pull/303 to fix issues on prettier.

Fixes #1870
2017-06-02 16:19:15 -07:00
Simen Bekkhus 584bf4ecbf Upgrade babel code frame (#1902)
* Upgrade babel code frame

* Get better marker for parsing errors in postcss-values-parser
2017-06-02 14:11:05 -07:00
Simen Bekkhus 862a2d610c Used published version of uglify-es (#1897) 2017-06-02 13:46:13 -07:00
Joseph Frazier 26e829b987 Upgrade prettier to v1.4.0, fix lint issues (#1888) 2017-06-02 11:48:43 -07:00
Christopher Chedeau 7fd71fa386 1.4.0 2017-06-02 08:55:04 -07:00
Lucas Azzola 38eec13a03 TypeScript: temp fix for missing readonly keyword (#1865)
* fix(typescript): temp fix for missing readonly keyword, fixes #1845

* fix(typescript): use non-master commit from tsep
2017-06-02 08:09:24 -07:00
Christopher Chedeau fdce975e5d Move all the dependencies to dev dependencies and --exact (#1850)
Since we are now bundling all the dependencies, we can have prettier be dependency-free on npm <3
2017-06-01 20:38:25 -07:00
Christopher Chedeau d55640087e Fix building docs (#1838)
The hackiness continues! I'm now bundling an existing bundle again in order for it to get exported as a global variable :p There's likely a better solution, but it kind of works.

Because I have to regenerate the docs, I just tagged it as 1.4.0-beta and added typescript and postcss in there.
2017-05-31 13:37:35 -07:00
Christopher Chedeau f4296550db Introduce Webpack 2 to fix postcss bundling (#1836)
It turns out rollup doesn't use the same algorithm for bundling commonjs files when there are cycles as node, which breaks postcss: https://twitter.com/Rich_Harris/status/869021144191561729. Webpack works just fine with it.

This sucks to have this rollup/webpack frankenstein but I really want to be able to release and don't really want to spend yet another day or two trying to make it work well.
2017-05-31 11:59:33 -07:00
James Henry 920ceea77e Update tsep to latest master, reenable abstract interface test (#1795) 2017-05-29 23:26:53 +10:00
Christopher Chedeau 05b921efdd Build the dist/ with rollup (#1794) 2017-05-28 21:49:41 -07:00
Christopher Chedeau 5a828bedd1 Update eslint-typescript again (#1791)
Now fixes more issues ;)
2017-05-28 16:05:07 -07:00
Christopher Chedeau 97775dc94c Add support for SCSS (#1790)
We use a heuristic to figure out if it's a SCSS or Less file. And if it doesn't work, we try again with the other one. We do the same for JSX and TypeScript.

Fixes #1784
2017-05-28 15:01:47 -07:00
Christopher Chedeau 882b712c5f Update typescript-eslint (#1787)
It improves a few things.
2017-05-28 13:18:29 -07:00
Lucas Azzola e270032d37 chore(typescript): upgrade typescript-eslint-parser to 992f1fa (fixes #1769) (#1785) 2017-05-28 08:05:33 -07:00
Christopher Chedeau f3823276eb Enable loose mode for postcss-values-parser (#1766)
Fixes https://github.com/shellscape/postcss-values-parser/issues/29
2017-05-27 11:15:05 -07:00
Christopher Chedeau 5c462cc8e1 Remove ast-types (#1747)
Yay!
2017-05-26 11:54:43 -07:00
Christopher Chedeau 5e0fa00725 Upgrade typescript-eslint to 31ad3c (#1738)
Fixes #1737
2017-05-25 19:04:15 -07:00
Christopher Chedeau 2e92e4e17d Update to flow 0.47 (#1736)
Fixes #1469
Fixes #1457
Fixes #425
2017-05-25 17:00:36 -07:00
Christopher Chedeau 78ba808322 Initial CSS support (#1636)
I wanted to see how hard it would be to add support for CSS inside of prettier. Turns out, it's not that hard. I spent a few hours printing post-css values and getting all the stylefmt unit tests to not throw.
2017-05-24 10:52:12 -07:00
Michał Pierzchała 7a0df958dc Ignore node_modules when running prettier from CLI (#1683)
* Ignore node_modules by default

* Add integration test suite for --with-node-modules CLI arg

* Refactor tests to snapshots

* Disable eslint for purposely faulty files

* Fix node 4

* Fix prettier

* Gitignore only top-level node_modules
2017-05-23 14:19:04 -07:00
Brian Ng d608b7ba28 Bump Babylon and enable additional tests (#1668) 2017-05-22 15:31:53 -07:00
Joseph Frazier fa8408b53f Upgrade typescript parser, fix and run AST tests on Travis (#1657)
* Run `yarn` to update yarn.lock

* Upgrade typescript-eslint-parser, use JSXText instead of Literal for strings inside JSXElement

https://github.com/eslint/typescript-eslint-parser/pull/272 was merged,
so this fixes https://github.com/prettier/prettier/issues/1558

See here for more info about the new TSQualifiedName node type:
3491b4b73a

* Run AST comparison tests on Travis
2017-05-21 14:16:24 -07:00
Simon Lydell 378682350f Improve ESLint setup and fix errors (#1656)
* Improve ESLint setup

- Uses `eslint:recommended` + a handful more rules.
- Uses .eslintignore so that editors can understand which files to lint.
- Uses .eslintrc<strong>.js</strong> so more editors get syntax highlighting.

* Fix ESLint errors

About half of them were fixed by `eslint . --fix`.
2017-05-21 12:11:09 -07:00
Joseph Frazier d7aaaee0dd Add `lint` script, run it on Travis, prettify source code (#1634)
* Add `lint` script with eslint-plugin-prettier, use it in `format:all`

See https://github.com/prettier/prettier/pull/1634#issuecomment-302945967

* Run `lint` script on Travis

* Run Prettier on its own source code

This was done with

    npm run format:all
2017-05-21 11:00:16 -07:00
Simon Lydell bc5186e544 Run Prettier on all source files (#1648)
This commit updates `npm run format:all` to not only format .js files in
src/ and bin/, but also tests_config/ and scripts/, as well as all
jsfmt.spec.js files.

It also includes the result of running `npm run format:all`, except
changes to src/ and bin/.
2017-05-21 08:13:11 -07:00
Danny Martini e1fdf78863 upgrade typescript-elint-parser and enable most ts tests again (#1649) 2017-05-21 07:53:00 -07:00
Danny Martini fc60d548aa Fix/ts interface heritage (#1601)
* fix TSCallSignature

* fix TSTypeReference

* remove test with invalid syntax

* --wip--

* partially fix TSTypeReference

* get comments right for TypeScript interfaces
2017-05-20 03:15:50 -07:00
Danny Martini 19183e6452 fix TSInterfaceDeclaration, TSInterfaceBody, TSInterfaceHeritage (#1599) 2017-05-12 17:13:38 -07:00
Danny Martini c86a57a91e fix TSFunctionType (#1600) 2017-05-12 15:33:03 -07:00
Danny Martini 2c76bfe1e1 update typescript parser (#1578)
* update eslint-parser-typescript

* fix comment parsing

* disable all failing tests

* fix TSInterfaceDeclaration

* fix #1537

* only disable typescript tests for tests/function
2017-05-10 14:11:50 -07:00
Simen Bekkhus ed24bff251 Upgrade jest (#1534)
* Upgrade jest

* yarn upgrade
2017-05-06 07:40:40 -07:00
Christopher Chedeau 515a565a66 1.3.1 (hotfix) 2017-05-03 14:44:08 -07:00
Christopher Chedeau a81d5c1cd1 1.3.0 2017-05-02 13:15:15 -07:00
Lucas Azzola 7d1e24ea7d Add supertype tests and add TSAbstractClassProperty (#1467)
* feat(typescript): add supertype tests and add TSAbstractClassProperty

* chore(typescript): bump parser version

* fix(flow): allow both variance and accessibility mods
2017-04-30 17:41:19 -07:00
Christopher Chedeau 3161bd0787 Upgrade flow parser to 0.45 (#1447)
This fixes all the unicode issues and spacing between elements in array.

Fixes #1336
Fixes #1427
Fixes #770
2017-04-27 14:59:18 -07:00
Christopher Chedeau 88e004184b 1.2.2 2017-04-19 13:19:26 -07:00
Christopher Chedeau 076804c09c 1.2.1 2017-04-19 12:00:25 -07:00
Christopher Chedeau bc53920734 1.2.0 2017-04-19 11:01:44 -07:00
Christopher Chedeau ad637d0744 1.1.0
This fixes a regression from 0.22 around member expressions breaking and fixes no-semi placement around leading comments, plus some other minor fixes.
2017-04-13 18:40:04 -07:00
Christopher Chedeau 22f5ba0989 change semi default 2017-04-13 10:18:50 -07:00
Christopher Chedeau 23756cdc59 1.0 2017-04-13 09:28:42 -07:00
Jan Kassens b82220b20f Prittier printing of snapshots (#1190)
This uses a custom snapshot serializer to reduce escaping in snapshot files and
make them easier to read.

Snapshot serializers are documented here:
https://facebook.github.io/jest/docs/configuration.html#snapshotserializers-array-string
2017-04-12 13:41:51 -07:00
Simon Lydell dc93bdc983 Sync the Flow tests (#1163)
* Extract custom tests from tests/flow/

Approach:

1. Remove all .js files in tests/flow except .snap.js files.
2. Copy over all .js files from tests/ in the flow repo.
3. Go through the diff looking for deletions.
   - It was easy to see which deletions were due to changes in the tests
     due to updates in the flow repo.
   - For the rest of the deletions, I used `git blame` to verify that
     they had been added by us since the flow tests were copied over.

This makes tests/flow/ simply a copy of the tests from the flow repo,
making it easier to sync with the upstream flow tests in the future.

* Add a script for syncing the flow tests

* Sync the flow tests
2017-04-08 07:52:38 -07:00
Christopher Chedeau 1578e180f4 Add support for flow type spread in .43 and babylon beta8 (#1064)
Fixes https://twitter.com/ryyppy/status/844116626467438592
2017-04-04 14:52:16 -07:00
Brian Ng d9a4efcc35 Bump babylon to 7.0.0-beta.8 (#1118)
* Bump babylon version

* Enable flow predicate tests in babylon
2017-04-04 14:21:56 -07:00
Christopher Chedeau 569791a57a Update babylon to 7.0.0-beta.4 (#1047)
Fixes #700
2017-03-20 12:46:31 -04:00
Christopher Chedeau b012f7531e Fix comments inside of ObjectPattern (#1045)
ast-types was missing a type, I sent a PR on ast-type ( https://github.com/benjamn/ast-types/pull/211 ) which was merged and released (thanks @benjamn for being super quick!). So I'm upgrading ast-types and add the test in this PR.

Fixes #1007
2017-03-20 12:42:07 -04:00
Rasmus Eneman e41ed4955d [WIP] Add some typescript tests (#1033)
* Add some typescript tests

* fix: Remove extraneous colon in type parameter constraint

* style: Add missing newline at EOF in TS tests

* feat: Pretty print typescript object type annotations

* feat: Pretty print TSFunctionType

* fix: Type annotations was missing on class properties

* Add a new batch of tests

* Bump typescript-eslint-parser

* Add a new batch of tests and fix a syntax error in previous

* Bump typescript-eslint-parser
2017-03-19 08:06:52 -07:00
Simen Bekkhus 0fc8584827 Update repo links (#993) 2017-03-13 14:39:54 -07:00
Christopher Chedeau 344401c038 0.22.0 2017-03-09 09:15:40 -08:00
James Henry 72456bf06f [WIP] TypeScript Parser (#915)
* WIP immediate feedback

* typescript parser is drop-in replacement for flow parser

* Add new TypeScript Parser snapshots where drop-in replacement possible

* Snapshot updates after rebasing

* Remove unnecessary stripping of properties on TypeScript parser AST

* Remove annotated issues

* Move TS dependencies to dev for now
2017-03-08 13:18:13 -08:00
Christopher Chedeau b570154dd5 0.21.0 2017-03-03 14:03:36 -08:00
Christopher Chedeau e09bdd4447 0.20.0 2017-02-28 10:49:30 -08:00
Christopher Chedeau edf2bde590 Fix trailing commas in docs (#825)
I also added support for parser dropdown and stop minifying the bundle so that the flow parser actually works.

Fixes #816
2017-02-27 17:02:41 -05:00
Christopher Chedeau 1b9234a8c4 Update flow to 0.40 (#808)
This fixes the bug with comments swapped between `/*` and `//`

Fixes #755
2017-02-24 15:46:20 -08:00
Christopher Chedeau e0cac2049d 0.19.0 2017-02-23 09:52:55 -08:00
Brian Ng 543e62cd31 Revert babylon bump (#792) 2017-02-23 09:00:57 -08:00
Brian Ng 211deb527e Bump babylon & add test for async func decl (#790)
* Add test for async function declaration

* Bump babylon version
2017-02-23 09:32:20 -05:00
Rogelio Guzman e039ca888a Upgrade to Jest 19.0.1 (#779) 2017-02-22 10:28:17 -08:00
Rogelio Guzman d45e157563 Upgrade to Jest 19 (#762)
* Upgrade to Jest 19

* Use exact versions for Jest
2017-02-21 13:59:19 -08:00
Christopher Chedeau 848dfa3505 0.18.0 2017-02-16 09:28:26 -08:00
Christopher Chedeau 74fb4a43b1 0.17.1 2017-02-14 13:47:46 -08:00
Christopher Chedeau fbba7db6e2 0.17.0 2017-02-13 19:11:05 -08:00
Umidbek Karimov 97fd8a8d81 Log filename with [update] or [ignore] flags during `--write` process. (#584)
* Make `--write` logs more informative.

* Add format duration to logs.

* Use colors instead of [ignore] and [update] labels.

* Remove `colors` dependency.

* Use `chalk` to colorize logs.

* Print filename before `format` and add duration info later.

* Print filename before read error.
2017-02-07 14:03:48 -05:00
Christopher Chedeau 4df5250f74 Add --debug-check cli option (#627)
This let's you run `pp(x) === pp(pp(x))` across an entire codebase quickly. I think it's small enough that we can merge it in to master while we are nailing down all the issues.

You can see the output in #610
2017-02-07 10:04:44 -05:00
Christopher Chedeau 98d04d8c70 0.16.0 2017-02-05 18:28:20 -08:00
Christopher Chedeau b040be2206 0.15.0 2017-02-01 16:31:11 -08:00
Christopher Chedeau efc3ee0488 0.14.1 2017-01-30 09:56:01 -08:00
Christopher Chedeau f88c95031e 0.14.0 2017-01-30 09:41:09 -08:00
Christopher Chedeau 3f776bed3d 0.13.1 hotfix 2017-01-28 08:19:00 -08:00
Simon Lydell d548ef0790 Add missing jest-validate to dependencies (#500) 2017-01-28 07:49:57 -08:00
Christopher Chedeau 94b137ac47 0.13.0 2017-01-27 14:41:30 -08:00
Christopher Chedeau caf7f2a6f2 0.12.0 2017-01-26 20:24:17 -08:00
daleroy 69b5d098e9 Update package.json, use ast-types 0.9.4 (#453)
Add Flow's DeclareExportAllDeclaration type has been merged into benjamn/ast-types so the forks are now in sync.
2017-01-24 18:08:35 -05:00
Michał Pierzchała 66fe2f78fa Validate user-provided config with jest-validate (#301)
* Validate user-provided config with jest-validate

* Don't use object shorthand

* Update jest-validate to 18.2

* Fix Node4 destructuring from require

* Make use of jest-validate for deprecation message

* Remove chalk reference
2017-01-23 16:33:58 -05:00
Christopher Chedeau ef531274f7 0.11.0 2017-01-23 09:40:01 -08:00
Simon Lydell bb1884320b Use babel-code-frame for syntax errors (#367)
* Use babel-code-frame for syntax errors

* Support the `--color` option more explicitly

* Update rollup config to handle babel-code-frame

* Use exact dependencies
2017-01-23 09:10:51 -08:00
Simon Lydell 6b3d3bc066 Add glob support to the CLI (#363)
* Add glob support to the CLI

Fixes #145. Fixes #362.

* Update README.md regarding globs

* Use exact dependency for glob
2017-01-23 10:37:57 -05:00
Henry Zhu 237e6f44bc Use a Symbol instead of the private dep (#359) 2017-01-20 15:55:24 -08:00
Christopher Chedeau 21729d8207 Drop jsesc (#357)
Even though JSON.stringify is not 100% correct, this is only used for debugging and doesn't warrant adding a dependency for it.
2017-01-20 14:55:41 -08:00
Christopher Chedeau 92f14d79df v0.0.10 (#353) 2017-01-20 10:00:01 -08:00
Christopher Chedeau a7793a66ee Add description to package.json (#320)
Fixes #319
2017-01-19 10:00:45 -05:00
Christopher Chedeau e4b5aaade2 Fix docs (#307)
It doesn't compile cleanly anymore:
- esutils checks for Buffer.isBuffer without ensuring that Buffer exists.
- for version, we require a json file, need a rollup extension for that.

I no longer hardcode the version number.

Note: we need to merge this pull request after we have done the release so that the version number is correct and need to rebuild the minified version in a subsequent commit.
2017-01-18 14:24:42 -08:00
Christopher Chedeau 10ff6ead26 v0.0.9 (#308) 2017-01-18 14:23:39 -08:00
Christopher Chedeau fadbbeb4ea Use exact versions in package.json (#291) 2017-01-18 12:48:04 -05:00
Christopher Chedeau 60af75b37b Update flow-parser to 0.38 (#290) 2017-01-18 12:35:42 -05:00
James Long bc5392c2a6 v0.0.8 2017-01-17 10:31:47 -05:00
Christopher Chedeau c9af5a6c3b Escape strings using jsesc (#229)
The current implementation with `JSON.stringify()` is clever but unfortunately generates incorrect JavaScript. Using `jsesc` seems like a better and safer option. https://github.com/mathiasbynens/jsesc It doesn't have any dependencies and is pretty small.

I opted for escaping all the non ascii characters, so we don't display emojis anymore. I don't think that the world is ready yet for having random unicode characters inside of source files, there still are so many parts of the toolchain that breaks with them. If we want to revert back on this decision, there's a `minimal` option on jsesc which only escapes values that need to in order to generate valid JavaScript file (assuming the encoding of the file is set to utf8).

Also, while working on React Native, we've seen that there is an optimization inside of jsc for js files that are all ascii: it doesn't do a copy for the conversion to ucs16.

Fixes #163
2017-01-16 11:03:59 -05:00
Benjamin Tan 3f31a87da1 Remove legacy Recast code and simplify API. (#191) 2017-01-14 23:25:30 -05:00
James Long e447971612 v0.0.7 2017-01-13 23:27:49 -05:00
Kent C. Dodds f49111c87c add license to package.json (#178)
Because right now it doesn't show any license on
[the npm page](https://www.npmjs.com/package/prettier).

Also, it's causing my [DependencyCI](https://dependencyci.com/github/kentcdodds/prettier-eslint/builds/5)
build to fail 😅
2017-01-13 23:11:03 -05:00
James Long 7e3161096b v0.0.6 2017-01-13 15:09:37 -05:00
Vu Tran b429b2443c include index.js in format:all script (#132) 2017-01-13 14:23:07 -05:00
James Long ea084dcd59 Merge pull request #125 from hzoo/update-deps
Update deps
2017-01-12 10:06:58 -05:00
James Long 1ccf6b0344 Merge pull request #90 from bakkot/property-names
Fix #79: omit unnecessary quotes in property names
2017-01-12 09:11:36 -05:00
Henry Zhu 1b5c7b3a03 remove recast (not used) 2017-01-11 14:32:33 -05:00
James Long be6e92f064 Merge pull request #122 from vjeux/browser
Add prettier-browser
2017-01-11 14:26:51 -05:00
James Long b9cf404631 v0.0.5 -- Accidentally didn't push this commit out before others landed; 0.0.5 is actually based on commit faed09ceea 2017-01-11 14:09:30 -05:00
Christopher Chedeau 4685164faf Add prettier-browser
This is a very handy way of playing out with prettier without having to install it. People have already been using it actively in the issues. Putting it directly inside of the repo would be better than on mine.
2017-01-11 10:56:23 -08:00
Damien Lebrun 477e745a78 chore: link prettier package to its github project
Add repository field to package.json, allowing the package page at npm to link to https://github.com/jlongster/prettier
2017-01-11 16:57:59 +00:00
Filipe Fortes 9ffbd32723 Enable reading from stdin 2017-01-11 07:57:16 -08:00
Kevin Gibbons be8f65d23e Format property names consistently 2017-01-10 22:29:54 -08:00
James Long b37e8c4b36 v0.0.4 2017-01-10 23:52:36 -05:00
James Long a061e96bbb Use latest version of babylon 2017-01-10 17:30:34 -05:00
Andrey Okonetchnikov 0bf83e9b31 build: Add more scripts to test 2017-01-10 21:47:52 +01:00
Andrey Okonetchnikov 3b1762b3a9 chore: Added .js extension to ./bin/prettier 2017-01-10 21:45:51 +01:00
skratchdot 95fc194c97 Adding missing `source-map` and `private` to deps 2017-01-10 13:22:11 -05:00
James Long 6d6d53f6df v0.0.3 2017-01-10 12:18:37 -05:00
Benjamin Tan 258575af9a Make `testRegex` Jest config a string instead of array.
Ref. https://facebook.github.io/jest/docs/configuration.html#testregex-string.

Closes #10.
2017-01-10 22:29:52 +08:00
James Long b553718aee Fix up atom package 2017-01-09 23:44:12 -05:00
James Long 79e222bb53 Rename to `prettier` 2017-01-09 22:45:22 -05:00
James Long 7451255906 Bootstrapped! Format the printer with the printer itself 2016-12-30 23:03:22 -05:00
James Long 8861953e60 Remove old tests (part 2) 2016-12-30 21:24:33 -05:00
James Long 0465bb5790 Add flow parser as an option, default to babylon 2016-12-30 21:23:50 -05:00