Skip to content

Commit 66ea5f2

Browse files
chore: add typescript-eslint/require-await rule (#9116)
Co-authored-by: MINSEONG KIM <[email protected]>
1 parent 2a62ea1 commit 66ea5f2

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default [
3939
],
4040
'@typescript-eslint/no-empty-function': 'off',
4141
'@typescript-eslint/no-unsafe-function-type': 'off',
42+
'@typescript-eslint/require-await': 'error',
4243
'no-case-declarations': 'off',
4344
},
4445
},

packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('injectInfiniteQuery', () => {
2323
vi.useRealTimers()
2424
})
2525

26-
test('should narrow type after isSuccess', async () => {
26+
test('should narrow type after isSuccess', () => {
2727
const query = TestBed.runInInjectionContext(() => {
2828
return injectInfiniteQuery(() => ({
2929
queryKey: ['infiniteQuery'],

packages/query-broadcast-client-experimental/src/__tests__/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ describe('broadcastQueryClient', () => {
1212
queryCache = queryClient.getQueryCache()
1313
})
1414

15-
it('should subscribe to the query cache', async () => {
15+
it('should subscribe to the query cache', () => {
1616
broadcastQueryClient({
1717
queryClient,
1818
broadcastChannel: 'test_channel',
1919
})
2020
expect(queryCache.hasListeners()).toBe(true)
2121
})
2222

23-
it('should not have any listeners after cleanup', async () => {
23+
it('should not have any listeners after cleanup', () => {
2424
const unsubscribe = broadcastQueryClient({
2525
queryClient,
2626
broadcastChannel: 'test_channel',

packages/query-codemods/eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// @ts-check
22

3-
import vitest from '@vitest/eslint-plugin'
43
import rootConfig from './root.eslint.config.js'
54

65
export default [
@@ -9,6 +8,7 @@ export default [
98
rules: {
109
'cspell/spellchecker': 'off',
1110
'@typescript-eslint/no-unnecessary-condition': 'off',
11+
'@typescript-eslint/require-await': 'off',
1212
'import/no-duplicates': 'off',
1313
'import/no-unresolved': 'off',
1414
'import/order': 'off',

packages/query-core/src/__tests__/queryObserver.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('queryObserver', () => {
3131
vi.useRealTimers()
3232
})
3333

34-
test('should trigger a fetch when subscribed', async () => {
34+
test('should trigger a fetch when subscribed', () => {
3535
const key = queryKey()
3636
const queryFn = vi
3737
.fn<(...args: Array<unknown>) => string>()

packages/react-query/src/__tests__/useQuery.test-d.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ describe('useQuery', () => {
152152
)
153153
expectTypeOf(testFuncStyle.data).toEqualTypeOf<boolean | undefined>()
154154

155-
it('should return the correct states for a successful query', async () => {
155+
it('should return the correct states for a successful query', () => {
156156
const state = useQuery<string, Error>({
157157
queryKey: key,
158158
queryFn: () => Promise.resolve('test'),

packages/react-query/src/__tests__/useQuery.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ describe('useQuery', () => {
608608
expect(states[1]).toMatchObject({ data: 'test' })
609609
})
610610

611-
it('should not fetch when refetchOnMount is false and data has been fetched already', async () => {
611+
it('should not fetch when refetchOnMount is false and data has been fetched already', () => {
612612
const key = queryKey()
613613
const states: Array<UseQueryResult<string>> = []
614614

@@ -1106,7 +1106,7 @@ describe('useQuery', () => {
11061106
})
11071107
})
11081108

1109-
it('should not refetch disabled query when invalidated with invalidateQueries', async () => {
1109+
it('should not refetch disabled query when invalidated with invalidateQueries', () => {
11101110
const key = queryKey()
11111111
const states: Array<UseQueryResult<number>> = []
11121112
let count = 0

0 commit comments

Comments
 (0)