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$_]/))
|
(options.parser !== "flow" || key.value.match(/[a-zA-Z0-9$_]/))
|
||||||
) {
|
) {
|
||||||
// 'a' -> a
|
// 'a' -> a
|
||||||
return key.value;
|
return path.call(
|
||||||
|
keyPath => comments.printComments(keyPath, p => key.value, options),
|
||||||
|
"key"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return path.call(print, "key");
|
return path.call(print, "key");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// 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`] = `
|
exports[`comment.js 1`] = `
|
||||||
"o = {
|
"o = {
|
||||||
name:
|
name:
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
let a = {
|
||||||
|
a /* comment */: () => 1
|
||||||
|
};
|
||||||
|
|
||||||
|
let a = {
|
||||||
|
"a" /* comment */: () => 1
|
||||||
|
};
|
Loading…
Reference in New Issue