Skip to content

Commit

Permalink
Fix duplicate comments in classes (#1349)
Browse files Browse the repository at this point in the history
Turns out, you can't blindly print this node. We need a deeper fix but let's revert this fix for now.

Fixes #1348
  • Loading branch information
vjeux committed Apr 19, 2017
1 parent bc53920 commit 007cfd9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/printer.js
Expand Up @@ -2119,11 +2119,7 @@ function printMethod(path, options, print) {
group(
concat([
path.call(function(valuePath) {
return comments.printComments(
path,
p => printFunctionParams(valuePath, print, options),
options
)
return printFunctionParams(valuePath, print, options);
}, "value"),
path.call(p => printReturnType(p, print), "value")
])
Expand Down
18 changes: 18 additions & 0 deletions tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`class.js 1`] = `
class x {
/**
* Set of default settings to be applied to model fetch calls in DAO layer.
*/
static get defaultSettings() {
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class x {
/**
* Set of default settings to be applied to model fetch calls in DAO layer.
*/
static get defaultSettings() {}
}
`;

exports[`empty_paren_comment.js 1`] = `
let f = (/* ... */) => {}
(function (/* ... */) {})(/* ... */)
Expand Down
7 changes: 7 additions & 0 deletions tests/empty_paren_comment/class.js
@@ -0,0 +1,7 @@
class x {
/**
* Set of default settings to be applied to model fetch calls in DAO layer.
*/
static get defaultSettings() {
}
}

0 comments on commit 007cfd9

Please sign in to comment.