Skip to content

Commit bd4aa83

Browse files
committed
格式化
1 parent 7befb01 commit bd4aa83

File tree

8 files changed

+52
-78
lines changed

8 files changed

+52
-78
lines changed

cache.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ import {
77
} from "./deps.ts";
88
import { split_by_count } from "./utils/split_by_count.ts";
99

10-
function searchFilesNames({
11-
skip,
12-
}: {
13-
skip?: RegExp | RegExp[];
14-
}) {
10+
function searchFilesNames({ skip }: { skip?: RegExp | RegExp[] }) {
1511
const entry_iter = walk(".", {
1612
includeFiles: true,
1713
includeDirs: false,
@@ -26,7 +22,7 @@ if (import.meta.main) {
2622

2723
async function parallel_cache(
2824
entry_iter: AsyncIterableIterator<WalkEntry>,
29-
limiter: AsyncCurrentLimiter,
25+
limiter: AsyncCurrentLimiter
3026
) {
3127
const files: string[] = [];
3228

@@ -38,21 +34,24 @@ async function parallel_cache(
3834

3935
await Promise.all(
4036
entries.map((stack) =>
41-
limiter.run(function (stack: string[]) {
42-
return runDenocache(stack);
43-
}.bind(null, stack))
44-
),
37+
limiter.run(
38+
function (stack: string[]) {
39+
return runDenocache(stack);
40+
}.bind(null, stack)
41+
)
42+
)
4543
);
4644
}
4745
async function start() {
4846
const limiter = new AsyncLimiterClass(1);
4947
const args = parse(Deno.args);
5048
console.log(args);
51-
const skip = typeof args.skip === "string"
52-
? new RegExp(String(args.skip))
53-
: Array.isArray(args.skip)
54-
? args.skip.map((s: string | RegExp) => new RegExp(s))
55-
: undefined;
49+
const skip =
50+
typeof args.skip === "string"
51+
? new RegExp(String(args.skip))
52+
: Array.isArray(args.skip)
53+
? args.skip.map((s: string | RegExp) => new RegExp(s))
54+
: undefined;
5655
const entry_iter = searchFilesNames({ skip });
5756
await parallel_cache(entry_iter, limiter);
5857
}
@@ -74,7 +73,7 @@ async function runDenocache(stack: string[]) {
7473
if (!success) {
7574
throw new Error(
7675
"type cache failed:" +
77-
JSON.stringify({ code, success, stdout: out, stderr: err }),
76+
JSON.stringify({ code, success, stdout: out, stderr: err })
7877
);
7978
}
8079
}

check.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ import {
77
} from "./deps.ts";
88
import { split_by_count } from "./utils/split_by_count.ts";
99

10-
function searchFilesNames({
11-
skip,
12-
}: {
13-
skip?: RegExp | RegExp[];
14-
}) {
10+
function searchFilesNames({ skip }: { skip?: RegExp | RegExp[] }) {
1511
const entry_iter = walk(".", {
1612
includeFiles: true,
1713
includeDirs: false,
@@ -26,7 +22,7 @@ if (import.meta.main) {
2622

2723
async function parallel_check(
2824
entry_iter: AsyncIterableIterator<WalkEntry>,
29-
limiter: AsyncCurrentLimiter,
25+
limiter: AsyncCurrentLimiter
3026
) {
3127
const files: string[] = [];
3228

@@ -38,21 +34,24 @@ async function parallel_check(
3834

3935
await Promise.all(
4036
entries.map((stack) =>
41-
limiter.run(function (stack: string[]) {
42-
return runDenoCheck(stack);
43-
}.bind(null, stack))
44-
),
37+
limiter.run(
38+
function (stack: string[]) {
39+
return runDenoCheck(stack);
40+
}.bind(null, stack)
41+
)
42+
)
4543
);
4644
}
4745
async function start() {
4846
const limiter = new AsyncLimiterClass(navigator.hardwareConcurrency);
4947
const args = parse(Deno.args);
5048
console.log(args);
51-
const skip = typeof args.skip === "string"
52-
? new RegExp(String(args.skip))
53-
: Array.isArray(args.skip)
54-
? args.skip.map((s: string | RegExp) => new RegExp(s))
55-
: undefined;
49+
const skip =
50+
typeof args.skip === "string"
51+
? new RegExp(String(args.skip))
52+
: Array.isArray(args.skip)
53+
? args.skip.map((s: string | RegExp) => new RegExp(s))
54+
: undefined;
5655
const entry_iter = searchFilesNames({ skip });
5756
await parallel_check(entry_iter, limiter);
5857
}
@@ -74,7 +73,7 @@ async function runDenoCheck(stack: string[]) {
7473
if (!success) {
7574
throw new Error(
7675
"type cache failed:" +
77-
JSON.stringify({ code, success, stdout: out, stderr: err }),
76+
JSON.stringify({ code, success, stdout: out, stderr: err })
7877
);
7978
}
8079
}

deno.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
},
3131
"fmt": {
3232
"files": {
33-
"exclude": [
34-
"target",
35-
"x64",
36-
"*.cxx.ifc.d.json"
37-
]
33+
"exclude": ["target", "x64", "*.cxx.ifc.d.json"]
3834
},
3935
"options": {
4036
"indentWidth": 4,
@@ -43,9 +39,7 @@
4339
},
4440
"test": {
4541
"files": {
46-
"exclude": [
47-
"target"
48-
]
42+
"exclude": ["target"]
4943
}
5044
}
5145
}

format.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{
22
"style": "WebKit",
3-
"filter": [
4-
"*.cpp",
5-
6-
"*.ixx"
7-
],
8-
"dirs": [
9-
"./"
10-
]
3+
"filter": ["*.cpp", "*.ixx"],
4+
"dirs": ["./"]
115
}

mod.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { InOrderIterator } from "./binary-search-tree-iterator-ii/index.ts";
33
import { inorder } from "./binary-tree-inorder-traversal/inorder.ts";
44
import { TreeNode } from "./binary-tree-inorder-traversal/TreeNode.ts";
55
import { level } from "./binary-tree-level-order-traversal-ii/level.ts";
6-
import {
7-
binaryCountOneBigint,
8-
} from "./cells-with-odd-values-in-a-matrix/binary_count_one_bigint.ts";
6+
import { binaryCountOneBigint } from "./cells-with-odd-values-in-a-matrix/binary_count_one_bigint.ts";
97
import { Node as GraphNode } from "./clone-graph/Node.ts";
108
import { parseComplex } from "./complex-number-multiplication/parse_complex.ts";
119
import { buildBST } from "./convert-sorted-list-to-binary-search-tree/buildBST.ts";
@@ -14,22 +12,16 @@ import { DoublyLinkedList } from "./design-linked-list/DoublyLinkedList.ts";
1412
import { HashMap } from "./design-movie-rental-system/HashMap.ts";
1513
import RedBlackTree from "./dinner-plate-stacks/RedBlackTree.ts";
1614
import { reverseInOrderIterator } from "./dinner-plate-stacks/reverseInOrderIterator.ts";
17-
import {
18-
ArrayToCircularDoublyTreeList,
19-
} from "./er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/ArrayToCircularDoublyTreeList.ts";
15+
import { ArrayToCircularDoublyTreeList } from "./er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/ArrayToCircularDoublyTreeList.ts";
2016
import { NestedIntegerFrom } from "./flatten-nested-list-iterator/NestedIntegerFrom.ts";
2117
import { deduplication } from "./fraction-addition-and-subtraction/deduplication.ts";
2218
import { Fraction } from "./fraction-addition-and-subtraction/Fraction.ts";
2319
import { parseFraction } from "./fraction-addition-and-subtraction/parseFraction.ts";
2420
import { absBigint } from "./fraction-to-recurring-decimal/abs_bigint.ts";
2521
import { rand7 } from "./implement-rand10-using-rand7/rand7.ts";
2622
import { TrieNode } from "./implement-trie-ii-prefix-tree/TrieNode.ts";
27-
import {
28-
TrieNodeCountWordsEqualTo,
29-
} from "./implement-trie-ii-prefix-tree/TrieNodeCountWordsEqualTo.ts";
30-
import {
31-
TrieNodeCountWordsStartingWith,
32-
} from "./implement-trie-ii-prefix-tree/TrieNodeCountWordsStartingWith.ts";
23+
import { TrieNodeCountWordsEqualTo } from "./implement-trie-ii-prefix-tree/TrieNodeCountWordsEqualTo.ts";
24+
import { TrieNodeCountWordsStartingWith } from "./implement-trie-ii-prefix-tree/TrieNodeCountWordsStartingWith.ts";
3325
import { TrieNodeErase } from "./implement-trie-ii-prefix-tree/TrieNodeErase.ts";
3426
import { TrieNodeInsert } from "./implement-trie-ii-prefix-tree/TrieNodeInsert.ts";
3527
import { PrefixTree } from "./implement-trie-prefix-tree/PrefixTree.ts";
@@ -41,13 +33,9 @@ import { PriorityQueue } from "./kth-largest-element-in-a-stream/PriorityQueue.t
4133
import { UnionFind } from "./largest-component-size-by-common-factor/UnionFind.ts";
4234
import { MyLinkedList } from "./lfu-cache/MyLinkedList.ts";
4335
import { PrefixTreeSearchEach } from "./longest-word-in-dictionary/PrefixTreeSearchEach.ts";
44-
import {
45-
PrefixTreeSearchPrefixEach,
46-
} from "./longest-word-in-dictionary/PrefixTreeSearchPrefixEach.ts";
36+
import { PrefixTreeSearchPrefixEach } from "./longest-word-in-dictionary/PrefixTreeSearchPrefixEach.ts";
4737
import { PrefixTreeWithSum } from "./map-sum-pairs/PrefixTreeWithSum.ts";
48-
import {
49-
calculateStraightLineEquation,
50-
} from "./max-points-on-a-line/calculateStraightLineEquation.ts";
38+
import { calculateStraightLineEquation } from "./max-points-on-a-line/calculateStraightLineEquation.ts";
5139
import { gcd } from "./max-points-on-a-line/greatest_common_divisor.ts";
5240
import { uniqueStraightLineEquation } from "./max-points-on-a-line/uniqueStraightLineEquation.ts";
5341
import { bigintMax } from "./maximum-width-of-binary-tree/bigint_max.ts";

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"type": "module",
33
"name": "@masx200/leetcode-test",
44
"version": "10.10.0",
5-
65
"repository": {
76
"type": "git",
87
"url": "https://github.com/masx200/leetcode-test"
@@ -11,7 +10,7 @@
1110
"license": "MIT",
1211
"description": "#### 介绍",
1312
"scripts": {
14-
"format": "prettier --w *.xml"
13+
"format": "prettier --w *.xml *.ts *.json *.md"
1514
},
1615
"keywords": [],
1716
"devDependencies": {

retry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function retry<T>(
1515
retryOnError?:
1616
| ((error: any) => Promise<boolean>)
1717
| ((error: any) => boolean);
18-
},
18+
}
1919
) {
2020
const retryOnError = opts?.retryOnError ?? (() => true);
2121
const options: Required<RetryOptions> = {
@@ -34,7 +34,7 @@ export async function retry<T>(
3434
try {
3535
return await fn();
3636
} catch (err) {
37-
if (!await retryOnError(err)) {
37+
if (!(await retryOnError(err))) {
3838
throw err;
3939
}
4040

xmake.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { retry } from "./retry.ts";
66

77
async function* findFilesRecursive(
88
path: string,
9-
name: string,
9+
name: string
1010
): AsyncGenerator<string, void, unknown> {
1111
for await (const entry of Deno.readDir(path)) {
1212
const fullPath = resolve(join(path, entry.name));
@@ -37,7 +37,7 @@ async function RunXmake(
3737
sdk: string,
3838
executable: string,
3939
group: string,
40-
mode: string,
40+
mode: string
4141
) {
4242
await RunXmakeConfig(file, toolchain, sdk, executable, mode);
4343
await retry(RunXmakeBuild.bind(null, file, executable, group), {
@@ -50,11 +50,11 @@ async function RunXmake(
5050
const cwd = path.dirname(file);
5151
const dirtobecreate = path.join(
5252
cwd,
53-
path.dirname(filepathmatched),
53+
path.dirname(filepathmatched)
5454
);
5555

5656
console.log(
57-
"Ensures that the directory exists:" + dirtobecreate,
57+
"Ensures that the directory exists:" + dirtobecreate
5858
);
5959
await ensureDir(dirtobecreate);
6060
return true;
@@ -69,7 +69,7 @@ async function RunXmakeConfig(
6969
toolchain: string,
7070
sdk: string,
7171
executable: string,
72-
mode: string,
72+
mode: string
7373
) {
7474
console.log({ file });
7575
const cwd = path.dirname(file);
@@ -88,9 +88,10 @@ export async function RunCommandShell(others: string[], cwd?: string) {
8888

8989
const cmd = os === "windows" ? "powershell.exe" : "bash";
9090

91-
const args = os === "windows"
92-
? ["-command", others.join(" \n ")]
93-
: ["-c", others.join(" && ")];
91+
const args =
92+
os === "windows"
93+
? ["-command", others.join(" \n ")]
94+
: ["-c", others.join(" && ")];
9495

9596
console.log(JSON.stringify({ cmd, cwd, args }));
9697
const command = new Deno.Command(cmd, { cwd: cwd, args });

0 commit comments

Comments
 (0)