From 4d7cd20f95b6fa1e443b4250fa7dfd4ce53d1700 Mon Sep 17 00:00:00 2001 From: minseong Date: Wed, 16 Apr 2025 04:00:27 +0900 Subject: [PATCH 1/7] chore: add typescript-eslint/require-await rule --- eslint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.js b/eslint.config.js index d8a5458377..a225e469c2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -48,6 +48,7 @@ export default [ rules: { ...vitest.configs.recommended.rules, 'vitest/expect-expect': 'warn', + '@typescript-eslint/require-await': 'error', }, settings: { vitest: { typecheck: true } }, }, From 9dd5deca7f4ffbf414f89be3a7b068e18188f965 Mon Sep 17 00:00:00 2001 From: minseong Date: Thu, 17 Apr 2025 21:42:10 +0900 Subject: [PATCH 2/7] reflect feedback --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index a225e469c2..60358f6db2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -40,6 +40,7 @@ export default [ '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-unsafe-function-type': 'off', 'no-case-declarations': 'off', + '@typescript-eslint/require-await': 'error', }, }, { @@ -48,7 +49,6 @@ export default [ rules: { ...vitest.configs.recommended.rules, 'vitest/expect-expect': 'warn', - '@typescript-eslint/require-await': 'error', }, settings: { vitest: { typecheck: true } }, }, From 9efe120bfc2175928d9a4b283545b8316217d397 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Sat, 19 Apr 2025 20:26:02 +0200 Subject: [PATCH 3/7] Update eslint.config.js --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 60358f6db2..be3de84c58 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -39,8 +39,8 @@ export default [ ], '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-unsafe-function-type': 'off', - 'no-case-declarations': 'off', '@typescript-eslint/require-await': 'error', + 'no-case-declarations': 'off', }, }, { From 9c5136620795fb0a34f7011d55d767aea3b430b7 Mon Sep 17 00:00:00 2001 From: minseong Date: Mon, 5 May 2025 03:53:36 +0900 Subject: [PATCH 4/7] test(angular-query-experimental): remove unnecessary async --- .../src/__tests__/inject-infinite-query.test-d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts b/packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts index 4d4e28e6a8..6be809d9b6 100644 --- a/packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts +++ b/packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts @@ -23,7 +23,7 @@ describe('injectInfiniteQuery', () => { vi.useRealTimers() }) - test('should narrow type after isSuccess', async () => { + test('should narrow type after isSuccess', () => { const query = TestBed.runInInjectionContext(() => { return injectInfiniteQuery(() => ({ queryKey: ['infiniteQuery'], From bf4a8230a58fadff70d9132e17fde82958924b00 Mon Sep 17 00:00:00 2001 From: minseong Date: Mon, 5 May 2025 04:02:56 +0900 Subject: [PATCH 5/7] test(*): remove unnecessary async --- .../src/__tests__/index.test.ts | 4 ++-- packages/query-core/src/__tests__/queryObserver.test.tsx | 2 +- packages/react-query/src/__tests__/useQuery.test-d.tsx | 2 +- packages/react-query/src/__tests__/useQuery.test.tsx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/query-broadcast-client-experimental/src/__tests__/index.test.ts b/packages/query-broadcast-client-experimental/src/__tests__/index.test.ts index 763a7edd58..6e09d8a86e 100644 --- a/packages/query-broadcast-client-experimental/src/__tests__/index.test.ts +++ b/packages/query-broadcast-client-experimental/src/__tests__/index.test.ts @@ -12,7 +12,7 @@ describe('broadcastQueryClient', () => { queryCache = queryClient.getQueryCache() }) - it('should subscribe to the query cache', async () => { + it('should subscribe to the query cache', () => { broadcastQueryClient({ queryClient, broadcastChannel: 'test_channel', @@ -20,7 +20,7 @@ describe('broadcastQueryClient', () => { expect(queryCache.hasListeners()).toBe(true) }) - it('should not have any listeners after cleanup', async () => { + it('should not have any listeners after cleanup', () => { const unsubscribe = broadcastQueryClient({ queryClient, broadcastChannel: 'test_channel', diff --git a/packages/query-core/src/__tests__/queryObserver.test.tsx b/packages/query-core/src/__tests__/queryObserver.test.tsx index a977a4f735..cc2da79993 100644 --- a/packages/query-core/src/__tests__/queryObserver.test.tsx +++ b/packages/query-core/src/__tests__/queryObserver.test.tsx @@ -31,7 +31,7 @@ describe('queryObserver', () => { vi.useRealTimers() }) - test('should trigger a fetch when subscribed', async () => { + test('should trigger a fetch when subscribed', () => { const key = queryKey() const queryFn = vi .fn<(...args: Array) => string>() diff --git a/packages/react-query/src/__tests__/useQuery.test-d.tsx b/packages/react-query/src/__tests__/useQuery.test-d.tsx index c7feaf3c86..09396be1a9 100644 --- a/packages/react-query/src/__tests__/useQuery.test-d.tsx +++ b/packages/react-query/src/__tests__/useQuery.test-d.tsx @@ -152,7 +152,7 @@ describe('useQuery', () => { ) expectTypeOf(testFuncStyle.data).toEqualTypeOf() - it('should return the correct states for a successful query', async () => { + it('should return the correct states for a successful query', () => { const state = useQuery({ queryKey: key, queryFn: () => Promise.resolve('test'), diff --git a/packages/react-query/src/__tests__/useQuery.test.tsx b/packages/react-query/src/__tests__/useQuery.test.tsx index e401ee8612..af86f50c3d 100644 --- a/packages/react-query/src/__tests__/useQuery.test.tsx +++ b/packages/react-query/src/__tests__/useQuery.test.tsx @@ -596,7 +596,7 @@ describe('useQuery', () => { expect(states[1]).toMatchObject({ data: 'test' }) }) - it('should not fetch when refetchOnMount is false and data has been fetched already', async () => { + it('should not fetch when refetchOnMount is false and data has been fetched already', () => { const key = queryKey() const states: Array> = [] @@ -1084,7 +1084,7 @@ describe('useQuery', () => { }) }) - it('should not refetch disabled query when invalidated with invalidateQueries', async () => { + it('should not refetch disabled query when invalidated with invalidateQueries', () => { const key = queryKey() const states: Array> = [] let count = 0 From 7ea6ca9727a484620f4e43a789433d97ee3adf2f Mon Sep 17 00:00:00 2001 From: minseong Date: Wed, 7 May 2025 05:12:13 +0900 Subject: [PATCH 6/7] remove(query-codemods): remove unnecessary import --- packages/query-codemods/eslint.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/query-codemods/eslint.config.js b/packages/query-codemods/eslint.config.js index 19a16c3c1e..c3c009f41e 100644 --- a/packages/query-codemods/eslint.config.js +++ b/packages/query-codemods/eslint.config.js @@ -1,6 +1,5 @@ // @ts-check -import vitest from '@vitest/eslint-plugin' import rootConfig from './root.eslint.config.js' export default [ From f966b60eb6f130663f46a4a7b9270d130add84a1 Mon Sep 17 00:00:00 2001 From: minseong Date: Thu, 8 May 2025 13:12:22 +0900 Subject: [PATCH 7/7] chore(query-codemods): remove typescript-eslint/require-await off rule --- packages/query-codemods/eslint.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/query-codemods/eslint.config.js b/packages/query-codemods/eslint.config.js index aa13b1cd93..c3c009f41e 100644 --- a/packages/query-codemods/eslint.config.js +++ b/packages/query-codemods/eslint.config.js @@ -8,7 +8,6 @@ export default [ rules: { 'cspell/spellchecker': 'off', '@typescript-eslint/no-unnecessary-condition': 'off', - '@typescript-eslint/require-await': 'off', 'import/no-duplicates': 'off', 'import/no-unresolved': 'off', 'import/order': 'off',