Fix flow extends not breaking out into new lines (#5244)
parent
2cc32da5af
commit
1234ceb1d6
|
@ -2651,7 +2651,11 @@ function printPathNoParens(path, options, print, args) {
|
||||||
parts.push(
|
parts.push(
|
||||||
group(
|
group(
|
||||||
indent(
|
indent(
|
||||||
concat([line, "extends ", join(", ", path.map(print, "extends"))])
|
concat([
|
||||||
|
line,
|
||||||
|
"extends ",
|
||||||
|
indent(join(concat([",", line]), path.map(print, "extends")))
|
||||||
|
])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,6 +19,52 @@ export class Environment2 extends GenericEnvironment<
|
||||||
> {
|
> {
|
||||||
m() {};
|
m() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Declare Interface Break
|
||||||
|
declare interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface declaration break
|
||||||
|
interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||||
|
s: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic Types
|
||||||
|
interface ExtendsOne extends ASingleInterface<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany
|
||||||
|
extends ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsManyWithGenerics
|
||||||
|
extends InterfaceOne, InterfaceTwo, ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7>, InterfaceThree {
|
||||||
|
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
export interface Environment1
|
export interface Environment1
|
||||||
extends GenericEnvironment<SomeType, AnotherType, YetAnotherType> {
|
extends GenericEnvironment<SomeType, AnotherType, YetAnotherType> {
|
||||||
|
@ -36,6 +82,87 @@ export class Environment2 extends GenericEnvironment<
|
||||||
m() {}
|
m() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Declare Interface Break
|
||||||
|
declare interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsLarge
|
||||||
|
extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsMany
|
||||||
|
extends Interface1,
|
||||||
|
Interface2,
|
||||||
|
Interface3,
|
||||||
|
Interface4,
|
||||||
|
Interface5,
|
||||||
|
Interface6,
|
||||||
|
Interface7 {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface declaration break
|
||||||
|
interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge
|
||||||
|
extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany
|
||||||
|
extends Interface1,
|
||||||
|
Interface2,
|
||||||
|
Interface3,
|
||||||
|
Interface4,
|
||||||
|
Interface5,
|
||||||
|
Interface6,
|
||||||
|
Interface7 {
|
||||||
|
s: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic Types
|
||||||
|
interface ExtendsOne extends ASingleInterface<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge
|
||||||
|
extends ASingleInterfaceWithAReallyReallyReallyReallyLongName<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany
|
||||||
|
extends ASingleGenericInterface<
|
||||||
|
Interface1,
|
||||||
|
Interface2,
|
||||||
|
Interface3,
|
||||||
|
Interface4,
|
||||||
|
Interface5,
|
||||||
|
Interface6,
|
||||||
|
Interface7
|
||||||
|
> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsManyWithGenerics
|
||||||
|
extends InterfaceOne,
|
||||||
|
InterfaceTwo,
|
||||||
|
ASingleGenericInterface<
|
||||||
|
Interface1,
|
||||||
|
Interface2,
|
||||||
|
Interface3,
|
||||||
|
Interface4,
|
||||||
|
Interface5,
|
||||||
|
Interface6,
|
||||||
|
Interface7
|
||||||
|
>,
|
||||||
|
InterfaceThree {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`module.js - flow-verify 1`] = `
|
exports[`module.js - flow-verify 1`] = `
|
||||||
|
|
|
@ -16,3 +16,49 @@ export class Environment2 extends GenericEnvironment<
|
||||||
> {
|
> {
|
||||||
m() {};
|
m() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Declare Interface Break
|
||||||
|
declare interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface declaration break
|
||||||
|
interface ExtendsOne extends ASingleInterface {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||||
|
s: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic Types
|
||||||
|
interface ExtendsOne extends ASingleInterface<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName<string> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsMany
|
||||||
|
extends ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7> {
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExtendsManyWithGenerics
|
||||||
|
extends InterfaceOne, InterfaceTwo, ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7>, InterfaceThree {
|
||||||
|
|
||||||
|
x: string;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue