Commit Graph

90 Commits (494e3b74289afbfa1da4cddf8f66fa5f1b1e3689)

Author SHA1 Message Date
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
Danny Arnold e6eee0467d add TSConstKeyword (#1502) 2017-05-04 09:37:00 -07:00
Lucas Azzola aeeaffca35 Fix handling of new keyword and call signatures and improve type parameter formatting (#1491)
* fix(typescript): fix handling of new keyword

* fix(typescript): fix handling of call signatures

* feat(typescript): share type parameter formatting with flow
2017-05-03 08:01:45 -07:00
Lucas Azzola 59b348f550 Implement TypeScript keywords, namespace functions and class heritage (#1483)
* feat(typescript): #1480: implement *Keyword, namespace function and class heritage

* feat(typescript): add type params and modifiers to interfaces

* chore(style): add squigly wings to if/else blocks

* fix(typescript): remove hardline before declare
2017-05-02 17:06:25 -07:00
Danny Arnold e8a80ca0aa fix #1484 (#1487)
* don't print colon if there is no `typeAnnotation`
* print prefix also for empty interfaces
2017-05-02 16:03:51 -07:00
Danny Arnold 5cf1659acf add TSDecorator (#1488) 2017-05-02 16:03:23 -07:00
Danny Arnold 5ee0385d79 [WIP] add TSNamespaceExportDeclaration (#1459)
* add TSNamespaceExportDeclaration

* extract ast-types/fork

* add TSEnumDeclaration and TSEnumMember

* add TSImportEqualsDeclaration and TSExternalModuleReference

* add TSInterfaceDeclaration and type annotation to TSMethodSignature

* add TSModuleDeclaration, TSDeclareKeyword, TSModuleBlock and fix TSNamespaceExportDeclaration

* remove workaround
2017-05-01 09:25:49 -07:00
Danny Arnold bff2d48aa8 update typescript snapshots to account for #1464 (#1470) 2017-05-01 07:22:05 -07:00
Lucas Azzola 7d1e24ea7d Add supertype tests and add TSAbstractClassProperty (#1467)
* feat(typescript): add supertype tests and add TSAbstractClassProperty

* chore(typescript): bump parser version

* fix(flow): allow both variance and accessibility mods
2017-04-30 17:41:19 -07:00
Lucas Azzola 7a02e9ad27 feat(typescript): add delcare modifier support for vars, classes and functions (#1436) 2017-04-27 09:37:42 -07:00
Lucas Azzola fff743024c Add TSParameterProperty, TSAbstractClassDeclaration and TSAbstractMethodDefnition (#1410)
* feat(typescript): implement TSParameterProperty

* test(typescript): add TypeScript's classes/constructorDeclarations/constructorParameters tests

* feat(typescript): implement TSAbstractClassDeclaration and TSAbstractMethodDefinition

* test(typescript): add TypeScript's classes/classDeclarations/classAbstractKeyword tests

* fix(build): use join instead of spread operator

* fix(typescript): fix semicolon handling

* fix(typescript): handle accessibility modfiers in TSAbstractMethodDefinition

* test(typescript): remove invalid test results

* test(typescript): remove unimplemented abstract properties from tests

* test(typescript): add snapshots for abstract keyword newline behavior
2017-04-26 09:25:58 -07:00
Danny Arnold 0a7e462ad7 add TSMethodSignature (#1416) 2017-04-25 14:15:33 -07:00
Danny Arnold 90762bb111 fix VariableDeclarator not printing type parameters (#1415) 2017-04-25 14:08:30 -07:00
Danny Arnold 6f0cc31fdb add TSIntersectionType (#1395)
* add TSIntersectionType

* use same print implementation for flow and typescript
2017-04-23 10:27:40 -07:00
Danny Arnold 5f5566e4ef fix TSFunctionType failing on TypeParameters (#1394) 2017-04-23 10:17:03 -07:00
Danny Arnold 44e55f7fa7 add TSMappedType and TSTypeParameter (#1393)
* add TSMappedType and TSTypeParameter

* respect bracketSpacing in TSMappedType
2017-04-23 10:16:25 -07:00
Danny Arnold 150c701191 fix TSTypeReference not printing typeArguments (#1392) 2017-04-23 08:31:50 -07:00
Danny Arnold 15df9abf81 add TSTypeOperator (#1396) 2017-04-23 08:25:25 -07:00
Danny Arnold 99e4bae321 add TSConstructorType (#1367)
* add TSConstructorType

* combine condition

* combine strings
2017-04-21 07:57:26 -07:00
Danny Arnold 9002379b70 add TSLastTypeNode and TSIndexedAccessType (#1370) 2017-04-20 18:01:34 -07:00
Danny Arnold d823fe6fca add printer branches for some TypeScript nodes (#1331)
* add TSNeverKeyword

* add TSUndefinedKeyword

* add TSSymbolKeyword

* add TSNonNullExpression

* add TSThisType

* add tests for simple typescript nodes
2017-04-19 15:41:18 -07:00
Danny Arnold cb79d82569 add printer branch for TSFirstTypeNode (#1332)
* add TSFirstTypeNode

* add test for TSFirstTypeNode
2017-04-19 09:03:55 -07:00
Christopher Chedeau 9d616fc840 Remove trailing whitespace (#1259)
In #1257, I discovered that if there's a `""` doc at the end, it's not going to trim the previous one correctly. It also happens to fix a few existing things.
2017-04-13 18:31:49 -07:00
Jan Kassens b82220b20f Prittier printing of snapshots (#1190)
This uses a custom snapshot serializer to reduce escaping in snapshot files and
make them easier to read.

Snapshot serializers are documented here:
https://facebook.github.io/jest/docs/configuration.html#snapshotserializers-array-string
2017-04-12 13:41:51 -07:00
ChristianHersevoort 04c959d687 Feature/verify against same snapshot (#1087)
* Verify parsers against same snapshot

- Reworked run_spec, now accepts 3th optional array argument for
additional parsers to verify against
- Merged duplicate run_spec configs
- Removed duplicate snapshot data

* Formatted run_spec.js with prettier

* Fixed node4 incompatibility
2017-03-25 08:10:17 -07:00
Christopher Chedeau c3199359b0 Revert "Improve snapshot naming" (#1070)
* Revert "Remove mutation in `printBinaryishExpressions` (#1067)"

This reverts commit e7312ad7b2.

* Revert "Make it clear what parser was used in each snapshot (#1068)"

This reverts commit 4f7ae4815b.
2017-03-21 17:38:28 -07:00
ChristianHersevoort 4f7ae4815b Make it clear what parser was used in each snapshot (#1068) 2017-03-21 14:47:23 -07:00
Rasmus Eneman e41ed4955d [WIP] Add some typescript tests (#1033)
* Add some typescript tests

* fix: Remove extraneous colon in type parameter constraint

* style: Add missing newline at EOF in TS tests

* feat: Pretty print typescript object type annotations

* feat: Pretty print TSFunctionType

* fix: Type annotations was missing on class properties

* Add a new batch of tests

* Bump typescript-eslint-parser

* Add a new batch of tests and fix a syntax error in previous

* Bump typescript-eslint-parser
2017-03-19 08:06:52 -07:00