Print comment after key (#1131)
parent
926f9c4dfb
commit
69879e23bc
|
@ -1985,7 +1985,10 @@ function printPropertyKey(path, options, print) {
|
|||
(options.parser !== "flow" || key.value.match(/[a-zA-Z0-9$_]/))
|
||||
) {
|
||||
// 'a' -> a
|
||||
return key.value;
|
||||
return path.call(
|
||||
keyPath => comments.printComments(keyPath, p => key.value, options),
|
||||
"key"
|
||||
);
|
||||
}
|
||||
return path.call(print, "key");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`after-key.js 1`] = `
|
||||
"let a = {
|
||||
a /* comment */: () => 1
|
||||
};
|
||||
|
||||
let a = {
|
||||
\\"a\\" /* comment */: () => 1
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let a = {
|
||||
a /* comment */: () => 1
|
||||
};
|
||||
|
||||
let a = {
|
||||
a /* comment */: () => 1
|
||||
};
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`comment.js 1`] = `
|
||||
"o = {
|
||||
name:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
let a = {
|
||||
a /* comment */: () => 1
|
||||
};
|
||||
|
||||
let a = {
|
||||
"a" /* comment */: () => 1
|
||||
};
|
Loading…
Reference in New Issue