Skip to content

Commit 75c635c

Browse files
committed
chore: lint code
1 parent 1c1b02a commit 75c635c

16 files changed

Lines changed: 46 additions & 46 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const calculateSidebarWithDefaultOpen = (targets?: Array<string | {
88
separate: boolean
99
// eslint-disable-next-line sonarjs/function-return-type
1010
}>, base?: string) => {
11-
let result = calculateSidebar(targets, base)
11+
const result = calculateSidebar(targets, base)
1212
if (Array.isArray(result)) {
1313
result.forEach((item) => {
1414
item.collapsed = false

packages/eslint-config/src/bin/moeru-lint.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ else if (values.help) {
5151
console.info('Usage: moeru-lint [--fix] [--flag <flag>]')
5252
}
5353
else {
54-
let fix = values.fix ? '--fix' : ''
55-
let fixDangerously = values['fix-dangerously'] ? '--fix-dangerously' : ''
56-
let fixSuggestions = values['fix-suggestions'] ? '--fix-suggestions' : ''
57-
let cache = values['no-cache'] ? '' : '--cache'
58-
let flag = values.flag?.map(flag => `--flag ${flag}`).join(' ') ?? ''
54+
const fix = values.fix ? '--fix' : ''
55+
const fixDangerously = values['fix-dangerously'] ? '--fix-dangerously' : ''
56+
const fixSuggestions = values['fix-suggestions'] ? '--fix-suggestions' : ''
57+
const cache = values['no-cache'] ? '' : '--cache'
58+
const flag = values.flag?.map(flag => `--flag ${flag}`).join(' ') ?? ''
5959

6060
console.info('moeru-lint: executing oxlint...\n')
61-
let oxlint = spawn('oxlint', [fix, fixDangerously, fixSuggestions], { stdio: 'inherit' })
61+
const oxlint = spawn('oxlint', [fix, fixDangerously, fixSuggestions], { stdio: 'inherit' })
6262

6363
oxlint.on('close', () => {
6464
console.info('\nmoeru-lint: executing eslint...\n')

packages/eslint-config/src/configs/oxlint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { MoeruOptions } from '..'
77
export const oxlint = async (options: MoeruOptions['oxlint']): Promise<TypedFlatConfigItem[]> => {
88
await ensurePackages(['eslint-plugin-oxlint'])
99

10-
let oxlintPlugin = await interopDefault(import('eslint-plugin-oxlint'))
10+
const oxlintPlugin = await interopDefault(import('eslint-plugin-oxlint'))
1111

1212
return typeof options === 'object' && options.oxlintrcPath
1313
? oxlintPlugin.buildFromOxlintConfigFile(options.oxlintrcPath) as TypedFlatConfigItem[]

packages/results/src/option/and.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ import { from } from './from'
99
describe('@moeru/results', () => {
1010
// https://doc.rust-lang.org/std/option/enum.Option.html#examples-23
1111
it('option.and', () => {
12-
let a = some(2)
13-
let b: Option<string> = none
12+
const a = some(2)
13+
const b: Option<string> = none
1414
expect(and(a, b)).toStrictEqual(none)
1515

16-
let c: Option<number> = none
17-
let d = some('foo')
16+
const c: Option<number> = none
17+
const d = some('foo')
1818
expect(and(c, d)).toStrictEqual(none)
1919

20-
let e = some(2)
21-
let f = some('foo')
20+
const e = some(2)
21+
const f = some('foo')
2222
expect(and(e, f)).toStrictEqual(some('foo'))
2323

24-
let g: Option<number> = none
25-
let h: Option<string> = none
24+
const g: Option<number> = none
25+
const h: Option<string> = none
2626
expect(and(g, h)).toStrictEqual(none)
2727
})
2828

2929
// https://doc.rust-lang.org/std/option/enum.Option.html#examples-24
3030
it('option.andThen', () => {
31-
let arr2D = [['A0', 'A1'], ['B0', 'B1']]
32-
let getArr2D = (index: number) => arr2D.at(index)
31+
const arr2D = [['A0', 'A1'], ['B0', 'B1']]
32+
const getArr2D = (index: number) => arr2D.at(index)
3333
? some(arr2D[index])
3434
: none
3535

36-
let item01 = andThen(getArr2D(0), row => from(row.at(1)))
36+
const item01 = andThen(getArr2D(0), row => from(row.at(1)))
3737
expect(item01).toStrictEqual(some('A1'))
3838

39-
let item20 = andThen(getArr2D(2), row => from(row.at(0)))
39+
const item20 = andThen(getArr2D(2), row => from(row.at(0)))
4040
expect(item20).toStrictEqual(none)
4141
})
4242
})

packages/results/src/option/filter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { filter } from './filter'
66
describe('@moeru/results', () => {
77
// https://doc.rust-lang.org/std/option/enum.Option.html#examples-25
88
it('option.filter', () => {
9-
let isEven = (n: number) => n % 2 === 0
9+
const isEven = (n: number) => n % 2 === 0
1010

1111
expect(filter(none, isEven)).toStrictEqual(none)
1212
expect(filter(some(3), isEven)).toStrictEqual(none)

packages/results/src/option/or.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('@moeru/results', () => {
1414

1515
// https://doc.rust-lang.org/std/option/enum.Option.html#examples-27
1616
it('option.okOrElse', () => {
17-
let nobody = () => none
18-
let vikings = () => some('vikings')
17+
const nobody = () => none
18+
const vikings = () => some('vikings')
1919

2020
expect(orElse(some('barbarians'), vikings)).toStrictEqual(some('barbarians'))
2121
expect(orElse(none, vikings)).toStrictEqual(some('vikings'))

packages/results/src/result/map.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('@moeru/results', () => {
2323

2424
// https://doc.rust-lang.org/std/result/enum.Result.html#examples-11
2525
it('result.mapErr', () => {
26-
let stringify = (str: number | string) => `error code: ${str}`
26+
const stringify = (str: number | string) => `error code: ${str}`
2727

2828
expect(mapErr<number, string, string>(ok(2), stringify)).toStrictEqual(ok(2))
2929
expect(mapErr<number, number, string>(err(13), stringify)).toStrictEqual(err('error code: 13'))

packages/results/src/result/or.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ describe('@moeru/results', () => {
1616

1717
// https://doc.rust-lang.org/std/result/enum.Result.html#examples-28
1818
it('orElse', () => {
19-
let sq = (x: number): Result<number, number> => ok(x * x)
20-
let er = (x: number): Result<number, number> => err(x)
19+
const sq = (x: number): Result<number, number> => ok(x * x)
20+
const er = (x: number): Result<number, number> => err(x)
2121

2222
expect(orElse(orElse<number, number>(ok(2), sq), sq)).toStrictEqual(ok(2))
2323
expect(orElse(orElse<number, number>(ok(2), er), sq)).toStrictEqual(ok(2))

packages/results/src/result/unwrap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('@moeru/results', () => {
2424

2525
// https://doc.rust-lang.org/std/result/enum.Result.html#examples-30
2626
it('result.unwrapOrElse', () => {
27-
let count = (x: string) => x.length
27+
const count = (x: string) => x.length
2828

2929
expect(unwrapOrElse<number, string>(ok(2), count)).toBe(2)
3030
expect(unwrapOrElse(err('foo'), count)).toBe(3)

packages/std/scripts/update-exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const entries = await readdir('./src', { withFileTypes: true })
44

55
const exports: string[] = []
66

7-
for (let entry of entries) {
7+
for (const entry of entries) {
88
if (entry.isDirectory())
99
exports.push(entry.name)
1010
}

0 commit comments

Comments
 (0)