Skip to content

Commit

Permalink
style: fix lint error and format code (#11)
Browse files Browse the repository at this point in the history
* fix: fix lint

* style: format code
  • Loading branch information
cszhjh authored Oct 29, 2024
1 parent 694c28b commit 75d40c8
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/items/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './general'
export * from './string'
export * from './number'
export * from './number'
4 changes: 2 additions & 2 deletions docs/general/get-global-this.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Retrieve the global object based on the current environment
```ts
import { getGlobalThis } from 'rattail'

getGlobalThis()
// returns `window` in browser, `global` in Node.js,
getGlobalThis()
// returns `window` in browser, `global` in Node.js,
// or `self` in web worker
```

Expand Down
4 changes: 2 additions & 2 deletions docs/string/camelize.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ camelize('FooBar') // return 'fooBar'

### Arguments

| Arg | Type | Defaults |
| --- | :----: | -------: |
| Arg | Type | Defaults |
| ------- | :------: | -------: |
| `value` | `string` | |

### Return
Expand Down
4 changes: 2 additions & 2 deletions docs/string/kebab-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ kebabCase('fooBar') // return 'foo-bar'

### Arguments

| Arg | Type | Defaults |
| --- | :----: | -------: |
| Arg | Type | Defaults |
| ------- | :------: | -------: |
| `value` | `string` | |

### Return
Expand Down
8 changes: 4 additions & 4 deletions docs/zh/general/is-symbol.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ isSymbol('rattail') // return false

### 参数列表

| 参数 | 类型 | 默认值 |
| ------- | :------: | -----: |
| `value` | `any` | |
| 参数 | 类型 | 默认值 |
| ------- | :---: | -----: |
| `value` | `any` | |

### 返回值

| 类型 |
| :-------: |
| `boolean` |
| `boolean` |
16 changes: 12 additions & 4 deletions tests/function.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ describe('Utility Functions', () => {
debouncedFn()
debouncedFn()

await new Promise((resolve) => setTimeout(resolve, 150))
await new Promise((resolve) => {
setTimeout(resolve, 150)
})

expect(fn).toHaveBeenCalledTimes(1)
})
Expand All @@ -23,7 +25,9 @@ describe('Utility Functions', () => {
debouncedFn()
debouncedFn()

await new Promise((resolve) => setTimeout(resolve, 150))
await new Promise((resolve) => {
setTimeout(resolve, 150)
})

expect(fn).toHaveBeenCalledTimes(1)
})
Expand All @@ -36,9 +40,13 @@ describe('Utility Functions', () => {

throttledFn()
throttledFn()
await new Promise((resolve) => setTimeout(resolve, 50))
await new Promise((resolve) => {
setTimeout(resolve, 50)
})
throttledFn()
await new Promise((resolve) => setTimeout(resolve, 100))
await new Promise((resolve) => {
setTimeout(resolve, 100)
})
throttledFn()

expect(fn).toHaveBeenCalledTimes(2)
Expand Down
2 changes: 1 addition & 1 deletion tests/general.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it, expect, beforeEach } from 'vitest'
import { it, expect } from 'vitest'
import {
isNonEmptyArray,
isString,
Expand Down
1 change: 0 additions & 1 deletion tests/json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ describe('JSON utility functions', () => {
expect(prettyString).toBe('{\n "key": "value",\n "number": 42\n}')
})
})

2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
environment: 'jsdom',
coverage: {
provider: 'istanbul',
include: ['src/*.ts']
include: ['src/*.ts'],
},
},
})

0 comments on commit 75d40c8

Please sign in to comment.