Commit Graph

757 Commits (ccda4c7115b99b1f9a107f211b4af1756de5d9c8)

Author SHA1 Message Date
Christopher Chedeau ccda4c7115 Break decorator before content (#2032)
Fixes #1996
2017-06-07 12:40:47 -07:00
Christopher Chedeau e16478ef80 Fix less &:extends when parsed with scss (#2034)
This is the only breakage that people ever reported with CSS so I'm happy adding one edge case like this.

Fixes #1967
2017-06-07 12:40:36 -07:00
Christopher Chedeau cabae6d877 Fix parenthesis for call expression inside of member expression inside of new (#2035)
Fixes #2033
2017-06-07 12:40:27 -07:00
Christopher Chedeau c7cacf0529 Break if string | null (#2028)
We were a bit too aggressive around the `| null` heuristic.

Fixes #2002
2017-06-07 11:51:32 -07:00
Christopher Chedeau c9c8512170 Only prevent lone `set` if there's no type annotations (#2026)
If there are, it's not ambiguous.

Fixes #2023
2017-06-07 11:51:25 -07:00
Christopher Chedeau 5ba0b0ec87 Add semi for functions without body (#2025)
We don't need to be overly restrictive and should add the semi if there's no body

Fixes #2003
2017-06-07 11:51:17 -07:00
Alexandre BODIN 8ec1b40961 GraphQL: Add support for union types (#2014) 2017-06-07 10:33:46 -07:00
Sashko Stubailo 0583fd4ce6 Add alias and null value (#2017)
Add kitchen sink test case
2017-06-06 18:06:15 -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
Sashko Stubailo 88f962beee Add support for GraphQL directies (#2015) 2017-06-06 17:42:47 -07:00
Joseph Frazier b20437ad13 Use printStatementSequence() to print SwitchCase consequent (#2011)
I noticed the duplicated code while working on commit 0cfd772
(https://github.com/prettier/prettier/pull/2008)
2017-06-06 14:58:20 -07:00
Joseph Frazier 0cfd772fd2 Protect SwitchCase statements from ASI (#2008)
* Add no-semi test with SequenceExpression

Adapted from https://github.com/prettier/prettier/issues/2006

* Protect SequenceExpressions from ASI

Fixes https://github.com/prettier/prettier/issues/2006

* Add test for ASI protection of SequenceExpression outside SwitchCase

See https://github.com/prettier/prettier/pull/2008#issuecomment-306614217

* Revert "Protect SequenceExpressions from ASI"

This reverts commit ca644fad8072c90a977ad8a2f29674bc72f679e8.

* Protect SwitchCase statements from ASI

See https://github.com/prettier/prettier/pull/2008#issuecomment-306614217

Fixes https://github.com/prettier/prettier/issues/2006
2017-06-06 14:28:51 -07:00
Sashko Stubailo 7c051804a8 Add support for GraphQL object values (#2010) 2017-06-06 14:28:15 -07:00
Sashko Stubailo c441f87fc0 Add GraphQL fragment support (#2005) 2017-06-06 12:35:40 -07:00
Rodrigo Pombo d4774edd03 Parse CSS in template literals (styled-jsx) (#1984)
* Add basic styled-jsx parsing

* Use eval("require")

* Remove template literal raw and cooked values when it contains CSS

* Set postcss parser to options and group subtree parts

* Gracefully give up TemplateLiteral formatting when it fails
2017-06-06 08:28:13 -07:00
Sashko Stubailo 6d00644c78 Add GraphQL variable definition support (#1995) 2017-06-06 08:26:04 -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
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
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
Lucas Azzola 642ac7e230 fix(typescript): print semi in class index signatures, fixes #1960 (#1961) 2017-06-04 07:21:33 -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 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
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
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
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
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 26e829b987 Upgrade prettier to v1.4.0, fix lint issues (#1888) 2017-06-02 11:48:43 -07:00
Kevin Gibbons 4915e0228e Require semicolons before class props named 'in' or 'instanceof' (#1878) 2017-06-02 10:52:11 -07:00
Lucas Azzola 83c5253429 fix(typescript): look at source to determine export = statement (#1868) 2017-06-02 08:32:40 -07:00
Christopher Chedeau faf2ac5f9e Hack to get export default work (#1866)
Fixes #1854
2017-06-02 08:12:03 -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
Lucas Azzola 8511e798dc feat(decorators): inline more types of decorators (#1864) 2017-06-02 07:38:44 -07:00