Skip to content

Commit 8979b85

Browse files
committed
npm run format
1 parent 504a138 commit 8979b85

16 files changed

+40
-37
lines changed

src/block/Pack.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const packing = (packs: Pack[], row: Row): Pack[] => {
2222
type: /^\s*code:/.test(row.text)
2323
? "codeBlock"
2424
: /^\s*table:/.test(row.text)
25-
? "table"
26-
: "line",
25+
? "table"
26+
: "line",
2727
rows: [row],
2828
});
2929

src/block/Table.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export const convertToTable = (pack: TablePack): Table => {
3737
nested: false,
3838
quoted: false,
3939
context: "table",
40-
})
41-
)
40+
}),
41+
),
4242
),
4343
};
4444
};

src/block/node/CommandLineNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const commandLineRegExp = /^[$%] .+$/;
99

1010
const createCommandLineNode: NodeCreator<CommandLineNode | PlainNode> = (
1111
raw: string,
12-
opts
12+
opts,
1313
) => {
1414
if (opts.context === "table") {
1515
return createPlainNode(raw, opts);
@@ -34,5 +34,5 @@ export const CommandLineNodeParser: NodeParser = createNodeParser(
3434
parseOnNested: false,
3535
parseOnQuoted: false,
3636
patterns: [commandLineRegExp],
37-
}
37+
},
3838
);

src/block/node/DecorationNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type Decoration = Exclude<DecorationChar, "*"> | AsteriskDecorationChar;
5050

5151
const createDecorationNode: NodeCreator<DecorationNode | PlainNode> = (
5252
raw,
53-
opts
53+
opts,
5454
) => {
5555
if (opts.context === "table") {
5656
return createPlainNode(raw, opts);
@@ -84,5 +84,5 @@ export const DecorationNodeParser: NodeParser = createNodeParser(
8484
parseOnNested: false,
8585
parseOnQuoted: true,
8686
patterns: [decorationRegExp],
87-
}
87+
},
8888
);

src/block/node/ExternalLinkNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const httpRegExp = /https?:\/\/[^\s]+/;
1212

1313
const createExternalLinkNode: NodeCreator<LinkNode | PlainNode> = (
1414
raw,
15-
opts
15+
opts,
1616
) => {
1717
if (opts.context === "table") {
1818
return createPlainNode(raw, opts);
@@ -55,5 +55,5 @@ export const ExternalLinkNodeParser: NodeParser = createNodeParser(
5555
bracketedUrlRegExp,
5656
httpRegExp,
5757
],
58-
}
58+
},
5959
);

src/block/node/GoogleMapNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const parseCoordinate: (format: string) => Coordinate = (format) => {
2525

2626
const createGoogleMapNode: NodeCreator<GoogleMapNode | PlainNode> = (
2727
raw,
28-
opts
28+
opts,
2929
) => {
3030
if (opts.context === "table") {
3131
return createPlainNode(raw, opts);
@@ -45,7 +45,7 @@ const createGoogleMapNode: NodeCreator<GoogleMapNode | PlainNode> = (
4545
const url =
4646
place !== ""
4747
? `https://www.google.com/maps/place/${encodeURIComponent(
48-
place
48+
place,
4949
)}/@${latitude},${longitude},${zoom}z`
5050
: `https://www.google.com/maps/@${latitude},${longitude},${zoom}z`;
5151

src/block/node/HelpfeelNode.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import type { NodeCreator } from "./creator";
66

77
const helpfeelRegExp = /^\? .+$/;
88

9-
const createHelpfeelNode: NodeCreator<HelpfeelNode | PlainNode> = (raw, opts) =>
9+
const createHelpfeelNode: NodeCreator<HelpfeelNode | PlainNode> = (
10+
raw,
11+
opts,
12+
) =>
1013
opts.context === "table"
1114
? createPlainNode(raw, opts)
1215
: [

src/block/node/IconNode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import type { NodeCreator } from "./creator";
77
const iconRegExp = /\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/;
88

99
export function generateIconNodeCreator(
10-
type: IconNode["type"]
10+
type: IconNode["type"],
1111
): NodeCreator<IconNode>;
1212
export function generateIconNodeCreator(
13-
type: StrongIconNode["type"]
13+
type: StrongIconNode["type"],
1414
): NodeCreator<StrongIconNode | PlainNode>;
1515
export function generateIconNodeCreator(
16-
type: (IconNode | StrongIconNode)["type"]
16+
type: (IconNode | StrongIconNode)["type"],
1717
): NodeCreator<IconNode | StrongIconNode | PlainNode> {
1818
return (raw, opts) => {
1919
if (type === "strongIcon" && opts.context === "table") {

src/block/node/NumberListNode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const numberListRegExp = /^[0-9]+\. .*$/;
99

1010
const createNumberListNode: NodeCreator<NumberListNode | PlainNode> = (
1111
raw,
12-
opts
12+
opts,
1313
) => {
1414
if (opts.context === "table") {
1515
return createPlainNode(raw, opts);

src/block/node/StrongImageNode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const strongGyazoImageRegExp =
1010

1111
const createStrongImageNode: NodeCreator<StrongImageNode | PlainNode> = (
1212
raw,
13-
opts
13+
opts,
1414
) => {
1515
if (opts.context === "table") {
1616
return createPlainNode(raw, opts);

src/block/node/creator.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import type { Node } from "./type";
55

66
export type NodeCreator<T extends Node> = (
77
target: string,
8-
opts: NodeParserOption
8+
opts: NodeParserOption,
99
) => T[];
1010

1111
type NodeParserCreator<T extends Node> = (
1212
nodeCreator: NodeCreator<T>,
13-
opts: { parseOnNested: boolean; parseOnQuoted: boolean; patterns: RegExp[] }
13+
opts: { parseOnNested: boolean; parseOnQuoted: boolean; patterns: RegExp[] },
1414
) => NodeParser;
1515

1616
export const createNodeParser: NodeParserCreator<Node> = (
1717
nodeCreator,
18-
{ parseOnNested, parseOnQuoted, patterns }
18+
{ parseOnNested, parseOnQuoted, patterns },
1919
) => {
2020
return (text, opts, next) => {
2121
if (!parseOnNested && opts.nested) return next?.() ?? [];

src/block/node/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type NextNodeParser = () => Node[];
2828
export type NodeParser = (
2929
text: string,
3030
opts: NodeParserOption,
31-
next?: NextNodeParser
31+
next?: NextNodeParser,
3232
) => Node[];
3333

3434
const FalsyEliminator: NodeParser = (text, _, next) => {
@@ -43,7 +43,7 @@ const combineNodeParsers =
4343
(acc: NextNodeParser, parser: NodeParser): NextNodeParser =>
4444
() =>
4545
parser(text, opts, acc),
46-
() => PlainNodeParser(text, opts)
46+
() => PlainNodeParser(text, opts),
4747
)();
4848

4949
export const convertToNodes: ReturnType<typeof combineNodeParsers> =
@@ -65,5 +65,5 @@ export const convertToNodes: ReturnType<typeof combineNodeParsers> =
6565
GoogleMapNodeParser,
6666
InternalLinkNodeParser,
6767
HashTagNodeParser,
68-
NumberListNodeParser
68+
NumberListNodeParser,
6969
);

tests/jest-setup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ expect.extend({
2323
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2424
this: any,
2525
received: string,
26-
opts?: ParserOption
26+
opts?: ParserOption,
2727
) {
2828
const blocks = parse(received, opts);
2929
return toMatchSnapshot.call(this, blocks);

tests/line/image.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("image", () => {
88

99
it("HTTP jpeg image with special and japanese chars", () => {
1010
expect(
11-
"[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]"
11+
"[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]",
1212
).toMatchSnapshotWhenParsing({ hasTitle: false });
1313
});
1414

@@ -17,13 +17,13 @@ describe("image", () => {
1717
[https://example.com/ https://example.com/image.GIF]`).toMatchSnapshotWhenParsing(
1818
{
1919
hasTitle: false,
20-
}
20+
},
2121
);
2222
});
2323

2424
it("Image with double image link", () => {
2525
expect(
26-
"[https://example.com/forward.png https://example.com/backward.png]"
26+
"[https://example.com/forward.png https://example.com/backward.png]",
2727
).toMatchSnapshotWhenParsing({ hasTitle: false });
2828
});
2929

@@ -33,29 +33,29 @@ describe("image", () => {
3333
[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/raw]`).toMatchSnapshotWhenParsing(
3434
{
3535
hasTitle: false,
36-
}
36+
},
3737
);
3838
});
3939

4040
it("Gyazo image with link", () => {
4141
expect(`[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815 https://example.com]
4242
[https://example.com https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]
4343
[https://gyazo.com/7057219f5b20ca8afd122945b72453d3 https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]`).toMatchSnapshotWhenParsing(
44-
{ hasTitle: false }
44+
{ hasTitle: false },
4545
);
4646
});
4747

4848
it("Image with GET parameters", () => {
4949
expect(
50-
"[http://example.com/image.png?key1=value1&key2=value2]"
50+
"[http://example.com/image.png?key1=value1&key2=value2]",
5151
).toMatchSnapshotWhenParsing({
5252
hasTitle: false,
5353
});
5454
});
5555

5656
it("Direct Gyazo image", () => {
5757
expect(
58-
"[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]"
58+
"[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]",
5959
).toMatchSnapshotWhenParsing({ hasTitle: false });
6060
});
6161
});

tests/line/link.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ describe("link", () => {
4040

4141
it("Link with link", () => {
4242
expect(
43-
"[https://example.com https://example.com]"
43+
"[https://example.com https://example.com]",
4444
).toMatchSnapshotWhenParsing({
4545
hasTitle: false,
4646
});
4747
});
4848

4949
it("Link with GET parameters", () => {
5050
expect(
51-
"[http://example.com?key1=value1&key2=value2]"
51+
"[http://example.com?key1=value1&key2=value2]",
5252
).toMatchSnapshotWhenParsing({
5353
hasTitle: false,
5454
});

tests/line/strongImage.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ describe("strongImage", () => {
1010

1111
it("HTTP jpeg strong image with special and japanese chars", () => {
1212
expect(
13-
"[[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]]"
13+
"[[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]]",
1414
).toMatchSnapshotWhenParsing({ hasTitle: false });
1515
});
1616

1717
it("Gyazo image", () => {
1818
expect(
19-
"[[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]]"
19+
"[[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]]",
2020
).toMatchSnapshotWhenParsing({
2121
hasTitle: false,
2222
});
2323
});
2424

2525
it("Direct Gyazo image", () => {
2626
expect(
27-
"[[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]]"
27+
"[[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]]",
2828
).toMatchSnapshotWhenParsing({ hasTitle: false });
2929
});
3030
});

0 commit comments

Comments
 (0)