Ran into an error attempting format an interface that had JSDoc comments above the properties:
(node:12328) UnhandledPromiseRejectionWarning: Error: Manipulation error: Error replacing tree! Perhaps a syntax error was inserted (Current: MultiLineCommentTrivia -- New: PropertySignature).
-- Details --
Path: /Users/Brandon/collation/src/utils/get-alphabetical-messages.ts
Text: "import { RuleViolation } from \"../models/rule-violation\";\n\ninterface GetHintOptions<TElement, TElementStructure = TElement> {\n /* Expected index of the element*/\n expectedIndex: number;\n /* Name of the parent node (i.e. ButtonProps, <Button />, useEffect, etc) */\n /* Original index of the element that's out of order */\n index: number;\n parentName: string;\n /* Name of element type that's out of order (i.e. prop, property, etc) */\n elementTypeName: string;\n /* Original collection of elements that are out of order */\n original: TElement[];\n /* Sorted collection of elements or their transformed structures */\n sorted: TElementStructure[];\n /* Function to return the element's actual name */\n getElementName: (element: TElement) => string;\n /* Function to return the transformed element's actual name */\n getElementStructureName: (elementStructure: TElementStructure) => string;\n}\n\nconst getAlphabeticalMessages = <TElement, TElementStructure = TElement>(\n options: GetHintOptions<TElement, TElementStructure>\n): Pick<RuleViolation, \"hint\" | \"message\"> => {\n const {\n index,\n expectedIndex,\n parentName,\n elementTypeName,\n original,\n sorted,\n getElementName,\n getElementStructureName,\n } = options;\n\n const propertyName = getElementName(original[index]);\n const propertyMovedToLastPosition = expectedIndex + 1 === sorted.length;\n const relativePropertyName = getElementStructureName(\n sorted[\n propertyMovedToLastPosition ? expectedIndex - 1 : expectedIndex + 1\n ]\n );\n const relativePosition = propertyMovedToLastPosition ? \"after\" : \"before\";\n const hint = `'${propertyName}' should appear alphabetically ${relativePosition} '${relativePropertyName}'.`;\n const message = `Expected ${elementTypeName} '${propertyName}' in '${parentName}' (index ${index}) to be at index ${expectedIndex}.`;\n\n return { hint, message };\n};\n\nexport { getAlphabeticalMessages };\n"
Stack: Error: Error replacing tree! Perhaps a syntax error was inserted (Current: MultiLineCommentTrivia -- New: PropertySignature).
at StraightReplacementNodeHandler.handleNode (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1428:19)
at NodeHandlerHelper.handleForValues (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1375:21)
at ChangeChildOrderParentHandler.handleNode (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1459:25)
at ParentFinderReplacementNodeHandler.handleNode (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1569:36)
at NodeHandlerHelper.handleForValues (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1375:21)
at ParentFinderReplacementNodeHandler.handleChildren (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1442:25)
at ParentFinderReplacementNodeHandler.handleNode (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1432:18)
at ParentFinderReplacementNodeHandler.handleNode (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1572:19)
at NodeHandlerHelper.handleForValues (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1375:21)
at ParentFinderReplacementNodeHandler.handleChildren (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:1442:25)
at throwError (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:2300:19)
at doManipulation (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:2298:9)
at changeChildOrder (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:2568:5)
at PropertySignature.setOrder (/Users/Brandon/collation/node_modules/ts-morph/dist/ts-morph.js:5801:13)
at /Users/Brandon/collation/dist/collation.js:9446:14
at Array.map (<anonymous>)
at alphabetizeInterface (/Users/Brandon/collation/dist/collation.js:9440:29)
at Array.map (<anonymous>)
at alphabetizeInterfaces (/Users/Brandon/collation/dist/collation.js:9419:57)
at Array.map (<anonymous>)
I'm adding a failing test that will be skipped and should pass with this issue.
Ran into an error attempting format an interface that had JSDoc comments above the properties:
I'm adding a failing test that will be skipped and should pass with this issue.