Stabilize comments on ObjectTypeAnnotation (#1214)
This commit is contained in:
1 parent
b82220b20f
commit
32eecabc6d
3 files changed
+86
No files matched your search
@@ -219,6 +219,7 @@ function attach(comments, ast, text, options) {
|
||||
handleExportNamedDeclarationComments(enclosingNode, comment) ||
|
||||
handleOnlyComments(enclosingNode, ast, comment, isLastComment) ||
|
||||
handleClassMethodComments(enclosingNode, comment) ||
|
||||
handleTypeAliasComments(enclosingNode, followingNode, comment) ||
|
||||
handleVariableDeclaratorComments(enclosingNode, followingNode, comment)
|
||||
) {
|
||||
// We're good
|
||||
@@ -734,6 +735,14 @@ function handleClassMethodComments(enclosingNode, comment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleTypeAliasComments(enclosingNode, followingNode, comment) {
|
||||
if (enclosingNode && enclosingNode.type === "TypeAlias") {
|
||||
addLeadingComment(enclosingNode, comment);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleVariableDeclaratorComments(
|
||||
enclosingNode,
|
||||
followingNode,
|
||||
|
||||
@@ -29,3 +29,67 @@ const beep = (data /*: Object*/) => {};
|
||||
const beep = (data /*: Object*/, secondData /*: Object*/) => {};
|
||||
|
||||
`;
|
||||
|
||||
exports[`object_type_annotation.js 1`] = `
|
||||
type Props = // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
{
|
||||
isPlaying: boolean,
|
||||
};
|
||||
|
||||
type Props = { // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
type Props = {
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
`;
|
||||
|
||||
exports[`object_type_annotation.js 2`] = `
|
||||
type Props = // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
{
|
||||
isPlaying: boolean,
|
||||
};
|
||||
|
||||
type Props = { // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
type Props = {
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
type Props = // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
{
|
||||
isPlaying: boolean,
|
||||
};
|
||||
|
||||
type Props = { // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
|
||||
isPlaying: boolean
|
||||
};
|
||||
Reference in new issue
Block a user