Commit Graph

247 Commits (1a3248bbc297148f908993d28d887d250ce88407)

Author SHA1 Message Date
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 c86a57a91e fix TSFunctionType (#1600) 2017-05-12 15:33:03 -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
Simen Bekkhus ed24bff251 Upgrade jest (#1534)
* Upgrade jest

* yarn upgrade
2017-05-06 07:40:40 -07:00
Christopher Chedeau 515a565a66 1.3.1 (hotfix) 2017-05-03 14:44:08 -07:00
Christopher Chedeau a81d5c1cd1 1.3.0 2017-05-02 13:15:15 -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
Christopher Chedeau 3161bd0787 Upgrade flow parser to 0.45 (#1447)
This fixes all the unicode issues and spacing between elements in array.

Fixes #1336
Fixes #1427
Fixes #770
2017-04-27 14:59:18 -07:00
Christopher Chedeau 88e004184b 1.2.2 2017-04-19 13:19:26 -07:00
Christopher Chedeau 076804c09c 1.2.1 2017-04-19 12:00:25 -07:00
Christopher Chedeau bc53920734 1.2.0 2017-04-19 11:01:44 -07:00
Christopher Chedeau ad637d0744 1.1.0
This fixes a regression from 0.22 around member expressions breaking and fixes no-semi placement around leading comments, plus some other minor fixes.
2017-04-13 18:40:04 -07:00
Christopher Chedeau 22f5ba0989 change semi default 2017-04-13 10:18:50 -07:00
Christopher Chedeau 23756cdc59 1.0 2017-04-13 09:28:42 -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
Simon Lydell dc93bdc983 Sync the Flow tests (#1163)
* Extract custom tests from tests/flow/

Approach:

1. Remove all .js files in tests/flow except .snap.js files.
2. Copy over all .js files from tests/ in the flow repo.
3. Go through the diff looking for deletions.
   - It was easy to see which deletions were due to changes in the tests
     due to updates in the flow repo.
   - For the rest of the deletions, I used `git blame` to verify that
     they had been added by us since the flow tests were copied over.

This makes tests/flow/ simply a copy of the tests from the flow repo,
making it easier to sync with the upstream flow tests in the future.

* Add a script for syncing the flow tests

* Sync the flow tests
2017-04-08 07:52:38 -07:00
Christopher Chedeau 1578e180f4 Add support for flow type spread in .43 and babylon beta8 (#1064)
Fixes https://twitter.com/ryyppy/status/844116626467438592
2017-04-04 14:52:16 -07:00
Brian Ng d9a4efcc35 Bump babylon to 7.0.0-beta.8 (#1118)
* Bump babylon version

* Enable flow predicate tests in babylon
2017-04-04 14:21:56 -07:00
Christopher Chedeau 569791a57a Update babylon to 7.0.0-beta.4 (#1047)
Fixes #700
2017-03-20 12:46:31 -04:00
Christopher Chedeau b012f7531e Fix comments inside of ObjectPattern (#1045)
ast-types was missing a type, I sent a PR on ast-type ( https://github.com/benjamn/ast-types/pull/211 ) which was merged and released (thanks @benjamn for being super quick!). So I'm upgrading ast-types and add the test in this PR.

Fixes #1007
2017-03-20 12:42:07 -04: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
Simen Bekkhus 0fc8584827 Update repo links (#993) 2017-03-13 14:39:54 -07:00
Christopher Chedeau 344401c038 0.22.0 2017-03-09 09:15:40 -08: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 b570154dd5 0.21.0 2017-03-03 14:03:36 -08:00
Christopher Chedeau e09bdd4447 0.20.0 2017-02-28 10:49:30 -08:00
Christopher Chedeau edf2bde590 Fix trailing commas in docs (#825)
I also added support for parser dropdown and stop minifying the bundle so that the flow parser actually works.

Fixes #816
2017-02-27 17:02:41 -05:00
Christopher Chedeau 1b9234a8c4 Update flow to 0.40 (#808)
This fixes the bug with comments swapped between `/*` and `//`

Fixes #755
2017-02-24 15:46:20 -08:00
Christopher Chedeau e0cac2049d 0.19.0 2017-02-23 09:52:55 -08:00
Brian Ng 543e62cd31 Revert babylon bump (#792) 2017-02-23 09:00:57 -08:00
Brian Ng 211deb527e Bump babylon & add test for async func decl (#790)
* Add test for async function declaration

* Bump babylon version
2017-02-23 09:32:20 -05:00
Rogelio Guzman e039ca888a Upgrade to Jest 19.0.1 (#779) 2017-02-22 10:28:17 -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
Christopher Chedeau 848dfa3505 0.18.0 2017-02-16 09:28:26 -08:00
Christopher Chedeau 74fb4a43b1 0.17.1 2017-02-14 13:47:46 -08:00
Christopher Chedeau fbba7db6e2 0.17.0 2017-02-13 19:11:05 -08:00
Umidbek Karimov 97fd8a8d81 Log filename with [update] or [ignore] flags during `--write` process. (#584)
* Make `--write` logs more informative.

* Add format duration to logs.

* Use colors instead of [ignore] and [update] labels.

* Remove `colors` dependency.

* Use `chalk` to colorize logs.

* Print filename before `format` and add duration info later.

* Print filename before read error.
2017-02-07 14:03:48 -05:00
Christopher Chedeau 4df5250f74 Add --debug-check cli option (#627)
This let's you run `pp(x) === pp(pp(x))` across an entire codebase quickly. I think it's small enough that we can merge it in to master while we are nailing down all the issues.

You can see the output in #610
2017-02-07 10:04:44 -05:00
Christopher Chedeau 98d04d8c70 0.16.0 2017-02-05 18:28:20 -08:00
Christopher Chedeau b040be2206 0.15.0 2017-02-01 16:31:11 -08:00
Christopher Chedeau efc3ee0488 0.14.1 2017-01-30 09:56:01 -08:00
Christopher Chedeau f88c95031e 0.14.0 2017-01-30 09:41:09 -08:00
Christopher Chedeau 3f776bed3d 0.13.1 hotfix 2017-01-28 08:19:00 -08:00
Simon Lydell d548ef0790 Add missing jest-validate to dependencies (#500) 2017-01-28 07:49:57 -08:00
Christopher Chedeau 94b137ac47 0.13.0 2017-01-27 14:41:30 -08:00
Christopher Chedeau caf7f2a6f2 0.12.0 2017-01-26 20:24:17 -08:00
daleroy 69b5d098e9 Update package.json, use ast-types 0.9.4 (#453)
Add Flow's DeclareExportAllDeclaration type has been merged into benjamn/ast-types so the forks are now in sync.
2017-01-24 18:08:35 -05:00
Michał Pierzchała 66fe2f78fa Validate user-provided config with jest-validate (#301)
* Validate user-provided config with jest-validate

* Don't use object shorthand

* Update jest-validate to 18.2

* Fix Node4 destructuring from require

* Make use of jest-validate for deprecation message

* Remove chalk reference
2017-01-23 16:33:58 -05:00
Christopher Chedeau ef531274f7 0.11.0 2017-01-23 09:40:01 -08:00
Simon Lydell bb1884320b Use babel-code-frame for syntax errors (#367)
* Use babel-code-frame for syntax errors

* Support the `--color` option more explicitly

* Update rollup config to handle babel-code-frame

* Use exact dependencies
2017-01-23 09:10:51 -08:00
Simon Lydell 6b3d3bc066 Add glob support to the CLI (#363)
* Add glob support to the CLI

Fixes #145. Fixes #362.

* Update README.md regarding globs

* Use exact dependency for glob
2017-01-23 10:37:57 -05:00
Henry Zhu 237e6f44bc Use a Symbol instead of the private dep (#359) 2017-01-20 15:55:24 -08:00
Christopher Chedeau 21729d8207 Drop jsesc (#357)
Even though JSON.stringify is not 100% correct, this is only used for debugging and doesn't warrant adding a dependency for it.
2017-01-20 14:55:41 -08:00
Christopher Chedeau 92f14d79df v0.0.10 (#353) 2017-01-20 10:00:01 -08:00
Christopher Chedeau a7793a66ee Add description to package.json (#320)
Fixes #319
2017-01-19 10:00:45 -05:00
Christopher Chedeau e4b5aaade2 Fix docs (#307)
It doesn't compile cleanly anymore:
- esutils checks for Buffer.isBuffer without ensuring that Buffer exists.
- for version, we require a json file, need a rollup extension for that.

I no longer hardcode the version number.

Note: we need to merge this pull request after we have done the release so that the version number is correct and need to rebuild the minified version in a subsequent commit.
2017-01-18 14:24:42 -08:00
Christopher Chedeau 10ff6ead26 v0.0.9 (#308) 2017-01-18 14:23:39 -08:00
Christopher Chedeau fadbbeb4ea Use exact versions in package.json (#291) 2017-01-18 12:48:04 -05:00
Christopher Chedeau 60af75b37b Update flow-parser to 0.38 (#290) 2017-01-18 12:35:42 -05:00
James Long bc5392c2a6 v0.0.8 2017-01-17 10:31:47 -05:00
Christopher Chedeau c9af5a6c3b Escape strings using jsesc (#229)
The current implementation with `JSON.stringify()` is clever but unfortunately generates incorrect JavaScript. Using `jsesc` seems like a better and safer option. https://github.com/mathiasbynens/jsesc It doesn't have any dependencies and is pretty small.

I opted for escaping all the non ascii characters, so we don't display emojis anymore. I don't think that the world is ready yet for having random unicode characters inside of source files, there still are so many parts of the toolchain that breaks with them. If we want to revert back on this decision, there's a `minimal` option on jsesc which only escapes values that need to in order to generate valid JavaScript file (assuming the encoding of the file is set to utf8).

Also, while working on React Native, we've seen that there is an optimization inside of jsc for js files that are all ascii: it doesn't do a copy for the conversion to ucs16.

Fixes #163
2017-01-16 11:03:59 -05:00
Benjamin Tan 3f31a87da1 Remove legacy Recast code and simplify API. (#191) 2017-01-14 23:25:30 -05:00
James Long e447971612 v0.0.7 2017-01-13 23:27:49 -05:00
Kent C. Dodds f49111c87c add license to package.json (#178)
Because right now it doesn't show any license on
[the npm page](https://www.npmjs.com/package/prettier).

Also, it's causing my [DependencyCI](https://dependencyci.com/github/kentcdodds/prettier-eslint/builds/5)
build to fail 😅
2017-01-13 23:11:03 -05:00
James Long 7e3161096b v0.0.6 2017-01-13 15:09:37 -05:00
Vu Tran b429b2443c include index.js in format:all script (#132) 2017-01-13 14:23:07 -05:00
James Long ea084dcd59 Merge pull request #125 from hzoo/update-deps
Update deps
2017-01-12 10:06:58 -05:00
James Long 1ccf6b0344 Merge pull request #90 from bakkot/property-names
Fix #79: omit unnecessary quotes in property names
2017-01-12 09:11:36 -05:00
Henry Zhu 1b5c7b3a03 remove recast (not used) 2017-01-11 14:32:33 -05:00
James Long be6e92f064 Merge pull request #122 from vjeux/browser
Add prettier-browser
2017-01-11 14:26:51 -05:00
James Long b9cf404631 v0.0.5 -- Accidentally didn't push this commit out before others landed; 0.0.5 is actually based on commit faed09ceea 2017-01-11 14:09:30 -05:00
Christopher Chedeau 4685164faf Add prettier-browser
This is a very handy way of playing out with prettier without having to install it. People have already been using it actively in the issues. Putting it directly inside of the repo would be better than on mine.
2017-01-11 10:56:23 -08:00
Damien Lebrun 477e745a78 chore: link prettier package to its github project
Add repository field to package.json, allowing the package page at npm to link to https://github.com/jlongster/prettier
2017-01-11 16:57:59 +00:00
Filipe Fortes 9ffbd32723 Enable reading from stdin 2017-01-11 07:57:16 -08:00
Kevin Gibbons be8f65d23e Format property names consistently 2017-01-10 22:29:54 -08:00
James Long b37e8c4b36 v0.0.4 2017-01-10 23:52:36 -05:00
James Long a061e96bbb Use latest version of babylon 2017-01-10 17:30:34 -05:00
Andrey Okonetchnikov 0bf83e9b31 build: Add more scripts to test 2017-01-10 21:47:52 +01:00
Andrey Okonetchnikov 3b1762b3a9 chore: Added .js extension to ./bin/prettier 2017-01-10 21:45:51 +01:00
skratchdot 95fc194c97 Adding missing `source-map` and `private` to deps 2017-01-10 13:22:11 -05:00
James Long 6d6d53f6df v0.0.3 2017-01-10 12:18:37 -05:00
Benjamin Tan 258575af9a Make `testRegex` Jest config a string instead of array.
Ref. https://facebook.github.io/jest/docs/configuration.html#testregex-string.

Closes #10.
2017-01-10 22:29:52 +08:00
James Long b553718aee Fix up atom package 2017-01-09 23:44:12 -05:00
James Long 79e222bb53 Rename to `prettier` 2017-01-09 22:45:22 -05:00
James Long 7451255906 Bootstrapped! Format the printer with the printer itself 2016-12-30 23:03:22 -05:00
James Long 8861953e60 Remove old tests (part 2) 2016-12-30 21:24:33 -05:00
James Long 0465bb5790 Add flow parser as an option, default to babylon 2016-12-30 21:23:50 -05:00
James Long 7ea2348b03 Various fixes with destructuring default, JSX, and more; all tests pass! 2016-12-30 17:00:11 -05:00
James Long 649e8a1efe Add DeclareExportAllDeclaration to ast-types 2016-12-30 15:07:35 -05:00
James Long 11a01552a4 Lots of bug fixes (will do smaller commits from now on) 2016-12-30 00:01:44 -05:00
James Long 599e5821c1 Optimize jest testing and implement more fixes 2016-12-27 13:28:04 -05:00
Christopher Chedeau cf45afba61 Add testing
- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases
- This creates snapshot tests using the pretty printer for all of them
- If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
2016-12-23 19:51:53 +00:00
James Long 9b4535e9f8 Merge in forked recast printer that uses Wadler's algorithm 2016-12-23 13:38:10 -05:00
James Long d8313b03ce Add ability to call as API 2016-11-29 15:23:00 -05:00
James Long a2f231d0eb Fix package.json 2016-11-29 12:19:53 -05:00
James Long 29627ee520 initial 2016-11-29 12:14:10 -05:00