Skip to content

Commit 1a72a0a

Browse files
committed
chore: merge to fix logger
1 parent c6b5663 commit 1a72a0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+197
-234
lines changed

.commitlintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-conventional'],
2+
extends: ['@commitlint/config-conventional']
33
}

.eslintrc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ module.exports = {
22
env: {
33
browser: true,
44
commonjs: true,
5-
es2021: true,
5+
es2021: true
66
},
77
extends: '@antfu',
88
overrides: [
99
{
1010
env: {
11-
node: true,
11+
node: true
1212
},
1313
files: ['.eslintrc.{js,cjs}'],
1414
parserOptions: {
15-
sourceType: 'script',
16-
},
17-
},
15+
sourceType: 'script'
16+
}
17+
}
1818
],
1919
parserOptions: {
20-
ecmaVersion: 'latest',
20+
ecmaVersion: 'latest'
2121
},
22-
rules: {},
22+
rules: {}
2323
}

bin/lc.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { easyLanguageView } from '#common/view/language.view.js'
1919
import { DefaultVer } from '#common/constants/question.const.js'
2020
import {
2121
create,
22-
createQuestionById,
22+
createQuestionById
2323
} from '#common/utils/create-check/createUtil.js'
2424
import { logger } from '#common/utils/logger/logger.js'
2525

@@ -37,7 +37,7 @@ program
3737
.option('-l, --language [language]', 'Set/Get the code language of question.')
3838
.option(
3939
'-u, --update',
40-
'Check the version to determine whether to update to the latest one.',
40+
'Check the version to determine whether to update to the latest one.'
4141
)
4242
.parse(process.argv)
4343

@@ -57,8 +57,7 @@ const cmdOpts = program.opts()
5757
if (cmdOpts.language) {
5858
if (cmdOpts.language !== true) {
5959
await easyLanguageView(cmdOpts.language)
60-
}
61-
else {
60+
} else {
6261
const lang = await getQuestionLanguage()
6362
logger.info(`当前CLI语言环境为:${lang}`)
6463
}
@@ -98,7 +97,7 @@ export const callModeAction = {
9897
identity: async (id) => {
9998
await createQuestionById(id, baseDir)
10099
process.exit(0)
101-
},
100+
}
102101
}
103102
// 获取模式和参数
104103
const mode = referMode(cmdArgs, cmdOpts)

bin/lf.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ program
2121
.option('-d, --directory <directory>', 'Set the question directory.')
2222
.option(
2323
'-u, --update',
24-
'Check the version to determine whether to update to the latest one.',
24+
'Check the version to determine whether to update to the latest one.'
2525
)
2626
.parse(process.argv)
2727

@@ -36,8 +36,7 @@ const cmdOpts = program.opts()
3636
if (cmdOpts.language) {
3737
if (cmdOpts.language !== true) {
3838
await easyLanguageView(cmdOpts.language)
39-
}
40-
else {
39+
} else {
4140
const lang = await getQuestionLanguage()
4241
logger.info(`当前CLI语言环境为:${lang}`)
4342
}

common/structures/ListNode.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export class ListNode {
1212
}
1313

1414
static parse(arr) {
15-
if (arr.length === 0)
16-
return null // Return null for an empty array
15+
if (arr.length === 0) return null // Return null for an empty array
1716

1817
const head = new ListNode(arr.shift(), null)
1918
let current = head
@@ -25,8 +24,7 @@ export class ListNode {
2524
}
2625

2726
static toArray(listNodes, arr = []) {
28-
if (listNodes === undefined || listNodes === null)
29-
return arr
27+
if (listNodes === undefined || listNodes === null) return arr
3028

3129
arr.push(listNodes.val)
3230
return ListNode.toArray(listNodes.next, arr)

common/structures/Node.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ export class Node {
3030
}
3131

3232
static toArray(node) {
33-
if (!node)
34-
return []
33+
if (!node) return []
3534

3635
const visited = new Set()
3736
const result = []
3837

3938
const dfs = (currentNode) => {
40-
if (visited.has(currentNode.val))
41-
return
39+
if (visited.has(currentNode.val)) return
4240

4341
const { neighbors, val } = currentNode
4442
visited.add(val)

common/structures/TreeNode.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export class TreeNode {
77
}
88

99
static parse(arr) {
10-
if (arr.length === 0)
11-
return null
10+
if (arr.length === 0) return null
1211
const root = new TreeNode(arr[0])
1312
const queue = [root]
1413
for (let i = 1; i < arr.length; i += 2) {
@@ -27,8 +26,7 @@ export class TreeNode {
2726

2827
static toArray(treeNode) {
2928
const result = []
30-
if (!treeNode)
31-
return result
29+
if (!treeNode) return result
3230

3331
const queue = [treeNode]
3432

@@ -38,8 +36,7 @@ export class TreeNode {
3836
result.push(node.val)
3937
queue.push(node.left)
4038
queue.push(node.right)
41-
}
42-
else {
39+
} else {
4340
result.push(null)
4441
}
4542
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// 推测模式
22
export function referMode(args, opts) {
3-
if (args.length > 0 || opts.identity)
4-
return 'identity'
3+
if (args.length > 0 || opts.identity) return 'identity'
54

6-
if (opts.random)
7-
return 'random'
5+
if (opts.random) return 'random'
86

97
return 'today'
108
}

common/utils/etc/createColorFont.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export function createColorFont(font) {
77
const code = gradient_string([
88
{ color: '#ff0000', pos: 0 },
99
{ color: '#ffc600', pos: 0.5 },
10-
{ color: '#003dff', pos: 1 },
10+
{ color: '#003dff', pos: 1 }
1111
])(font)
1212
writeFileSync(path.resolve(process.cwd(), 'colorFont.js'), code)
1313
console.log(
14-
`[ColorFont]Create color font: ${font}\ncode location:${path.resolve(process.cwd(), 'colorFont.js')}`,
14+
`[ColorFont]Create color font: ${font}\ncode location:${path.resolve(process.cwd(), 'colorFont.js')}`
1515
)
1616
console.log(code)
1717
}

common/utils/etc/typeof_.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* @private
66
*/
77
export function typeof_(data) {
8-
if (data === null)
9-
return 'null'
8+
if (data === null) return 'null'
109
else return typeof data
1110
}

0 commit comments

Comments
 (0)