Update to Prettier 2.3 (#13288)

This commit is contained in:
Sosuke Suzuki
2021-05-10 22:34:13 +09:00
committed by GitHub
parent 5ae3a6c2a4
commit b2d9156cc6
45 changed files with 262 additions and 364 deletions

View File

@@ -200,16 +200,19 @@ export const nodes: {
* Test if Property needs whitespace.
*/
nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (
node: t.ObjectProperty | t.ObjectTypeProperty | t.ObjectMethod,
parent: any,
): WhitespaceObject | undefined | null {
if (parent.properties[0] === node) {
return {
before: true,
nodes.ObjectProperty =
nodes.ObjectTypeProperty =
nodes.ObjectMethod =
function (
node: t.ObjectProperty | t.ObjectTypeProperty | t.ObjectMethod,
parent: any,
): WhitespaceObject | undefined | null {
if (parent.properties[0] === node) {
return {
before: true,
};
}
};
}
};
nodes.ObjectTypeCallProperty = function (
node: t.ObjectTypeCallProperty,
@@ -287,14 +290,16 @@ export const list = {
* Add whitespace tests for nodes and their aliases.
*/
([
["Function", true],
["Class", true],
["Loop", true],
["LabeledStatement", true],
["SwitchStatement", true],
["TryStatement", true],
] as Array<[string, any]>).forEach(function ([type, amounts]) {
(
[
["Function", true],
["Class", true],
["Loop", true],
["LabeledStatement", true],
["SwitchStatement", true],
["TryStatement", true],
] as Array<[string, any]>
).forEach(function ([type, amounts]) {
if (typeof amounts === "boolean") {
amounts = { after: amounts, before: amounts };
}