From e370c95fceec3b76c201860d7cb32b211571a118 Mon Sep 17 00:00:00 2001 From: ShyneADL Date: Thu, 21 Nov 2024 14:07:45 +0100 Subject: [PATCH 1/3] fix: eslint-plugin-query not working with vanilla js --- .../src/utils/detect-react-query-imports.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts index 70f4f7378b..e6c4c68bdd 100644 --- a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts +++ b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts @@ -55,7 +55,8 @@ export function detectTanstackQueryImports(create: EnhancedCreate): Create { ImportDeclaration(node) { if ( node.specifiers.length > 0 && - node.importKind === 'value' && + // Change condition to check for undefined or 'value' + (node.importKind === 'value' || node.importKind === undefined) && node.source.value.startsWith('@tanstack/') && node.source.value.endsWith('-query') ) { From 4341ca729a78258e316ede2ad62aaec51a26f151 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Fri, 22 Nov 2024 19:17:29 +0100 Subject: [PATCH 2/3] Update packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts --- .../eslint-plugin-query/src/utils/detect-react-query-imports.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts index e6c4c68bdd..0b16e06915 100644 --- a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts +++ b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts @@ -55,7 +55,6 @@ export function detectTanstackQueryImports(create: EnhancedCreate): Create { ImportDeclaration(node) { if ( node.specifiers.length > 0 && - // Change condition to check for undefined or 'value' (node.importKind === 'value' || node.importKind === undefined) && node.source.value.startsWith('@tanstack/') && node.source.value.endsWith('-query') From f59de1b3ffa1d53f4ae1f516495d229e239ca6f9 Mon Sep 17 00:00:00 2001 From: Ifeanyi Aladi <62919243+ShyneADL@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:12:35 +0100 Subject: [PATCH 3/3] Disabled linter for conditional statement This should make it pass the eslint-plugin test --- .../eslint-plugin-query/src/utils/detect-react-query-imports.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts index 0b16e06915..6191084ee7 100644 --- a/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts +++ b/packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts @@ -55,6 +55,7 @@ export function detectTanstackQueryImports(create: EnhancedCreate): Create { ImportDeclaration(node) { if ( node.specifiers.length > 0 && + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition (node.importKind === 'value' || node.importKind === undefined) && node.source.value.startsWith('@tanstack/') && node.source.value.endsWith('-query')