prettier/tests/comments
Justin Ridgewell c085aeb152 Fix closure compiler type casts (#5947)
* Fix closure compiler type casts

This fixes casts when they are followed by a closing parenthesis, eg:

```js
foo( /** @type {!Array} */(arrOrString).length );
```

The old code would see the `CallExpresion`'s closing `)` and assume the typecast belonged to the `MemberExpression`, not the `arrOrString` `Identifier`.

This would be easier to accomplish if every AST would tell us if the expression were parenthesized. If they did, we could check that the node were parenthesized and either it or an ancestor has a typecast, stopping when we find an ancestor is itself parenthesized.

* More tests, and changelog

* Fix while loop

* Update changelog

* Update CHANGELOG.unreleased.md

* Use babel's parenthesized information

* Cleanup call
2019-04-26 13:05:57 -04:00
..
__snapshots__ Fix closure compiler type casts (#5947) 2019-04-26 13:05:57 -04:00
assignment-pattern.js Fix unprinted comments in destructuring (#898) 2017-03-05 14:40:03 -08:00
before-comma.js Fix comment detection before comma (#1127) 2017-04-10 11:03:35 -07:00
binary-expressions.js Bugfix/ Don't inline pipeline operator with leading ownline comment (#5015) 2018-09-01 18:38:19 -04:00
blank.js Fix files with comments only (#813) 2017-03-07 11:02:45 -08:00
break-continue-statements.js Handle ContinueStatement and BreakStatement comments (#4279) 2018-04-07 13:38:37 -03:00
call_comment.js Fix comment for `call( // comment` (#858) 2017-03-03 16:47:13 -05:00
dangling.js Bugfix/ Leave Dangle Comments in NewExpression (#5017) 2018-08-27 09:23:14 +08:00
dangling_array.js Fix missing dangling comments in arrays (#744) 2017-02-19 17:25:18 -08:00
dangling_for.js Fix missing dangling comments in for loop (#742) 2017-02-20 09:17:10 -05:00
dynamic_imports.js fix multiline dynamic import comments (#6025) 2019-04-02 12:35:03 -07:00
export.js Stop marking all comments in named exports as leading comments (#4292) 2018-04-10 17:05:49 -03:00
first-line.js Remove first line special case (#597) 2017-02-04 21:36:48 -05:00
flow_union.js Unrestrict flow union comments check (#1040) 2017-03-20 12:33:42 -04:00
function-declaration.js Fixed unstable comment between function declaration and block statement (#5250) 2018-11-01 21:55:33 +02:00
if.js Fix comment style when placed after if statement test (#2675) 2017-09-08 10:12:10 -07:00
issues.js Fix closing call expression commented out (#530) 2017-01-31 06:52:53 -08:00
jsfmt.spec.js Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
jsx.js fix(jsx): Break opening elements with single text attribute if there's a comment (#3154) 2017-11-07 08:05:59 +11:00
last-arg.js Preserve inline comment as last argument (#1390) 2017-05-01 14:29:03 -07:00
preserve-new-line-last.js Fix trailing new lines preservation (#724) 2017-02-16 09:56:12 -05:00
return-statement.js Nicer line wrapping for d3 (#4285) 2018-04-24 06:54:45 -04:00
single-star-jsdoc.js Never put spaces to the right of stars in indentable block comments (#5330) 2018-11-03 20:53:24 +01:00
switch.js Fix trailing comment on switch case (#1136) 2017-04-05 16:27:14 -07:00
template-literal.js [WIP] Fix comments in template literals (#643) 2017-02-23 09:23:56 -08:00
trailing-jsdocs.js Fix trailing JSDoc comments with trailing regular comments (#4414) 2018-05-04 10:15:30 -03:00
trailing_space.js Trim trailing whitespace from comments, closes #2422 (#2494) 2017-07-16 17:45:27 +10:00
try.js Fix comment issue with try finally (#5252) 2018-10-12 12:48:49 -04:00
variable_declarator.js fix(javascript): fix locEnd for VariableDeclaration caused by --no-semi (#5434) 2018-11-11 00:26:11 +08:00
while.js Fixed unstable while comment (#5251) 2018-10-25 10:48:09 -04:00