[7.0] Drop flowUsesCommas option from babel-generator (#5123)
This commit is contained in:
@@ -37,7 +37,6 @@ minified | boolean | `false` | Should the output be minif
|
||||
concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`)
|
||||
quotes | `'single'` or `'double'` | autodetect based on `ast.tokens` | The type of quote to use in the output
|
||||
filename | string | | Used in warning messages
|
||||
flowCommaSeparator | boolean | `false` | Set to `true` to use commas instead of semicolons as Flow property separators
|
||||
jsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with "json": true to print "\u00A9" vs. "©";
|
||||
Options for source maps:
|
||||
|
||||
|
||||
@@ -277,11 +277,7 @@ export function ObjectTypeAnnotation(node: Object) {
|
||||
statement: true,
|
||||
iterator: () => {
|
||||
if (props.length !== 1) {
|
||||
if (this.format.flowCommaSeparator) {
|
||||
this.token(",");
|
||||
} else {
|
||||
this.semicolon();
|
||||
}
|
||||
this.token(",");
|
||||
this.space();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ function normalizeOptions(code, opts, tokens): Format {
|
||||
adjustMultilineComment: true,
|
||||
style: style,
|
||||
base: 0
|
||||
},
|
||||
flowCommaSeparator: opts.flowCommaSeparator,
|
||||
}
|
||||
};
|
||||
|
||||
if (format.minified) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var a: { (): number };
|
||||
var a: { (): number };
|
||||
var a: { y: string; (): number; (x: string): string; };
|
||||
var a: { y: string, (): number, (x: string): string, };
|
||||
var a: { <T>(x: T): number };
|
||||
interface A { (): number };
|
||||
|
||||
@@ -6,7 +6,7 @@ declare function foo<T>(): void;
|
||||
declare function foo(x: number, y: string): void;
|
||||
declare class A {}
|
||||
declare class A<T> extends B<T> { x: number }
|
||||
declare class A { static foo: () => number; static x: string; }
|
||||
declare class A { static foo: () => number, static x: string, }
|
||||
declare class A { static [indexer: number]: string }
|
||||
declare class A { static (): number }
|
||||
declare class A mixins B<T>, C {}
|
||||
|
||||
@@ -2,7 +2,7 @@ interface A {};
|
||||
interface A extends B {};
|
||||
interface A<T> extends B<T>, C<T> {};
|
||||
interface A { foo: () => number };
|
||||
interface Dictionary { length: number; [index: string]: string; };
|
||||
interface Dictionary { length: number, [index: string]: string, };
|
||||
class Foo implements Bar {}
|
||||
class Foo extends Bar implements Bat, Man<number> {}
|
||||
class Foo extends class Bar implements Bat {} {}
|
||||
|
||||
@@ -38,14 +38,14 @@ var numVal: number;
|
||||
var numVal: number = otherNumVal;
|
||||
var a: { numVal: number };
|
||||
var a: { numVal: number };
|
||||
var a: { numVal: number; [indexer: string]: number; };
|
||||
var a: { numVal: number, [indexer: string]: number, };
|
||||
var a: ?{ numVal: number };
|
||||
var a: { numVal: number; strVal: string; };
|
||||
var a: { numVal: number, strVal: string, };
|
||||
var a: { subObj: { strVal: string } };
|
||||
var a: { subObj: ?{ strVal: string } };
|
||||
var a: { param1: number; param2: string; };
|
||||
var a: { param1: number; param2?: string; };
|
||||
var a: { [a: number]: string; [b: number]: string; };
|
||||
var a: { param1: number, param2: string, };
|
||||
var a: { param1: number, param2?: string, };
|
||||
var a: { [a: number]: string, [b: number]: string, };
|
||||
var a: { add: (x: number, ...y: Array<string>) => void };
|
||||
var a: { subtract: (x: number, ...y: Array<string>) => void };
|
||||
var a: { id: <T>(x: T) => T };
|
||||
@@ -112,14 +112,14 @@ export interface qux<T> { p: T };
|
||||
var a: ?Array<?string>;
|
||||
var a: {| numVal: number |};
|
||||
var a: {| numVal: number |};
|
||||
var a: {| numVal: number; [indexer: string]: number; |};
|
||||
var a: {| numVal: number, [indexer: string]: number, |};
|
||||
var a: ?{| numVal: number |};
|
||||
var a: {| numVal: number; strVal: string; |};
|
||||
var a: {| numVal: number, strVal: string, |};
|
||||
var a: {| subObj: { strVal: string } |};
|
||||
var a: {| subObj: ?{ strVal: string } |};
|
||||
var a: {| param1: number; param2: string; |};
|
||||
var a: {| param1: number; param2?: string; |};
|
||||
var a: {| [a: number]: string; [b: number]: string; |};
|
||||
var a: {| param1: number, param2: string, |};
|
||||
var a: {| param1: number, param2?: string, |};
|
||||
var a: {| [a: number]: string, [b: number]: string, |};
|
||||
var a: {| add: (x: number, ...y: Array<string>) => void |};
|
||||
var a: {| subtract: (x: number, ...y: Array<string>) => void |};
|
||||
var a: {| id: <T>(x: T) => T |};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(xxx: number);
|
||||
({ xxx: 0, yyy: "hey" }: { xxx: number; yyy: string; });
|
||||
({ xxx: 0, yyy: "hey" }: { xxx: number, yyy: string, });
|
||||
(xxx => xxx + 1: (xxx: number) => number);
|
||||
(xxx: number), (yyy: string);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"flowCommaSeparator": true
|
||||
}
|
||||
@@ -259,7 +259,7 @@ describe("programmatic generation", function() {
|
||||
const output = generate(objectStatement).code;
|
||||
assert.equal(output, [
|
||||
"{",
|
||||
" bar: string;",
|
||||
" bar: string,",
|
||||
"}",
|
||||
].join("\n"));
|
||||
});
|
||||
@@ -280,7 +280,7 @@ describe("programmatic generation", function() {
|
||||
|
||||
assert.equal(output, [
|
||||
"{",
|
||||
" [key: any]: Test;",
|
||||
" [key: any]: Test,",
|
||||
"}",
|
||||
].join("\n"));
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ declare function foo<T>(): void;
|
||||
declare function foo(x: number, y: string): void;
|
||||
declare class A {}
|
||||
declare class A<T> extends B<T> { x: number }
|
||||
declare class A { static foo(): number; static x : string }
|
||||
declare class A { static foo(): number, static x : string }
|
||||
declare class A { static [ indexer: number]: string }
|
||||
declare class A { static () : number }
|
||||
declare class A mixins B<T>, C {}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/*:: declare function foo(x: number, y: string): void;*/
|
||||
/*:: declare class A {}*/
|
||||
/*:: declare class A<T> extends B<T> { x: number }*/
|
||||
/*:: declare class A { static foo(): number; static x : string }*/
|
||||
/*:: declare class A { static foo(): number, static x : string }*/
|
||||
/*:: declare class A { static [ indexer: number]: string }*/
|
||||
/*:: declare class A { static () : number }*/
|
||||
/*:: declare class A mixins B<T>, C {}*/
|
||||
|
||||
Reference in New Issue
Block a user