@huggingface/prettier-plugin-vertical-align
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -36,3 +36,2 @@ import prettier from "prettier"; | ||
case "ObjectProperty": { | ||
const shouldMoveCompletelyToNextLine = node.value.type === "LogicalExpression"; | ||
// console.log(node.value.type); | ||
@@ -44,3 +43,3 @@ return group([ | ||
":" + " ".repeat(addedLength + 1), | ||
shouldMoveCompletelyToNextLine | ||
shouldMoveCompletelyToNextLine(node[valueField(node)]) | ||
? ifBreak(indent(group([line, path.call(_print, valueField(node))])), path.call(_print, valueField(node))) | ||
@@ -62,6 +61,7 @@ : path.call(_print, valueField(node)), | ||
if (isPropertyContainer(node)) { | ||
// console.log("node", node); | ||
// console.log("node", inspect(node, {depth: 10})); | ||
const properties = nodeProperties(node) | ||
.filter(isProperty) | ||
.filter((node) => node.key.loc.start.line === node.key.loc.end.line && !node.shorthand); | ||
.filter((node) => node.key.loc.start.line === node.key.loc.end.line && !node.shorthand && !node.method); | ||
// Check props are not on the same line (we don't want to add extra spaces in that case) | ||
@@ -68,0 +68,0 @@ if (properties.length > 1 && properties[1].loc.start.line !== properties[0].loc.start.line) { |
{ | ||
"name": "@huggingface/prettier-plugin-vertical-align", | ||
"packageManager": "pnpm@9.11.0", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -50,3 +50,2 @@ import type { AstPath, Printer } from "prettier"; | ||
case "ObjectProperty": { | ||
const shouldMoveCompletelyToNextLine = node.value.type === "LogicalExpression"; | ||
// console.log(node.value.type); | ||
@@ -58,3 +57,3 @@ return group([ | ||
":" + " ".repeat(addedLength + 1), | ||
shouldMoveCompletelyToNextLine | ||
shouldMoveCompletelyToNextLine(node[valueField(node)]) | ||
? ifBreak(indent(group([line, path.call(_print, valueField(node))])), path.call(_print, valueField(node))) | ||
@@ -78,6 +77,7 @@ : path.call(_print, valueField(node)), | ||
if (isPropertyContainer(node)) { | ||
// console.log("node", node); | ||
// console.log("node", inspect(node, {depth: 10})); | ||
const properties: Node[] = nodeProperties(node) | ||
.filter(isProperty) | ||
.filter((node: Node) => node.key.loc.start.line === node.key.loc.end.line && !node.shorthand); | ||
.filter((node: Node) => node.key.loc.start.line === node.key.loc.end.line && !node.shorthand && !node.method); | ||
@@ -84,0 +84,0 @@ // Check props are not on the same line (we don't want to add extra spaces in that case) |
Sorry, the diff of this file is not supported yet
44022