Commit Graph

77 Commits (56948a953e567196a8a652cbb8cb1a84f99e5488)

Author SHA1 Message Date
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 f119d4a90f
Change run_spec to have explicit parser list (#3356) 2017-11-30 03:31:52 -03: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
Mitermayer Reis 813d9b93eb Fix typos (#3212)
* Adding --stdin-filepath option in order to enable filetype inference from
stdin

* Fixing typo on the documentation

* Fixing typos - fixing some typos

* Restoring static lib files back since they are artifacts
2017-11-09 11:44:24 +11:00
jackyho112 b77b1c82a7 Strip away unnecessary quotes in keys in type objects and interfaces (#2643)
* Use printPropertyKey function to print keys in object type property in TS and Flow

* Remove flow test modification

* Add tests for new object key cases

* Add new test file

* Fix some styles
2017-08-21 20:08:38 +10:00
Lucas Azzola a666a29aa3 Print semi after DeclareFunction, fixes #2534 (#2536) 2017-07-24 21:55:16 +10:00
Christopher Chedeau 39954f7951 Handle conditions inside of a ternary (#2228)
Fixes #2122
2017-06-21 18:17:30 -07:00
Lucas Azzola 7e60d70f97 fix(typescript): always break interfaces onto multiple lines, fixes #2159 (#2161) 2017-06-15 14:34:54 -10:00
Lucas Azzola e8f12cf621 TypeScript: Remove parens from type annotations where possible (#2098)
* fix(typescript): remove parens from union types where possible, fixes #1885

* fix(typescript): ensure parenthesis removal is stable

* fix(typescript): don't strip parens around function type
2017-06-11 18:06:47 -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
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 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 e58dd2bf0b Add semi for ts function declarations without body (#1911)
Fixes #1891
2017-06-02 14:49:37 -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 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 ede078c0d3 fix(typescript): print static before accessibility, fixes #1855 (#1862) 2017-06-02 07:16:11 -07:00
Lucas Azzola 59a760c5d8 TypeScript: fix namespace comment printing (#1765)
* fix(typescript): fix namespace comment printing

* fix(typescript): remove extra newline after comment

* chore(lint): lint changes
2017-05-26 21:30:42 -07:00
Lucas Azzola 934216d852 fix(typescript): allow parens with TSFunctionType and ignore empty specifiers (#1764) 2017-05-26 20:47:48 -07:00
Christopher Chedeau ba69e9fe22 Remove ast-types from comments traversal (#1744)
It's very annoying to have to have a static definition of the ast, we should instead just traverse the objects to discover it. We just need to make sure not to have any cycles, but it's also good for debugging anyway.

This fixed a few comments already :)
2017-05-26 11:44:32 -07:00
Christopher Chedeau fc88aa185b Add parenthesis around binary expression inside of update expression (#1672)
This is not valid code but TypeScript parses it. It's easy to fix so might as well so we have one less failing test.
2017-05-23 12:33:03 -07:00
Lucas Azzola 599444fe7f fix(typescript): add TSInterfaceHeritage to ast-types (#1644) 2017-05-21 08:10:04 -07:00
Lucas Azzola 575980d7f4 fix(typescript): handle global namespace without modifiers (#1646) 2017-05-21 08:09:29 -07:00
Lucas Azzola 5c6fd80d50 fix(typescript): handle undefined variable declarations (#1645) 2017-05-21 08:03:38 -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 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
Lucas Azzola eabff629dd chore(build): update snapshot test (#1549) 2017-05-07 20:04:32 -07:00
Lucas Azzola fa27e5838c feat(typescript): add TSTypeAssertionExpression and naive TSX detection (#1545) 2017-05-07 08:09:52 -07:00
Lucas Azzola 3471ce4584 feat(typescript): print semi instead of comma in TS interface (#1548) 2017-05-07 07:39:21 -07:00
Lucas Azzola f655233ba2 fix(typescript): handle declare global syntax (#1546) 2017-05-07 03:44:41 -07:00
Lucas Azzola 5cc7878902 fix(typescript): fix a handful of ast(prettier(input)) issues (#1544) 2017-05-06 22:34:47 -07:00
Lucas Azzola 92d5a57122 fix(typescript): add TSNamespaceFunctionDeclaration to ast-types (#1543) 2017-05-06 21:33:07 -07:00
Lucas Azzola 0fa38cce33 fix(typescript): remove extraneous newline with namespace exports (#1542) 2017-05-06 20:28:49 -07:00
Lucas Azzola e22bd00815 fix(typescript): ArrowFunctionExpression needs parens in TSAsExpression (#1541) 2017-05-06 20:03:17 -07:00
Lucas Azzola 5fd9cd01de test(typescript): do not fail debug check on Literal -> Identifier (#1540) 2017-05-06 19:39:19 -07:00
Lucas Azzola 3d45278ea7 fix(typescript): print readonly and ? tokens in TSMappedType (#1535) 2017-05-06 10:30:59 -07:00
Lucas Azzola 4629db6b0d TypeScript: improve handling of computed properties (#1532)
* fix(typescript): improve handling of computed properties

* test(typescript): add Symbol computed property test

* fix(typescript): do not print brackets for literals
2017-05-06 08:00:26 -07:00
Lucas Azzola c337c83043 fix(typescript): workaround eslint/typescript-eslint-parser#257 (#1533) 2017-05-06 06:19:33 -07:00
Lucas Azzola 11e3d8241f TypeScript: print modifiers on TSIndexSignature and TSPropertySignature (#1531)
* fix(typescript): print modifiers on TSIndexSignature

* fix(typescript): print modifiers on TSPropertySignature and reformat TSMappedType
2017-05-06 06:18:23 -07:00
Lucas Azzola 8a8a67b9fe fix(typescript): print typeArguments in TSExpressionWithTypeArguments (#1530) 2017-05-06 06:17:48 -07:00
Igor Oleinikov f51822c16d fix(TypeScript): define TSFunctionType AST node (#1529)
- fixes printing of comments inside function type node
2017-05-05 22:14:12 -07:00
Lucas Azzola b9a7549e47 TypeScript: correctly print nested namespaces (#1522)
* fix(typescript): correctly print nested namespaces

* test(typescript): update snapshots
2017-05-05 21:14:07 -07:00
Lucas Azzola b23c16d05d fix(typescript): print typeParameters on TSMethodSignature (#1523) 2017-05-05 21:11:13 -07:00
Lucas Azzola c689f2a0e7 Fix module block, add enum initializers and fix type parameters (#1501)
* fix(typescript): fix module block, add enum initializers and fix type parameters

* fix(typescript): use printStatementSequence for TSModuleBlock

* fix(type-params): move typeParameters out of printFunctionParams

* refactor(type-params): move typeParameters out of printArgumentList
2017-05-05 19:44:26 -07:00
Christopher Chedeau 1a1e6fc1dd Print empty member lookup (#1506)
I have no idea if it's even valid but it threw on 8 typescript tests, now it doesn't.

```js
TypeError: Cannot read property 'type' of null
at printMemberLookup (prettier/src/printer.js:3062:16)
```
2017-05-04 11:20:52 -07:00
Danny Arnold 1fca1eeddf add TSTypeParameter to typescript ast nodes (#1508) 2017-05-04 11:20:35 -07:00
Danny Arnold 14636947b6 add TSParameterProperty to typescript ast nodes (#1507) 2017-05-04 11:19:50 -07:00
Danny Arnold c1a8ee011d add TSAbstractKeyword (#1505) 2017-05-04 09:48:24 -07:00