Commit Graph

1124 Commits (6d00644c7820462f0e4e8bbd6eb3f8bbbfa880c3)

Author SHA1 Message Date
Sashko Stubailo 6d00644c78 Add GraphQL variable definition support (#1995) 2017-06-06 08:26:04 -07:00
Philipp Spieß d679f235ed Also infer parser when using `--list-different` (#1997)
* Also infer parser when using `--list-different`

* Add integration tests for parser inference
2017-06-06 08:24:56 -07:00
Daniel Tschinder df7311a7f3 Add parens around all string literals at top level (#1999) 2017-06-06 08:24:13 -07:00
Sashko Stubailo c80e82c7d7 Add support for list values (#1994)
Run the linter
2017-06-05 23:45:15 -07:00
Christopher Chedeau c46a20c8c1 re-run tests 2017-06-05 22:26:35 -07:00
Sashko Stubailo df08dc4a56 Add support for arguments with soft line break (#1993) 2017-06-05 22:25:12 -07:00
Sashko Stubailo 8cb259eac7 GraphQL: Add support for printing operation names (#1992)
* Add support for printing GraphQL operation names

* Remove extra empty line at the end
2017-06-05 22:24:01 -07:00
Sashko Stubailo 76c5733b55 GraphQL: Add support for formatting fields in selection sets (#1991)
* GraphQL: Add support for formatting fields in selection sets

(Doesn't yet handle arguments or directives)

* Remove extra space
2017-06-05 22:23:03 -07:00
Joseph Frazier c863cbeac8 Translate cursor relative to nearest node, not SourceElement (#1989)
* Add test demonstrating SourceElement-relative cursor translation

See https://github.com/prettier/prettier/issues/1981#issuecomment-306326739

* Translate cursor relative to nearest node, not SourceElement

This partially address https://github.com/prettier/prettier/issues/1981

See https://github.com/prettier/prettier/issues/1981#issuecomment-306326739

* Add test demonstrating incorrect cursor translation

Since the `cursorOffset` option (introduced in #1637) works by tracking
the cursor position relative to an AST node (rather than a CST token),
it can produce incorrect results.

See https://github.com/prettier/prettier/issues/1981
2017-06-05 18:51:53 -07:00
Carl von Buelow 19bd2a3f7c Add "use strict" to fix SyntaxError on Node@4 (#1988) 2017-06-05 18:27:55 -07:00
Joseph Frazier d9e4d8f1b8 Remove unnecessary 'else' after 'return' (#1987)
As mentioned in at the end of
https://github.com/prettier/prettier/pull/1983/files#r120222081
2017-06-05 15:12:59 -07:00
Karl O'Keeffe 73432c2ce7 Position JSX whitespace (`{" "}`) at the end of lines (#1964)
* Position JSX whitespace at the end of lines

Currently we place JSX whitespace at the beginning of lines.

* Use `isLiteral` when determining JSX whitespace
2017-06-05 21:52:54 +01: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
Lucas Azzola 31ab3b6036 feat(css): split postcss printer into separate file (#1969) 2017-06-05 07:28:38 -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
tdeschryver 4291a8cedc Update single quote option in README (#1952)
* chore: add single quote note in readme

* chore: change readme text to quote format behaviour
2017-06-04 14:41:57 -07:00
Lucas Azzola 642ac7e230 fix(typescript): print semi in class index signatures, fixes #1960 (#1961) 2017-06-04 07:21:33 -07:00
Christian Hamburger Grøngaard 41688901f2 Make README more JavaScript agnostic (#1955)
- Prettier has grown into a more general tool.
2017-06-04 21:24:18 +10:00
Lucas Azzola fed9f0f4eb Mention TypeScript and CSS in the README (#1950)
* Mention TypeScript and CSS in the README.
* Collapse the table of contents with `<details>` tag.
* Clarifies the `--parser` option.
2017-06-03 20:03:30 -07:00
Christian Hamburger Grøngaard e0682a9558 Miscellaneous minor README fixes (#1943)
* Refer to "line length" instead of "line width"

- It's consistent with what it has been called in the section so far.

* Add missing punctuation

* Remove needless "just"s

- It's less condescending to a reader who doesn't know how to
"just" do these things.
2017-06-03 11:49:15 -07:00
Christopher Chedeau 86febfe797 1.4.2 2017-06-03 08:54:22 -07:00
Lucas Azzola 6697122e28 fix(decorators): do not inline methods with decorators with babylon, fixes #1933 (#1934) 2017-06-03 05:24:24 -07:00
Lucas Azzola 649cec7fdd TypeScript: fix trailing comma in enum (#1938)
* fix(typescript): fix trailing comma in enum, fixes #1932

* fix(typescript): use --trailing-comma es5 for enums
2017-06-03 05:20:36 -07:00
Lucas Azzola c57f2ab507 fix(typescript): no semi after export default abstract class, fixes #1926 (#1937) 2017-06-03 05:19:39 -07:00
Lucas Azzola 2ef169eb67 fix(typescript): print semi with inline interfaces/types, fixes #1930 (#1936) 2017-06-03 05:18:59 -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 3d175cc305 Remove eval for npm release (#1925)
Fixes #1895
2017-06-02 16:19:26 -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
Christopher Chedeau dae7203be6 Fix As parenthesis for real (#1923)
Instead of doing it inside of object, we need to have them use the existing mechanism that checks if the left-most character is a paren.
2017-06-02 16:08:45 -07:00
Christopher Chedeau 3264da9cab Fix leading comment (#1920)
It turns out that leading comment is attached to the CallExpression which is the last one and not the first one if they fit in a single line, so we want to not check that one.

Fixes #1892
2017-06-02 15:50:43 -07:00
Joseph Frazier 3580aac6e0 Say "group" instead of "multilineGroup" in commands.md (#1921)
`multilineGroup` was removed in commit 3aa267d (https://github.com/prettier/prettier/pull/450)
2017-06-02 15:49:08 -07:00
Christopher Chedeau db0be7fd5b fix conflict 2017-06-02 15:44:50 -07:00
Christopher Chedeau 323d64fb84 Port intersection inlining logic to TypeScript (#1919)
Fixes #1880
2017-06-02 15:40:33 -07:00
Christopher Chedeau 0d239477cb Use semi-colon for object separator (#1918)
Looks like the convention for typescript separator is `;` whereas for flow it's `,`. Let's migrate to that.

Fixes #1896
Fixes #1879
Fixes #1874
2017-06-02 15:32:51 -07:00
Joseph Frazier 451f4aaad5 Add regression test for --debug-check (#1917)
See https://github.com/prettier/prettier/pull/1916
2017-06-02 15:30:39 -07:00
Christopher Chedeau 620119d9d4 Fix --debug-check (#1916)
This got broken with the cursor commit.

cc @josephfrazier, would be nice to add some end to end test here :)
2017-06-02 15:10:08 -07:00
Christopher Chedeau 74f0d3979b Add parenthesis for yield and await inside of `as` (#1915)
Fixes #1913
2017-06-02 15:10:02 -07:00
Christopher Chedeau 2f9ea794db Always expand enums (#1914)
We do the same for classes, and it's usually written that way even if it fits in one line, even in the TS docs: https://www.typescriptlang.org/docs/handbook/enums.html

Fixes #1873
2017-06-02 15:09:55 -07:00
Christopher Chedeau a255977009 Do not make variable multilines inside of for loop (#1912)
Fixes #1876
2017-06-02 15:00:16 -07:00
Christopher Chedeau e58dd2bf0b Add semi for ts function declarations without body (#1911)
Fixes #1891
2017-06-02 14:49:37 -07:00
Christopher Chedeau 6933d16125 Inline decorators with no arguments (#1910)
Fixes #1898
2017-06-02 14:40:39 -07:00
Christopher Chedeau 0e35d3758a Fix <this.x /> (#1886)
Would be nice to get it properly handled in https://github.com/eslint/typescript-eslint-parser/issues/307

Fixes #1877
2017-06-02 14:27:27 -07:00
Christopher Chedeau 74f7f96fe4 Move accessibility before static (#1908)
I looked through all the places where we display accessibility and all of them now have a consistent way of printing all those modifiers.

Fixes #1877
2017-06-02 14:27:19 -07:00
Christopher Chedeau 02c48d284e Fix strictEqual throwing (#1909)
I looked at what is being called with assert and couldn't find anything but `ok` and `strictEqual`.

Fixes #1903
2017-06-02 14:27:03 -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 f6dabc0d27 Add regression test for CLI shebang preservation (#1901)
Following up on https://github.com/prettier/prettier/pull/1899
2017-06-02 13:42:44 -07:00
Simen Bekkhus 6a2c964b22 Include typescript and postcss in parser help (#1906) 2017-06-02 13:42:20 -07:00
Joseph Frazier 3070884b10 Add shebang comment nodes to Flow/TypeScript ASTs (#1905)
* Add shebang comment nodes to Flow/TypeScript ASTs

Now we handle actually printing the shebang in `printComment`, rather
than lopping it off beforehand and reattaching it afterward, as
suggested in https://github.com/prettier/prettier/pull/1718#issuecomment-303876792

* Dedupe AST shebang-insertion code into helper function
2017-06-02 13:38:15 -07:00
Joseph Frazier c15091bea6 Preserve shebang in CLI output (#1899)
This fixes https://github.com/prettier/prettier/issues/1890, albeit in a
quick-and-dirty way. Note also that the cursor offset may be incorrect
when there is a shebang, but that's a separate issue.
2017-06-02 12:46:20 -07:00