Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint): allow eslint to accept FunctionComponent inside lexical scopes #4900

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading