Skip to content

Commit

Permalink
fix: allow eslint to accept FunctionComponent as valid inside lexical…
Browse files Browse the repository at this point in the history
… scopes (#4900)

fix #4794
  • Loading branch information
nynevi committed Aug 23, 2023
1 parent d76b20e commit b593a3c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"build": "tsm scripts/index.ts --tsc --build --qwikcity --qwiklabs --api --platform-binding-wasm-copy",
"build.cli": "tsm scripts/index.ts --cli --dev",
"build.cli.prod": "tsm scripts/index.ts --cli",
"build.eslint": "tsm scripts/index.ts --eslint",
"build.full": "tsm scripts/index.ts --tsc --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
"build.only_javascript": "tsm scripts/index.ts --tsc --build --api",
"build.platform": "tsm scripts/index.ts --platform-binding",
Expand Down
25 changes: 23 additions & 2 deletions packages/eslint-plugin-qwik/qwik.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ export const RemoteApp = component$(({ name }: { name: string }) => {
console.log(a);
}}></div>;
});`,

`
export interface PropFnInterface<ARGS extends any[], RET> {
(...args: ARGS): Promise<RET>
Expand All @@ -386,7 +385,6 @@ export const RemoteApp = component$(({ name }: { name: string }) => {
}}></div>;
});
`,
``,
`
import { component$ } from "@builder.io/qwik";
Expand Down Expand Up @@ -427,6 +425,29 @@ export default component$(() => {
useMethod(foo);
return <div></div>
});`,
`
import {Component, component$, useStore} from '@builder.io/qwik';
export const PopupManager = component$(() => {
const popup = useStore({
component: null as null | Component<any>,
props: null as any,
visible: false,
x: 0,
y: 0,
});
return (
<div
document:onMouseEnter$={(e) => {
popup.visible = true;
}}
document:onMouseLeave$={(e) => {
popup.visible = true;
}}
>
</div>
);
});
`,
],
invalid: [
{
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin-qwik/src/validLexicalScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ function _isTypeCapturable(
if (
symbolName === 'PropFnInterface' ||
symbolName === 'RefFnInterface' ||
symbolName === 'bivarianceHack'
symbolName === 'bivarianceHack' ||
symbolName === 'FunctionComponent'
) {
return;
}
Expand Down

0 comments on commit b593a3c

Please sign in to comment.