From 3caabe6fc8275c7ba764de59193d5f649e3f872a Mon Sep 17 00:00:00 2001 From: Wim Holvoet Date: Wed, 17 May 2023 07:34:56 +0200 Subject: [PATCH] fix: Allow TSAsExpression for useFunctions (#4229) * allow_TSAsExpression * update tests --- packages/eslint-plugin-qwik/qwik.unit.ts | 5 +++++ packages/eslint-plugin-qwik/src/useMethodUsage.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/eslint-plugin-qwik/qwik.unit.ts b/packages/eslint-plugin-qwik/qwik.unit.ts index f4ad8edf232..32647180187 100644 --- a/packages/eslint-plugin-qwik/qwik.unit.ts +++ b/packages/eslint-plugin-qwik/qwik.unit.ts @@ -104,6 +104,11 @@ export const HelloWorld = component$(async () => { return
}); });`, + `export const HelloWorld = component$(async () => { + const test = useFunction() as string; + + }); + `, ], invalid: [ { diff --git a/packages/eslint-plugin-qwik/src/useMethodUsage.ts b/packages/eslint-plugin-qwik/src/useMethodUsage.ts index d62551ec25f..14ee36c32bc 100644 --- a/packages/eslint-plugin-qwik/src/useMethodUsage.ts +++ b/packages/eslint-plugin-qwik/src/useMethodUsage.ts @@ -63,6 +63,7 @@ export const useMethodUsage: Rule.RuleModule = { case 'Property': case 'ObjectExpression': case 'CallExpression': + case 'TSAsExpression': break; case 'ArrowFunctionExpression': case 'FunctionExpression':