Treat --trailing-comma=es5 as all when printing tuple types (#14086)
This commit is contained in:
1 parent
22d66b8947
commit
58ae337fea
5 files changed
+145
-9
No files matched your search
@@ -109,12 +109,7 @@ function printArray(path, options, print) {
|
||||
? ""
|
||||
: needsForcedTrailingComma
|
||||
? ","
|
||||
: !shouldPrintComma(
|
||||
options,
|
||||
node.type === "TSTupleType" || node.type === "TupleTypeAnnotation"
|
||||
? "all"
|
||||
: "es5"
|
||||
)
|
||||
: !shouldPrintComma(options)
|
||||
? ""
|
||||
: shouldUseConciseFormatting
|
||||
? ifBreak(",", "", { groupId })
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`trailing-comma.js - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "babel-flow"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma.js - {"trailingComma":"es5"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "babel-flow"]
|
||||
printWidth: 80
|
||||
trailingComma: "es5"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma.js - {"trailingComma":"none"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "babel-flow"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string
|
||||
} // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,3 @@
|
||||
run_spec(import.meta, ["flow", "babel-flow"], { trailingComma: "none" });
|
||||
run_spec(import.meta, ["flow", "babel-flow"], { trailingComma: "es5" });
|
||||
run_spec(import.meta, ["flow", "babel-flow"], { trailingComma: "all" });
|
||||
@@ -0,0 +1,14 @@
|
||||
export interface ShopQueryResult {
|
||||
chic: boolean;
|
||||
location: number[];
|
||||
menus: Menu[];
|
||||
openingDays: number[];
|
||||
closingDays: [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ export interface ShopQueryResult {
|
||||
{
|
||||
from: string;
|
||||
to: string;
|
||||
} // <== this one
|
||||
}, // <== this one
|
||||
];
|
||||
shop: string;
|
||||
distance: number;
|
||||
@@ -439,7 +439,7 @@ type ValidateArgs = [
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
...string[],
|
||||
];
|
||||
|
||||
================================================================================
|
||||
@@ -528,7 +528,7 @@ export type SCMRawResource = [
|
||||
modes.Command /*command*/,
|
||||
string[] /*icons: light, dark*/,
|
||||
boolean /*strike through*/,
|
||||
boolean /*faded*/
|
||||
boolean /*faded*/,
|
||||
];
|
||||
|
||||
================================================================================
|
||||
|
||||
Reference in new issue
Block a user