Commit Graph

437 Commits (c5cf747b267bd1d84f70a574f0fb27373c44242b)

Author SHA1 Message Date
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