Commit Graph

770 Commits (7a8380772d4db93586bf50abbc95abf138dac7b0)

Author SHA1 Message Date
Christopher Chedeau 7a8380772d Have --debug-check also run ast verification (#1337) 2017-04-21 16:09:33 -07:00
Michal Srb 768a81c5d5 Add example of using yarn test with arguments (#1383)
Not sure if the copy is great, but since this is mostly for n00bs, better to err on side of more information.
2017-04-21 15:54:28 -07:00
Brian Ng c0a0bf46bc Fix missing trailing commas on flow generics (#1381) 2017-04-21 13:57:21 -07:00
lemon79 96e5c889e3 fix do-while break (#1373)
* fix do-while break

* added test for long while statement

* update snapshot

* merged with prev changes
2017-04-21 08:03:53 -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
Brian Ng 93f040a9ea Skip trailing commas with FlowShorthandWithOneArg (#1364) 2017-04-20 14:46:41 -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
Christopher Chedeau 88e004184b 1.2.2 2017-04-19 13:19:26 -07:00
Christopher Chedeau bae08d4e7e Only break for conditionals (#1350)
We only want to break for && and ||, not for ===
2017-04-19 13:18:01 -07:00
Christopher Chedeau 076804c09c 1.2.1 2017-04-19 12:00:25 -07:00
Christopher Chedeau 007cfd9179 Fix duplicate comments in classes (#1349)
Turns out, you can't blindly print this node. We need a deeper fix but let's revert this fix for now.

Fixes #1348
2017-04-19 11:59:23 -07:00
Christopher Chedeau bc53920734 1.2.0 2017-04-19 11:01:44 -07:00
Christopher Chedeau 3dc7562743 Don't inline paren at right of arguments (#1345)
Fixes #1338
2017-04-19 10:44:00 -07:00
Christopher Chedeau aafcf5f381 Break if () if conditional inside breaks (#1344)
Fixes #868
2017-04-19 10:43:48 -07:00
Christopher Chedeau 042e603a6e Fix arrow function parenthesis with comments in flow (#1339)
`leadingComment` and `trailingComment` are babylon-specific, we should use `comments` which is what prettier adds.

Fixes #1335
2017-04-19 10:43:31 -07:00
Simon Lydell 938f0e3404 Improve regex printing (#1341)
- Print the raw regex for Flow, just like for Babylon.
- Sort regex flags.

Fixes #1334.
2017-04-19 10:24:13 -07:00
Brent Vatne e2fbaaf1f3 Update link to @vjeux's React London presentation (#1330) 2017-04-19 10:22:01 -07:00
Simon Lydell 706640d6dd Optimize `prettier --help` for humans (#1340) 2017-04-19 09:04:47 -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
Joseph Frazier dc499ba990 Add information about Vim's other autocmd events (#1333)
This lets you configure Vim to format your code even more frequently.
2017-04-18 15:30:16 -07:00
Kevin Gibbons 565106dd63 Add parentheses for assignment as body of arrow (#1326) 2017-04-18 13:28:33 -07:00
Joseph Frazier 652e2f90fb Add prettier_d to Related Projects (#1328)
`prettier_d` is like [eslint_d], but it runs `prettier` instead of
`eslint`. This eliminates the Node.js startup delay from all but the
first run of `prettier_d`, making it a snappier experience.

[eslint_d]: https://github.com/mantoni/eslint_d.js

Related discussion:
* https://github.com/prettier/prettier/issues/575#issuecomment-277368389
* https://github.com/prettier/prettier/issues/918#issuecomment-294130268
* https://github.com/prettier/prettier/pull/753#issuecomment-294339207
2017-04-18 13:27:36 -07:00
Simen Bekkhus 2e613cb37a Add jestbrains filewatcher docs (#1310) 2017-04-18 09:47:38 -07:00
Pi Lanningham 5e7503dadd Add typescript as a valid parser value (#1318)
* Add typescript as a valid parser value

Now that typescript development has started, each contributor has been adding this as a supported flag themselves.

This just adds it as an allowed option, with a warning that support for this parser is experimental.

I also tried to structure this a bit future proof, in case other experimental parsers come along.

* Simplifies the code at vjeux's request

Rather than a notion of "experimental" parsers, we'll just leave typescript out of the documentation until it's supported.
2017-04-18 09:42:03 -07:00
Christopher Chedeau 8d03423d17 Avoid breaking arguments for last arg expansion (#1305)
We've had this issue since the beginning and I tagged it as 1.0 but haven't managed to fix it by then. We shouldn't allow things to break in the argument list if we are in the last argument expansion mode. It turns out that we now have all the building blocks needed to fix this:
- have a special way to flag when we are printing the last argument expansion in the code that prints the argument list
- have a way to remove all the softlines from the argument list

Fixes #1301
2017-04-18 08:40:08 -07:00
Christopher Chedeau 5995af25a3 Bail when traversing === groups (#1294)
This is the second part of the fix for the performance regression seen in #1250. In #1217, for correctness reasons, we're now traversing all the conditional groups. This means that we're now in O(n^2). But, in practice, many of those groups are === between each others. So we only need to recurse through one of the instances to know if it's going to break.

This makes the first example go from not terminating to being instant. The second one going from not terminating to taking ~1s. We can also make it instant by tweaking the printing phase, but that's for another PR.
2017-04-18 08:39:47 -07:00
Christopher Chedeau 08e4e2c04c Do not print the sub-tree when using prettier-ignore (#1286)
In #1250, @jeresig reported that adding // prettier-ignore on a file that has a ton of conditional group still took 1.7s. The issue is that we're printing before checking for the comment. Swaping the two had the unfortunate side effect of not marking the comments as being printed, so I had to skip that safety check if there's a prettier-ignore.

With this change, adding prettier-ignore makes the file be printed instantly!
2017-04-18 07:51:50 -07:00
Tim 67a137f6d5 Double quotes for option values in Readme file (#1314) 2017-04-17 15:07:38 -07:00
Christopher Chedeau 9cd4517a64 Fix template literal comments (#1296)
The implementation was checking if the comment was inside of the expression range, which seems like a good idea. Unfortunately, the expression range is not what's inside of `${}` but the actual AST node, which incidentally doesn't include comments. So the logic was off and returned `undefined` which threw afterwards.

Another solution is to find the first quasi where start is > comment start. This means that the comment appeared between the quasi before and this one... therefore in the expression before!

The flow parser has issues with unicode where it makes node location invalid, there are likely other places where node locations are off. So instead of throwing with a weird error, let's attach it to the first one if it doesn't work.

Fixes #1293
2017-04-17 11:35:12 -04:00
Jon Stevens 8f2c20872b FIX: more documentation for jetbrains (#1265)
* FIX: more documentation for jetbrains

* FIX: clarification of the cloning and FileDirRelativeToProjectRoot
2017-04-17 11:24:53 -04:00
Hawken Rives 3e5b123c37 Skip globbing filenames with node-glob when the filename is not a glob (#1307)
* add a check to skip node-glob if the filename is not a glob

* add a return to prevent extra globbing
2017-04-16 21:12:49 -07:00
Aviv Rosental d6e5e6be60 omit 'doc' key from options object before passing it to format() (#1299) 2017-04-16 11:32:06 -07:00
Giorgio Polvara 1625730755 Remove emoji part from lint-staged's name (#1302) 2017-04-16 09:47:08 -07:00
John Resig 793db3150a Write out change CLI changes synchronously. Fixes #1287. (#1292) 2017-04-15 14:06:20 -07:00
Ethan Cohen 8ba3fc8623 Add --dev option to suggested install cmd (#1289)
Prettier should be saved to `devDependencies`
2017-04-15 07:05:38 -07:00
Janic Duplessis f3155c3fc1 Fix isPreviousLineEmpry on Windows (#1263) 2017-04-14 16:02:19 -07:00
Bill Mill 306870a2a0 match jsx files in pre-commit hook (#1276) 2017-04-14 11:16:17 -04: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 17051ece2c [WIP] no-semi comments (#1257)
It doesn't yet work but I think it's close
2017-04-13 18:33:46 -07:00
Axel 088754fb1e Fixing n.comments check in printer (#1239) 2017-04-13 18:32:13 -07:00
Christopher Chedeau 6a259b60b5 Get rid of fixFaultyLocations code (#1252)
As I was debugging #1248, I found out that the code to fix was actually making things worse. The other two branches are for decorators and deleting some random value of a function. I ran all the tests and the flow object is actually now preserving empty lines and didn't change anything else.

I'd rather remove all those and if something comes up then fix it properly upstream than having those crutches that we don't know why they exist anymore.
2017-04-13 18:32:03 -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
Christopher Chedeau 61183f8ca6 Use a whitelist instead of blacklist for member breaking (#1261) 2017-04-13 18:31:21 -07:00
Jason Laster 2078225daa Fix flow union params (#1251) 2017-04-13 17:54:20 -07:00
Christopher Chedeau 97c662b87b Do not inline member expressions as part of assignments (#1256)
This is a regression from #1036 and #1188.

Fixes #1241
Fixes #1236
2017-04-13 20:09:00 -04:00
Jason Laster 1802545865 Document debugging strategies (#1253) 2017-04-13 15:50:21 -07:00
franxois 19b7febe9e Fix : ReferenceError: err is not defined (#1254)
Would fix an error I had 
It catch an error "e" but try to display "err"
2017-04-13 15:49:53 -07:00
Mike Wilcox 6ecbb99e8a fix small typo (#1255) 2017-04-13 15:49:27 -07:00
Douglas Wade d39654fa8b [1242]: Prettier 1.0 is the stabler release we've been waiting for (#1243) 2017-04-13 14:23:14 -07:00