Skip to content

Commit 3703ccd

Browse files
committed
chore: lint code
1 parent 4a23e24 commit 3703ccd

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { GLOB_SRC, type TypedFlatConfigItem } from '@antfu/eslint-config'
1+
import type { TypedFlatConfigItem } from '@antfu/eslint-config'
22

33
import perfectionistPlugin from 'eslint-plugin-perfectionist'
44

5+
import { GLOB_SRC } from '@antfu/eslint-config'
6+
57
export const perfectionist = (): TypedFlatConfigItem[] => [{
68
files: [GLOB_SRC],
79
name: 'moeru/perfectionist/rules',

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { GLOB_SRC, type TypedFlatConfigItem } from '@antfu/eslint-config'
1+
import type { TypedFlatConfigItem } from '@antfu/eslint-config'
22

33
import sonarjsPlugin from 'eslint-plugin-sonarjs'
44

5+
import { GLOB_SRC } from '@antfu/eslint-config'
6+
57
export const sonarjs = (): TypedFlatConfigItem[] => [{
68
files: [GLOB_SRC],
79
name: 'moeru/sonarjs/setup',

packages/std/src/base64/base64url.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { decodeBase64, encodeBase64 } from './base64'
22

3+
const BASE64URL_REGEX = /^[-\w]*={0,2}$/
4+
35
const addPaddingToBase64url = (b64url: string): string => {
46
if (b64url.length % 4 === 2)
57
return `${b64url}==`
@@ -19,7 +21,7 @@ const convertBase64ToBase64url = (b64: string): string =>
1921
: b64.replace(/\+/g, '-').replace(/\//g, '_')
2022

2123
const convertBase64urlToBase64 = (b64url: string): string => {
22-
if (!/^[-\w]*={0,2}$/.test(b64url))
24+
if (!BASE64URL_REGEX.test(b64url))
2325
throw new TypeError('Failed to decode base64url: invalid character')
2426

2527
return addPaddingToBase64url(b64url).replace(/-/g, '+').replace(/_/g, '/')

packages/std/src/set-interval/clock.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ export const setClockInterval = (func: (...args: any[]) => any, interval: number
1212
const recurFunc = () => {
1313
func()
1414
const realExecuteTime = Date.now()
15-
if (start == null) {
16-
start = realExecuteTime
17-
}
15+
start ??= realExecuteTime
1816

1917
tick = tick ?? start
2018
// Drift correction: keep long-term cadence close to target interval.

0 commit comments

Comments
 (0)