Christopher Chedeau
939734b75e
Use ifBreak instead of shouldBreak ( #2063 )
...
shouldBreak is only a heuristic to enforce a break, if it breaks "naturally", then it won't be applied.
Fixes #2055
2017-06-08 11:47:49 -07:00
Tim Griesser
df26cc05cc
Support graphql ListType ( #2061 )
2017-06-08 09:34:35 -07:00
Christopher Chedeau
883e637fa9
Support the Keyword type ( #2056 )
...
This is an issue in https://github.com/eslint/typescript-eslint-parser/issues/315
Fixes #2049
2017-06-08 09:25:28 -07:00
Tim Griesser
e9045e4bcf
Support graphql NonNullType ( #2060 )
2017-06-08 09:20:41 -07:00
Pier Paolo Ramon
126727380d
CSS: Every selector is now printed in its own line ( #2047 )
...
Changes the behaviour for line breaking inside selector lists (those
separated by ',') so that every selector is in its own line.
Fixes #1962
2017-06-08 07:46:24 -07:00
Christopher Chedeau
924363193b
Check if the next group has comments ( #2040 )
...
Fixes #1958
Fixes #1959
2017-06-07 15:20:11 -07:00
Christopher Chedeau
1edb1f261b
Include typeAnnotation inside of node location ( #2039 )
...
We should remove this hack once https://github.com/eslint/typescript-eslint-parser/issues/314 lands
Fixes #1946
2017-06-07 15:05:46 -07:00
Christopher Chedeau
42b0368e3d
Fix decorator comments for export class ( #2038 )
...
We need to do the same location trick for export class unfortunately.
Fixes #1956
2017-06-07 14:55:55 -07:00
Christopher Chedeau
b730f4eccf
Add group around TSMethodSignature ( #2037 )
...
This ensures that the comment size is not taken into account during measurement
Fixes #1976
2017-06-07 14:20:55 -07:00
Christopher Chedeau
09f147decd
Do not throw for unprinted comments inside of JSX ( #2036 )
...
Fixes #1990
2017-06-07 12:57:03 -07:00
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
Sashko Stubailo
88f962beee
Add support for GraphQL directies ( #2015 )
2017-06-06 17:42:47 -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
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
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
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
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
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
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