Skip to content

Commit

Permalink
fix lint & test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 1, 2022
1 parent cbf8752 commit af89adb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
moduleNameMapper: {
'^swr$': '<rootDir>/src',
'^swr/infinite$': '<rootDir>/infinite/index.ts',
'^swr/immutable$': '<rootDir>/immutable/index.ts'
'^swr/immutable$': '<rootDir>/immutable/index.ts',
'^swr/subscribe$': '<rootDir>/subscribe/index.ts',
},
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest'
Expand Down
4 changes: 3 additions & 1 deletion subscribe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export const subscribe = (<Data, Error>(useSWRNext: SWRHook) => (
await mutate(() => {
throw err
}, false)
} catch (_) {}
} catch (_) {
/* eslint-disable-line no-empty */
}
}

if (subscriptions.get(key) === 1) {
Expand Down
2 changes: 1 addition & 1 deletion test/use-swr-subscribe.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { render } from '@testing-library/react'
import { sleep } from './utils'
import useSWRSubscription from '../subscribe'
import useSWRSubscription from 'swr/subscribe'

describe('useSWRSubscription', () => {
it('should update state when fetcher is a subscription', async () => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"paths": {
"swr": ["./src/index.ts"],
"swr/infinite": ["./infinite/index.ts"],
"swr/immutable": ["./immutable/index.ts"]
"swr/immutable": ["./immutable/index.ts"],
"swr/subscribe": ["./subscribe/index.ts"]
},
"typeRoots": ["./src/types", "./node_modules/@types"]
},
Expand Down

0 comments on commit af89adb

Please sign in to comment.