verify the precedingNode type when handling import declaration comments (#5016)
parent
8779937a07
commit
93e8b15311
|
@ -660,6 +660,7 @@ function handleImportDeclarationComments(
|
|||
) {
|
||||
if (
|
||||
precedingNode &&
|
||||
precedingNode.type === "ImportSpecifier" &&
|
||||
enclosingNode &&
|
||||
enclosingNode.type === "ImportDeclaration" &&
|
||||
privateUtil.hasNewline(text, options.locEnd(comment))
|
||||
|
|
|
@ -95,6 +95,11 @@ import {
|
|||
SelectionSetNode,
|
||||
/* tslint:enable */
|
||||
} from 'graphql';
|
||||
|
||||
import x, {
|
||||
// comment
|
||||
y
|
||||
} from 'z';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import {
|
||||
//comment1
|
||||
|
@ -139,6 +144,11 @@ import {
|
|||
/* tslint:enable */
|
||||
} from "graphql";
|
||||
|
||||
import x, {
|
||||
// comment
|
||||
y
|
||||
} from "z";
|
||||
|
||||
`;
|
||||
|
||||
exports[`comments.js - flow-verify 2`] = `
|
||||
|
@ -182,6 +192,11 @@ import {
|
|||
SelectionSetNode,
|
||||
/* tslint:enable */
|
||||
} from 'graphql';
|
||||
|
||||
import x, {
|
||||
// comment
|
||||
y
|
||||
} from 'z';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import {
|
||||
//comment1
|
||||
|
@ -226,6 +241,11 @@ import {
|
|||
/* tslint:enable */
|
||||
} from "graphql";
|
||||
|
||||
import x, {
|
||||
// comment
|
||||
y
|
||||
} from "z";
|
||||
|
||||
`;
|
||||
|
||||
exports[`empty-import.js - flow-verify 1`] = `
|
||||
|
|
|
@ -38,3 +38,8 @@ import {
|
|||
SelectionSetNode,
|
||||
/* tslint:enable */
|
||||
} from 'graphql';
|
||||
|
||||
import x, {
|
||||
// comment
|
||||
y
|
||||
} from 'z';
|
||||
|
|
Loading…
Reference in New Issue