diff --git a/.eslintrc.js b/.eslintrc.js index 06d4759..2ea61de 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,5 +32,12 @@ module.exports = { "prettier/prettier": ["error"], "security/detect-non-literal-fs-filename": "off", "security/detect-object-injection": "off", + "sort-imports": [ + "error", + { + allowSeparatedGroups: true, + ignoreCase: true, + }, + ], }, }; diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 47592cc..68588da 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ - "esbenp.prettier-vscode" + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", ], "unwantedRecommendations": [] } diff --git a/src/example.ts b/src/example.ts index 0f3f1cf..e895b47 100644 --- a/src/example.ts +++ b/src/example.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* tslint:disable:no-console */ import * as PQP from "@microsoft/powerquery-parser"; + import { FormatSettings, IndentationLiteral, NewlineLiteral, TFormatError, tryFormat } from "."; const text: string = `1 as number`; @@ -13,6 +13,7 @@ const settings: FormatSettings = { }; const triedFormat: PQP.Result = tryFormat(settings, text); +/* tslint:disable:no-console */ if (PQP.ResultUtils.isOk(triedFormat)) { console.log("Your input was formatted as the following:"); console.log(triedFormat.value); diff --git a/src/powerquery-formatter/format.ts b/src/powerquery-formatter/format.ts index 3339970..9d63fdc 100644 --- a/src/powerquery-formatter/format.ts +++ b/src/powerquery-formatter/format.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { CommentCollectionMap, IsMultilineMap, @@ -9,7 +10,6 @@ import { tryTraverseComment, tryTraverseSerializeParameter, } from "./passes"; -import { tryTraverseIsMultiline } from "./passes/isMultiline/isMultiline"; import { IndentationLiteral, NewlineLiteral, @@ -17,6 +17,7 @@ import { SerializeSettings, trySerialize, } from "./serialize"; +import { tryTraverseIsMultiline } from "./passes/isMultiline/isMultiline"; export type TriedFormat = PQP.Result; diff --git a/src/powerquery-formatter/passes/comment.ts b/src/powerquery-formatter/passes/comment.ts index 6fb65bb..3b79074 100644 --- a/src/powerquery-formatter/passes/comment.ts +++ b/src/powerquery-formatter/passes/comment.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { CommentCollection, CommentCollectionMap, CommentState } from "./commonTypes"; // TODO pass in leafIds instead for a big speed boost. diff --git a/src/powerquery-formatter/passes/isMultiline/common.ts b/src/powerquery-formatter/passes/isMultiline/common.ts index 1f39c7c..43dbe8e 100644 --- a/src/powerquery-formatter/passes/isMultiline/common.ts +++ b/src/powerquery-formatter/passes/isMultiline/common.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IsMultilineMap } from "../commonTypes"; export function expectGetIsMultiline(isMultilineMap: IsMultilineMap, node: PQP.Language.Ast.TNode): boolean { diff --git a/src/powerquery-formatter/passes/isMultiline/isMultiline.ts b/src/powerquery-formatter/passes/isMultiline/isMultiline.ts index 47f0ba8..7ea477d 100644 --- a/src/powerquery-formatter/passes/isMultiline/isMultiline.ts +++ b/src/powerquery-formatter/passes/isMultiline/isMultiline.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { FormatTraceConstant } from "../../trace"; + import { CommentCollectionMap, IsMultilineMap } from "../commonTypes"; +import { FormatTraceConstant } from "../../trace"; import { tryTraverseIsMultilineFirstPass } from "./isMultilineFirstPass"; import { tryTraverseIsMultilineSecondPass } from "./isMultilineSecondPass"; diff --git a/src/powerquery-formatter/passes/isMultiline/isMultilineFirstPass.ts b/src/powerquery-formatter/passes/isMultiline/isMultilineFirstPass.ts index a1d4c4a..505cf05 100644 --- a/src/powerquery-formatter/passes/isMultiline/isMultilineFirstPass.ts +++ b/src/powerquery-formatter/passes/isMultiline/isMultilineFirstPass.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { FormatTraceConstant } from "../../trace"; + import { CommentCollection, CommentCollectionMap, @@ -11,6 +11,7 @@ import { LinearLengthMap, } from "../commonTypes"; import { expectGetIsMultiline, setIsMultiline } from "./common"; +import { FormatTraceConstant } from "../../trace"; import { getLinearLength } from "./linearLength"; export function tryTraverseIsMultilineFirstPass( diff --git a/src/powerquery-formatter/passes/isMultiline/isMultilineSecondPass.ts b/src/powerquery-formatter/passes/isMultiline/isMultilineSecondPass.ts index 3511339..c3c6920 100644 --- a/src/powerquery-formatter/passes/isMultiline/isMultilineSecondPass.ts +++ b/src/powerquery-formatter/passes/isMultiline/isMultilineSecondPass.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { FormatTraceConstant } from "../../trace"; -import { IsMultilineMap, IsMultilineSecondPassState } from "../commonTypes"; + import { expectGetIsMultiline, setIsMultiline } from "./common"; +import { IsMultilineMap, IsMultilineSecondPassState } from "../commonTypes"; +import { FormatTraceConstant } from "../../trace"; export function tryTraverseIsMultilineSecondPass( locale: string, diff --git a/src/powerquery-formatter/passes/isMultiline/linearLength.ts b/src/powerquery-formatter/passes/isMultiline/linearLength.ts index 383c134..309fc4f 100644 --- a/src/powerquery-formatter/passes/isMultiline/linearLength.ts +++ b/src/powerquery-formatter/passes/isMultiline/linearLength.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { FormatTraceConstant } from "../../trace"; + import { LinearLengthMap, LinearLengthState } from "../commonTypes"; +import { FormatTraceConstant } from "../../trace"; // Lazy evaluation of a potentially large PQP.Language.AST. // Returns the length of text if the node was formatted on a single line. diff --git a/src/powerquery-formatter/passes/visitNode/visitArrayWrapper.ts b/src/powerquery-formatter/passes/visitNode/visitArrayWrapper.ts index 2e9ec85..3ca9793 100644 --- a/src/powerquery-formatter/passes/visitNode/visitArrayWrapper.ts +++ b/src/powerquery-formatter/passes/visitNode/visitArrayWrapper.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IndentationChange, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; -import { expectGetIsMultiline } from "../isMultiline/common"; import { isSectionMemeberSimilarScope, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { expectGetIsMultiline } from "../isMultiline/common"; export function visitArrayWrapper(state: SerializeParameterState, node: PQP.Language.Ast.TArrayWrapper): void { const parent: PQP.Language.Ast.TNode = PQP.Parser.NodeIdMapUtils.assertUnboxParentAst( diff --git a/src/powerquery-formatter/passes/visitNode/visitComments.ts b/src/powerquery-formatter/passes/visitNode/visitComments.ts index 04093b2..fb744dc 100644 --- a/src/powerquery-formatter/passes/visitNode/visitComments.ts +++ b/src/powerquery-formatter/passes/visitNode/visitComments.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { CommentCollection, SerializeCommentParameter, diff --git a/src/powerquery-formatter/passes/visitNode/visitErrorHandlingExpression.ts b/src/powerquery-formatter/passes/visitNode/visitErrorHandlingExpression.ts index 12309d6..175fd9b 100644 --- a/src/powerquery-formatter/passes/visitNode/visitErrorHandlingExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitErrorHandlingExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitErrorHandlingExpression( state: SerializeParameterState, diff --git a/src/powerquery-formatter/passes/visitNode/visitErrorRaisingExpression.ts b/src/powerquery-formatter/passes/visitNode/visitErrorRaisingExpression.ts index b19d8f4..9707e07 100644 --- a/src/powerquery-formatter/passes/visitNode/visitErrorRaisingExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitErrorRaisingExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; // TPairedConstant override export function visitErrorRaisingExpression( diff --git a/src/powerquery-formatter/passes/visitNode/visitFieldSpecification.ts b/src/powerquery-formatter/passes/visitNode/visitFieldSpecification.ts index 3fa9b52..dbd2f0e 100644 --- a/src/powerquery-formatter/passes/visitNode/visitFieldSpecification.ts +++ b/src/powerquery-formatter/passes/visitNode/visitFieldSpecification.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { maybePropagateWriteKind, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { maybePropagateWriteKind, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; // TPairedConstant override export function visitFieldSpecification( diff --git a/src/powerquery-formatter/passes/visitNode/visitFieldSpecificationList.ts b/src/powerquery-formatter/passes/visitNode/visitFieldSpecificationList.ts index e25d9c6..95897c1 100644 --- a/src/powerquery-formatter/passes/visitNode/visitFieldSpecificationList.ts +++ b/src/powerquery-formatter/passes/visitNode/visitFieldSpecificationList.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitFieldTypeSpecification.ts b/src/powerquery-formatter/passes/visitNode/visitFieldTypeSpecification.ts index bffe903..8ba306d 100644 --- a/src/powerquery-formatter/passes/visitNode/visitFieldTypeSpecification.ts +++ b/src/powerquery-formatter/passes/visitNode/visitFieldTypeSpecification.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitFieldTypeSpecification( state: SerializeParameterState, diff --git a/src/powerquery-formatter/passes/visitNode/visitFunctionExpression.ts b/src/powerquery-formatter/passes/visitNode/visitFunctionExpression.ts index db4f677..d57d6ab 100644 --- a/src/powerquery-formatter/passes/visitNode/visitFunctionExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitFunctionExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitFunctionExpression( state: SerializeParameterState, diff --git a/src/powerquery-formatter/passes/visitNode/visitFunctionType.ts b/src/powerquery-formatter/passes/visitNode/visitFunctionType.ts index 3d4056c..7237aac 100644 --- a/src/powerquery-formatter/passes/visitNode/visitFunctionType.ts +++ b/src/powerquery-formatter/passes/visitNode/visitFunctionType.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitFunctionType(state: SerializeParameterState, node: PQP.Language.Ast.FunctionType): void { propagateWriteKind(state, node, node.functionConstant); diff --git a/src/powerquery-formatter/passes/visitNode/visitIdentifierExpression.ts b/src/powerquery-formatter/passes/visitNode/visitIdentifierExpression.ts index a910095..d051290 100644 --- a/src/powerquery-formatter/passes/visitNode/visitIdentifierExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitIdentifierExpression.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { DefaultSerializeParameter, SerializeParameterState } from "../commonTypes"; import { maybePropagateWriteKind, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitIfExpression.ts b/src/powerquery-formatter/passes/visitNode/visitIfExpression.ts index 28b9e0d..0e4fb8a 100644 --- a/src/powerquery-formatter/passes/visitNode/visitIfExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitIfExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitIfExpression(state: SerializeParameterState, node: PQP.Language.Ast.IfExpression): void { propagateWriteKind(state, node, node.ifConstant); diff --git a/src/powerquery-formatter/passes/visitNode/visitItemAccessExpression.ts b/src/powerquery-formatter/passes/visitNode/visitItemAccessExpression.ts index bd74e3c..500eda5 100644 --- a/src/powerquery-formatter/passes/visitNode/visitItemAccessExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitItemAccessExpression.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IsMultilineMap, SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitLeaf.ts b/src/powerquery-formatter/passes/visitNode/visitLeaf.ts index 73596fd..9092496 100644 --- a/src/powerquery-formatter/passes/visitNode/visitLeaf.ts +++ b/src/powerquery-formatter/passes/visitNode/visitLeaf.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { getWorkspace, maybeSetIndentationChange } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { visitComments } from "./visitComments"; -import { getWorkspace, maybeSetIndentationChange } from "./visitNodeUtils"; export function visitLeaf( state: SerializeParameterState, diff --git a/src/powerquery-formatter/passes/visitNode/visitLetExpression.ts b/src/powerquery-formatter/passes/visitNode/visitLetExpression.ts index 75498a4..5a7bb88 100644 --- a/src/powerquery-formatter/passes/visitNode/visitLetExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitLetExpression.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitLetExpression(state: SerializeParameterState, node: PQP.Language.Ast.LetExpression): void { propagateWriteKind(state, node, node.letConstant); diff --git a/src/powerquery-formatter/passes/visitNode/visitListType.ts b/src/powerquery-formatter/passes/visitNode/visitListType.ts index d5d0598..0fad978 100644 --- a/src/powerquery-formatter/passes/visitNode/visitListType.ts +++ b/src/powerquery-formatter/passes/visitNode/visitListType.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitMetadataExpression.ts b/src/powerquery-formatter/passes/visitNode/visitMetadataExpression.ts index c7a1d4b..7cf304e 100644 --- a/src/powerquery-formatter/passes/visitNode/visitMetadataExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitMetadataExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitMetadataExpression( state: SerializeParameterState, diff --git a/src/powerquery-formatter/passes/visitNode/visitNode.ts b/src/powerquery-formatter/passes/visitNode/visitNode.ts index ad64482..51910b8 100644 --- a/src/powerquery-formatter/passes/visitNode/visitNode.ts +++ b/src/powerquery-formatter/passes/visitNode/visitNode.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameter, SerializeParameterState } from "../commonTypes"; -import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameter, SerializeParameterState } from "../commonTypes"; +import { FormatTraceConstant } from "../../trace"; import { visitArrayWrapper } from "./visitArrayWrapper"; import { visitErrorHandlingExpression } from "./visitErrorHandlingExpression"; import { visitErrorRaisingExpression } from "./visitErrorRaisingExpression"; @@ -33,7 +34,6 @@ import { visitTParameter } from "./visitTParameter"; import { visitTWrapped } from "./visitTWrapped"; import { visitTypePrimaryType } from "./visitTypePrimaryType"; import { visitUnaryExpression } from "./visitUnaryExpression"; -import { FormatTraceConstant } from "../../trace"; export function visitNode(state: SerializeParameterState, node: PQP.Language.Ast.TNode): void { const trace: PQP.Trace.Trace = state.traceManager.entry(FormatTraceConstant.SerializeParameter, visitNode.name, { diff --git a/src/powerquery-formatter/passes/visitNode/visitNodeUtils.ts b/src/powerquery-formatter/passes/visitNode/visitNodeUtils.ts index a906cba..161207e 100644 --- a/src/powerquery-formatter/passes/visitNode/visitNodeUtils.ts +++ b/src/powerquery-formatter/passes/visitNode/visitNodeUtils.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { DefaultSerializeParameter, IndentationChange, diff --git a/src/powerquery-formatter/passes/visitNode/visitParenthesizedExpression.ts b/src/powerquery-formatter/passes/visitNode/visitParenthesizedExpression.ts index 31649a5..cbe8f77 100644 --- a/src/powerquery-formatter/passes/visitNode/visitParenthesizedExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitParenthesizedExpression.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitRangeExpression.ts b/src/powerquery-formatter/passes/visitNode/visitRangeExpression.ts index 0e58417..0f4b8fb 100644 --- a/src/powerquery-formatter/passes/visitNode/visitRangeExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitRangeExpression.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitRangeExpression(state: SerializeParameterState, node: PQP.Language.Ast.RangeExpression): void { const workspace: SerializeParameter = getWorkspace(state, node); diff --git a/src/powerquery-formatter/passes/visitNode/visitSection.ts b/src/powerquery-formatter/passes/visitNode/visitSection.ts index a6512e4..77a2b4b 100644 --- a/src/powerquery-formatter/passes/visitNode/visitSection.ts +++ b/src/powerquery-formatter/passes/visitNode/visitSection.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IsMultilineMap, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitSectionMember.ts b/src/powerquery-formatter/passes/visitNode/visitSectionMember.ts index ac790fb..ace3863 100644 --- a/src/powerquery-formatter/passes/visitNode/visitSectionMember.ts +++ b/src/powerquery-formatter/passes/visitNode/visitSectionMember.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IsMultilineMap, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; -import { expectGetIsMultiline } from "../isMultiline/common"; import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { expectGetIsMultiline } from "../isMultiline/common"; export function visitSectionMember(state: SerializeParameterState, node: PQP.Language.Ast.SectionMember): void { const isMultilineMap: IsMultilineMap = state.isMultilineMap; diff --git a/src/powerquery-formatter/passes/visitNode/visitTBinOpExpression.ts b/src/powerquery-formatter/passes/visitNode/visitTBinOpExpression.ts index c079064..7745990 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTBinOpExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTBinOpExpression.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitTBinOpExpression(state: SerializeParameterState, node: PQP.Language.Ast.TBinOpExpression): void { propagateWriteKind(state, node, node.left); diff --git a/src/powerquery-formatter/passes/visitNode/visitTCsv.ts b/src/powerquery-formatter/passes/visitNode/visitTCsv.ts index ea2f859..1aa27aa 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTCsv.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTCsv.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitTCsv(state: SerializeParameterState, node: PQP.Language.Ast.TCsv): void { const workspace: SerializeParameter = getWorkspace(state, node); diff --git a/src/powerquery-formatter/passes/visitNode/visitTKeyValuePair.ts b/src/powerquery-formatter/passes/visitNode/visitTKeyValuePair.ts index f0af322..a351f9a 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTKeyValuePair.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTKeyValuePair.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { IsMultilineMap, SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; -import { expectGetIsMultiline } from "../isMultiline/common"; import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { expectGetIsMultiline } from "../isMultiline/common"; export function visitTKeyValuePair(state: SerializeParameterState, node: PQP.Language.Ast.TKeyValuePair): void { const isMultilineMap: IsMultilineMap = state.isMultilineMap; diff --git a/src/powerquery-formatter/passes/visitNode/visitTPairedConstant.ts b/src/powerquery-formatter/passes/visitNode/visitTPairedConstant.ts index d21c757..490755b 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTPairedConstant.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTPairedConstant.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitTPairedConstant(state: SerializeParameterState, node: PQP.Language.Ast.TPairedConstant): void { propagateWriteKind(state, node, node.constant); diff --git a/src/powerquery-formatter/passes/visitNode/visitTParameter.ts b/src/powerquery-formatter/passes/visitNode/visitTParameter.ts index 0be1b94..7f446d9 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTParameter.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTParameter.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { setWorkspace } from "./visitNodeUtils"; diff --git a/src/powerquery-formatter/passes/visitNode/visitTWrapped.ts b/src/powerquery-formatter/passes/visitNode/visitTWrapped.ts index bcd14b7..14edaa2 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTWrapped.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTWrapped.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { getWorkspace, propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitTWrapped(state: SerializeParameterState, node: PQP.Language.Ast.TWrapped): void { const isMultiline: boolean = expectGetIsMultiline(state.isMultilineMap, node); diff --git a/src/powerquery-formatter/passes/visitNode/visitTableType.ts b/src/powerquery-formatter/passes/visitNode/visitTableType.ts index 24e6ba0..e224f26 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTableType.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTableType.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; export function visitTableType(state: SerializeParameterState, node: PQP.Language.Ast.TableType): void { propagateWriteKind(state, node, node.tableConstant); diff --git a/src/powerquery-formatter/passes/visitNode/visitTypePrimaryType.ts b/src/powerquery-formatter/passes/visitNode/visitTypePrimaryType.ts index 90e92ab..44d10af 100644 --- a/src/powerquery-formatter/passes/visitNode/visitTypePrimaryType.ts +++ b/src/powerquery-formatter/passes/visitNode/visitTypePrimaryType.ts @@ -2,9 +2,10 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + +import { propagateWriteKind, setWorkspace, skipPrimaryTypeIndentation } from "./visitNodeUtils"; import { SerializeParameter, SerializeParameterState, SerializeWriteKind } from "../commonTypes"; import { expectGetIsMultiline } from "../isMultiline/common"; -import { propagateWriteKind, setWorkspace, skipPrimaryTypeIndentation } from "./visitNodeUtils"; export function visitTypePrimaryType(state: SerializeParameterState, node: PQP.Language.Ast.TypePrimaryType): void { propagateWriteKind(state, node, node.constant); diff --git a/src/powerquery-formatter/passes/visitNode/visitUnaryExpression.ts b/src/powerquery-formatter/passes/visitNode/visitUnaryExpression.ts index d7993bf..66112fe 100644 --- a/src/powerquery-formatter/passes/visitNode/visitUnaryExpression.ts +++ b/src/powerquery-formatter/passes/visitNode/visitUnaryExpression.ts @@ -2,8 +2,9 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; -import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; + import { propagateWriteKind, setWorkspace } from "./visitNodeUtils"; +import { SerializeParameterState, SerializeWriteKind } from "../commonTypes"; export function visitUnaryExpression(state: SerializeParameterState, node: PQP.Language.Ast.UnaryExpression): void { propagateWriteKind(state, node, node.operators); diff --git a/src/powerquery-formatter/serialize.ts b/src/powerquery-formatter/serialize.ts index 1d28d52..327b39e 100644 --- a/src/powerquery-formatter/serialize.ts +++ b/src/powerquery-formatter/serialize.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import * as PQP from "@microsoft/powerquery-parser"; + import { CommentCollectionMap, IndentationChange, diff --git a/src/test/common.ts b/src/test/common.ts index 0e4c36b..e8d55e0 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import "mocha"; import * as PQP from "@microsoft/powerquery-parser"; import { expect } from "chai"; -import "mocha"; import { FormatSettings, IndentationLiteral, NewlineLiteral, TriedFormat, tryFormat } from "..";