Commit Graph

94 Commits (318568e22a69213aa59bf1e6d8b12ce7826e7c56)

Author SHA1 Message Date
Georgii Dolzhykov ab598e6e23
tests: rename duplicate bindings to be ready for #6400 (#6662) 2019-10-15 18:27:39 +03:00
Georgii Dolzhykov 977b828666 Get rid of TSParenthesizedType nodes before proceeding with formatting (#6605)
* get rid of TSParenthesizedType nodes before proceeding with formatting

* fix parens for TSIndexedAccessType, TSFunctionType, TSConditionalType

fixes #6603

* workaround edge cases with one-item unions and intersections

* fix parens for TSInferType

* fix parens for rest elements in tuple types

* refactoring

* fix function types in conditional types

* move tests for rest and optional tuple elements

* fix comment issues

* tests for unions and intersections

* add parens around multiline unions in tuple

* move the parens check for TS nodes closer to the one for Flow nodes

* update CHANGELOG.unreleased.md

* remove dead code

* fix parens for TSConstructorType

* better wording in CHANGELOG.unreleased.md
2019-10-14 15:00:21 +03:00
fisker Cheung 3f13d2ec1b Support typescript 3.6 (#6519) 2019-10-03 15:24:03 +03:00
Sosuke Suzuki 27e777e476 TypeScript: Keep type parameters inline for a variable declaration (#6467)
* Modify to keep inline type parameter with variable declaration

* Update CHENGELOG.unreleased.md

* Add tests

* Add tests

* Add pr number and link
2019-09-24 18:59:54 +03:00
Sosuke Suzuki 3654108ebe TypeScript: Keep line breaks within mapped types. (#6146) 2019-05-24 19:00:32 -03:00
James Henry ef6386015d fix: update typescript and typescript-estree to latest (#5728) 2019-01-12 11:10:52 +08:00
Phil 30979ed104 typescript: remove unneeded parentheses around type annotation (#5724)
* Remove unnecessary parentheses from annotations

* add test for ts parentheses bug
2019-01-07 09:19:41 -03:00
Ika 952bc0cc03
fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika 3a5bbf5fd2
fix(typescript): do not change `module` into `namespace` and break/hug their body correctly (#5551) 2018-11-26 13:34:35 +08:00
Ika 4af3dd4b07
test: improve snapshots (#5521)
- before
  ```
  ${input}${"~".repeat(printWidth)}
  ${output}
  ```
- after
  ```
  ===options===
  ${options}
  ${" ".repeat(printWidth)}| printWidth
  ====input====
  ${input}
  ===output====
  ${output}
  =============
  ```
2018-11-25 16:21:14 +08:00
Suchipi 3bfaf6626c
Never inline decorators, unless they're lone parameter decorators (#4830)
Fixes #2613.
2018-07-20 13:48:37 -06:00
Simen Bekkhus 51b7c02e12 Upgrade jest to 22 (#4782)
* chore: upgrade Jest

* chore: update snapshots

* chore: lock down babel dependency using invalid syntax

* 2 args to test.skip

* use jest 22 for now

* Revert "2 args to test.skip"

This reverts commit 691fdc3f99e320f2303958f2b503f7b4c93fa455.

* remove snapshot name from matcher

* fix standalone tests skips
2018-07-03 03:06:29 -03:00
Ika 98bfd03d93
feat(typescript): support unknown type (#4625) 2018-06-10 00:12:30 +08:00
Zach Gawlik 0a22f5ec15 Wrap awaits in unary expressions (#4315) 2018-04-14 15:27:18 -04:00
Wang Zhongliang 5eea8aa2f5 feat(typescript): support TSPlusToken 2018-03-16 14:08:25 +08:00
Wang Zhongliang 67277f7477 feat(typescript): support TSMinusToken 2018-03-16 10:46:12 +08:00
Lucas Duailibe 41098a06b5
Prevent "over-indenting" class properties values (#4085) 2018-03-02 11:28:27 -03: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 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