Commit Graph

21 Commits (2cfd8fb5180d35eddbe5aa8319f587e21abf8139)

Author SHA1 Message Date
Noah Sugarman 0b07e10833 fix multiline dynamic import comments (#6025) 2019-04-02 12:35:03 -07: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
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
Lucas Duailibe 7cff189dd8
Print trailing comma when last arg is arrow (#3428) 2017-12-07 02:48:11 -02:00
Lucas Duailibe f119d4a90f
Change run_spec to have explicit parser list (#3356) 2017-11-30 03:31:52 -03:00
Lucas Duailibe 49b07c3983 Don't add trailing commas in JSXAttribute for arrow functions (#3181) 2017-11-07 22:37:36 +11:00
Christopher Chedeau ea957ed64a Fix function trailing comment location (#1195)
It turns out that we can't reliably detect with the ast if a comment is before or after the ). In order to fix this same problem with `if` I added the `getNextNonSpaceNonCommentCharacter` function. We can use the same here to fix the problem.

Fixes #933
2017-04-12 14:18:29 -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
Christopher Chedeau 0669160adc Fix last argument comment for function declaration (#1176)
We already handle this but forgot to do it for FunctionDeclaration

Fixes #1166
2017-04-10 10:55:29 -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
James Henry 72456bf06f [WIP] TypeScript Parser (#915)
* WIP immediate feedback

* typescript parser is drop-in replacement for flow parser

* Add new TypeScript Parser snapshots where drop-in replacement possible

* Snapshot updates after rebasing

* Remove unnecessary stripping of properties on TypeScript parser AST

* Remove annotated issues

* Move TS dependencies to dev for now
2017-03-08 13:18:13 -08:00
Christopher Chedeau ee0e839cb8 Do not put trailing commas for function declaration in es5 mode (#791)
Fixes #789
2017-02-23 09:01:19 -08:00
Rogelio Guzman d45e157563 Upgrade to Jest 19 (#762)
* Upgrade to Jest 19

* Use exact versions for Jest
2017-02-21 13:59:19 -08:00
James Long 5d131027ce Make trailing-comma option support 2 different modes (#641)
* Make trailing-comma option support 2 different modes

* Add deprecation warning

* Add deprecation warning to API
2017-02-17 22:44:55 -05:00
Christopher Chedeau e30482d440 Fix trailing new lines preservation (#724)
There is an off by one error which made the algorithm not work all the time. In many cases, it actually is the opposite, so whenever you save, it adds/removes that line. I noticed it during the --debug-check run on our codebase but didn't investigate.

Fixes #723
2017-02-16 09:56:12 -05:00
Christopher Chedeau 1a8e97f92b Fix trailing commas with a trailing comment (#664)
The reason why trailing comments on a line work with commas is because of a special `lineSuffix` document that delays printing the content until a \n is printed. But `lineSuffix` only worked for pure string. By making it work with arbitrary documents we can fix trailing commas with trailing comments.

Fixes #538
2017-02-13 10:13:16 -05:00
Christopher Chedeau 959235afd7 [RFC] Keep expanded objects expanded (#495)
Another attempt at solving the issue where objects are not expanded the way people expect. If there's any new line in the original source, it's going to expand it. This gives more control to the user in how the objects should be formatted.

Fixes #74
2017-01-30 09:08:55 -08:00
Christopher Chedeau b4f1649d1a Fix spurious whitespace (#463)
This was introduced by #314 where `line` should have been `softline`. By the way, I was going to propose renaming `line` to `line_or_space` and `softline` to `line_or_nothing` which should make it more explicit what is going on.

Fixes #461
2017-01-25 16:24:16 -05:00
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00