@huggingface/prettier-plugin-vertical-align
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -5,3 +5,3 @@ import prettier from "prettier"; | ||
import { getOriginalPrinter } from "./original-printer.js"; | ||
const { group } = doc.builders; | ||
const { group, softline, line, ifBreak, indent } = doc.builders; | ||
const keyLengthSymbol = Symbol("keyLength"); | ||
@@ -28,3 +28,4 @@ const typeAnnotationPrefix = Symbol("typeAnnotation"); | ||
case "Property": | ||
case "ObjectProperty": | ||
case "ObjectProperty": { | ||
const shouldMoveCompletelyToNextLine = node.value.type !== "ObjectExpression" && node.value.type !== "ArrayExpression"; | ||
return group([ | ||
@@ -35,4 +36,7 @@ node.computed ? "[" : "", | ||
":" + " ".repeat(addedLength + 1), | ||
path.call(_print, valueField(node)), | ||
shouldMoveCompletelyToNextLine | ||
? ifBreak(indent(group([line, path.call(_print, valueField(node))])), path.call(_print, valueField(node))) | ||
: path.call(_print, valueField(node)), | ||
]); | ||
} | ||
case "TSPropertySignature": | ||
@@ -39,0 +43,0 @@ node.typeAnnotation[typeAnnotationPrefix] = addedLength; |
{ | ||
"name": "@huggingface/prettier-plugin-vertical-align", | ||
"packageManager": "pnpm@9.11.0", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ import type { AstPath, Printer } from "prettier"; | ||
const { group } = doc.builders; | ||
const { group, softline, line, ifBreak, indent } = doc.builders; | ||
@@ -40,3 +40,5 @@ type Node = AstPath["node"]; | ||
case "Property": | ||
case "ObjectProperty": | ||
case "ObjectProperty": { | ||
const shouldMoveCompletelyToNextLine = | ||
node.value.type !== "ObjectExpression" && node.value.type !== "ArrayExpression"; | ||
return group([ | ||
@@ -47,4 +49,7 @@ node.computed ? "[" : "", | ||
":" + " ".repeat(addedLength + 1), | ||
path.call(_print, valueField(node)), | ||
shouldMoveCompletelyToNextLine | ||
? ifBreak(indent(group([line, path.call(_print, valueField(node))])), path.call(_print, valueField(node))) | ||
: path.call(_print, valueField(node)), | ||
]); | ||
} | ||
case "TSPropertySignature": | ||
@@ -51,0 +56,0 @@ node.typeAnnotation[typeAnnotationPrefix] = addedLength; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43254
17
857
1