Skip to content

Commit 421780f

Browse files
committed
chore: fix lint
1 parent ff80250 commit 421780f

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ api.topics
3434
.then((res) => {
3535
console.log('请求成功', res.data.data)
3636
})
37-
.catch((err) => {
38-
console.log('请求错误', err)
37+
.catch((error) => {
38+
console.log('请求错误', error)
3939
})
4040
```
4141

eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ export default sxzz([
44
{
55
ignores: ['playground/**', 'docs/**', 'tests/deno/**'],
66
},
7+
{
8+
files: ['**.md/**'],
9+
rules: {
10+
'unicorn/prefer-top-level-await': 'off',
11+
},
12+
},
713
])

src/request.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ export const toResponse = async <T>(
221221
let res: Response
222222
try {
223223
res = await response
224-
} catch (err: unknown) {
225-
if (err instanceof HTTPError) {
226-
res = err.response
227-
} else throw err
224+
} catch (error: unknown) {
225+
if (error instanceof HTTPError) {
226+
res = error.response
227+
} else throw error
228228
}
229229
const contentType = res.headers.get('content-type')
230230
let data: any

tests/jike-client/auth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('login should work', () => {
2222

2323
const err: RequestFailureError = await client
2424
.loginWithSmsCode(86, mobile, '123123')
25-
.catch((err) => err)
25+
.catch((error) => error)
2626
expect(err).instanceOf(RequestFailureError)
2727
expect(err.message).oneOf(['验证码已失效', '错误登录次数过多,请稍后再试'])
2828
})

tests/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('request', () => {
4949
},
5050
})
5151
controller.abort()
52-
req = await t.catch((err) => err)
52+
req = await t.catch((error) => error)
5353
})
5454

5555
it('prefix url should be correct', () => {

0 commit comments

Comments
 (0)