Skip to content

Commit

Permalink
chore: update dependencies (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker authored Sep 29, 2022
1 parent dc1ce95 commit df7a20a
Show file tree
Hide file tree
Showing 17 changed files with 1,533 additions and 1,073 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
- "16"
- "14"
- "12"
- "10"
- "8"
- "6"
name: Node.js ${{ matrix.node_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
"release": "standard-version"
},
"dependencies": {
"lines-and-columns": "^1.1.6",
"tslib": "^1.10.0",
"lines-and-columns": "^2.0.3",
"tslib": "^2.4.0",
"yaml": "^1.10.0"
},
"devDependencies": {
"@types/jest": "23.3.14",
"@types/node": "6.14.9",
"@types/node": "18.7.23",
"jest": "23.6.0",
"jest-snapshot-serializer-raw": "1.1.0",
"patch-package": "6.2.2",
"prettier": "1.18.2",
"standard-version": "4.4.0",
"jest-snapshot-serializer-raw": "1.2.0",
"patch-package": "6.4.7",
"prettier": "2.7.1",
"standard-version": "9.5.0",
"ts-jest": "23.10.5",
"tslint": "5.20.1",
"tslint": "6.1.3",
"tslint-config-prettier": "1.18.0",
"tslint-plugin-prettier": "2.1.0",
"tslint-plugin-prettier": "2.3.0",
"typescript": "3.7.5"
},
"engines": {
Expand Down
6 changes: 6 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";

module.exports = {
trailingComma: "all",
arrowParens: "avoid"
};
15 changes: 9 additions & 6 deletions src/attach.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,12 @@ bb:
# comment 2`,
];

testCases(cases.map((x): TestCaseSingle => [x, selector]), {
maxChildrenLevel: 0,
maxCommentsLevel: 1,
codeFrameMaxHeight: 2,
selectNodeToStringify: node => (node as Comment)._parent!,
});
testCases(
cases.map((x): TestCaseSingle => [x, selector]),
{
maxChildrenLevel: 0,
maxCommentsLevel: 1,
codeFrameMaxHeight: 2,
selectNodeToStringify: node => (node as Comment)._parent!,
},
);
2 changes: 1 addition & 1 deletion src/attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function initNodeTable(nodeTable: NodeTable, node: YamlUnistNode): void {
}

if ("children" in node) {
(node.children as Array<(typeof node.children)[number]>).forEach(child => {
(node.children as Array<typeof node.children[number]>).forEach(child => {
initNodeTable(nodeTable, child);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/factories/flow-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createEndCommentAttachable } from "./end-comment-attachable";
import { createNode } from "./node";

export function createFlowCollection<
T extends FlowMappingItem | FlowSequenceItem
T extends FlowMappingItem | FlowSequenceItem,
>(position: Position, content: Content, children: T[]) {
return {
...createNode("flowCollection", position),
Expand Down
29 changes: 14 additions & 15 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,11 @@ function stringifyNode(
.join(" ");
const propNodes =
"tag" in node
? ([node.tag, node.anchor].filter(propNode => propNode !== null) as Array<
NonNullable<Tag | Anchor>
>).map(propNode => stringifyNode(propNode))
? (
[node.tag, node.anchor].filter(
propNode => propNode !== null,
) as Array<NonNullable<Tag | Anchor>>
).map(propNode => stringifyNode(propNode))
: [];
const comments =
options.maxCommentsLevel === undefined || options.maxCommentsLevel > 0
Expand Down Expand Up @@ -300,18 +302,15 @@ function codeFrameColumns(

return lines
.slice(start, end)
.reduce(
(reduced, line, index) => {
const gutter = leftpad(`${index + 1 + start}`, gutterWidth);
return reduced.concat(
`${gutter} | ${line.replace(/ /g, "·")}`,
markerLines[index + start]
? `${" ".repeat(gutterWidth)} | ${markerLines[index + start]}`
: [],
);
},
[] as string[],
)
.reduce((reduced, line, index) => {
const gutter = leftpad(`${index + 1 + start}`, gutterWidth);
return reduced.concat(
`${gutter} | ${line.replace(/ /g, "·")}`,
markerLines[index + start]
? `${" ".repeat(gutterWidth)} | ${markerLines[index + start]}`
: [],
);
}, [] as string[])
.join("\n");
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LinesAndColumns from "lines-and-columns";
import { LinesAndColumns } from "lines-and-columns";
import { attachComments } from "./attach";
import { createRoot } from "./factories/root";
import { removeCstBlankLine } from "./preprocess";
Expand Down
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LinesAndColumns from "lines-and-columns";
import { LinesAndColumns } from "lines-and-columns";
import { transformAlias } from "./transforms/alias";
import { transformBlockFolded } from "./transforms/block-folded";
import { transformBlockLiteral } from "./transforms/block-literal";
Expand Down
6 changes: 2 additions & 4 deletions src/transforms/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ export function transformDocument(
document: YAML.ast.Document,
context: Context,
): Document {
const {
createDocumentHeadWithTrailingComment,
documentHeadEndMarkerPoint,
} = transformDocumentHead(document, context);
const { createDocumentHeadWithTrailingComment, documentHeadEndMarkerPoint } =
transformDocumentHead(document, context);

const {
documentBody,
Expand Down
6 changes: 2 additions & 4 deletions src/transforms/flow-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ export function transformFlowMap(
const flowMappingItems = flowMap.items.map((pair, index) => {
const cstNodes = groupedCstItems[index];

const {
additionalKeyRange,
additionalValueRange,
} = getFlowMapItemAdditionalRanges(cstNodes);
const { additionalKeyRange, additionalValueRange } =
getFlowMapItemAdditionalRanges(cstNodes);

return transformAstPair(
pair,
Expand Down
13 changes: 5 additions & 8 deletions src/transforms/flow-seq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,18 @@ export function transformFlowSeq(

const flowSequenceItems = flowSeq.items.map((item, index) => {
if (item.type !== "PAIR") {
const node = context.transformNode(item as Exclude<
typeof item,
YAML.ast.Pair
>);
const node = context.transformNode(
item as Exclude<typeof item, YAML.ast.Pair>,
);
return createFlowSequenceItem(
createPosition(node.position.start, node.position.end),
node,
);
} else {
const cstNodes = groupedCstItems[index];

const {
additionalKeyRange,
additionalValueRange,
} = getFlowMapItemAdditionalRanges(cstNodes);
const { additionalKeyRange, additionalValueRange } =
getFlowMapItemAdditionalRanges(cstNodes);

return transformAstPair(
item,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/define-parents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function defineParents(
parent: YamlUnistNode | null = null,
): void {
if ("children" in node) {
(node.children as Array<(typeof node.children)[number]>).forEach(child =>
(node.children as Array<typeof node.children[number]>).forEach(child =>
defineParents(child, node),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/group-cst-flow-collection-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type CstFlowSeqItemWithoutComment = Exclude<
>;

export function groupCstFlowCollectionItems<
T extends CstFlowMapItemWithoutComment[] | CstFlowSeqItemWithoutComment[]
T extends CstFlowMapItemWithoutComment[] | CstFlowSeqItemWithoutComment[],
>(cstItems: T): T[];
export function groupCstFlowCollectionItems(
cstItems: CstFlowMapItemWithoutComment[] | CstFlowSeqItemWithoutComment[],
Expand Down
2 changes: 1 addition & 1 deletion src/utils/update-positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function updatePositions(node: YamlUnistNode): void {
return;
}

const children = node.children as Array<(typeof node.children)[number]>;
const children = node.children as Array<typeof node.children[number]>;
children.forEach(updatePositions);

if (node.type === "document") {
Expand Down
5 changes: 3 additions & 2 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rulesDirectory": ["tslint-plugin-prettier"],
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"prettier": [true, { "trailingComma": "all" }],
"prettier": true,
"object-literal-sort-keys": false,
"interface-name": false,
"variable-name": [
Expand All @@ -11,6 +11,7 @@
"ban-keywords",
"allow-leading-underscore"
],
"no-duplicate-switch-case": true
"no-duplicate-switch-case": true,
"array-type": false
}
}
Loading

0 comments on commit df7a20a

Please sign in to comment.