Skip to content

Commit

Permalink
fix(lint): allow event methods to capture PropFunction (QwikDev#5578)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored Dec 13, 2023
1 parent 63a20cd commit ed09860
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 66 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"esbuild": "^0.19.8",
"eslint": "^8.55.0",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-qwik": "^1.2.19",
"eslint-plugin-qwik": "latest",
"execa": "7.2.0",
"express": "4.18.2",
"install": "^0.13.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"@algolia/autocomplete-core": "1.7.4",
"@algolia/client-search": "4.14.3",
"@builder.io/partytown": "^0.8.1",
"@builder.io/qwik": "github:BuilderIo/qwik-build#f222b8fe29b078b9696a39310db26b9f45bb0c3d",
"@builder.io/qwik-city": "github:BuilderIo/qwik-city-build#1fb359613edcf574c0dc1b8b177079a0bf2912f6",
"@builder.io/qwik-labs": "github:BuilderIo/qwik-labs-build#fc965e281526974651aa944a7a0743a67f07389e",
"@builder.io/qwik": "github:BuilderIo/qwik-build#7b855a75d701b9c373af5b7c4a309badf93fcd4f",
"@builder.io/qwik-city": "github:BuilderIo/qwik-city-build#79afe153b776865fbc964476236c258f11185362",
"@builder.io/qwik-labs": "github:BuilderIo/qwik-labs-build#c5d333431026c6bf383327211329559b8ff52f71",
"@builder.io/qwik-react": "0.5.0",
"@builder.io/sdk-qwik": "^0.6.2",
"@docsearch/css": "^3.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@
}
],
"kind": "TypeAlias",
"content": "```typescript\nexport type PropFnInterface<ARGS extends any[], RET> = {\n (...args: ARGS): Promise<RET>;\n};\n```",
"content": "```typescript\nexport type PropFnInterface<ARGS extends any[], RET> = {\n __qwik_serializable__?: any;\n (...args: ARGS): Promise<RET>;\n};\n```",
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/core/qrl/qrl.public.ts",
"mdFile": "qwik.propfninterface.md"
},
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/routes/api/qwik/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,7 @@ export interface ProgressHTMLAttributes<T extends Element> extends Attrs<'progre
```typescript
export type PropFnInterface<ARGS extends any[], RET> = {
__qwik_serializable__?: any;
(...args: ARGS): Promise<RET>;
};
```
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-plugin-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"peerDependencies": {
"eslint": "^8.45.0"
},
"scripts": {
"test": "cd ../..; ./node_modules/.bin/vitest packages/eslint-plugin-qwik/qwik.unit.ts"
},
"repository": {
"type": "git",
"url": "https://github.com/BuilderIO/qwik.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-qwik/src/validLexicalScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function _isTypeCapturable(
return;
}
seen.add(type);
if (type.getProperty('__no_serialize__')) {
if (type.getProperty('__no_serialize__') || type.getProperty('__qwik_serializable__')) {
return;
}
const isUnknown = type.flags & ts.TypeFlags.Unknown;
Expand Down
6 changes: 3 additions & 3 deletions packages/insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"install": "^0.13.0"
},
"devDependencies": {
"@builder.io/qwik": "github:BuilderIo/qwik-build#0080db89d43112fea2ed6b281f70f61d00f42edd",
"@builder.io/qwik-city": "github:BuilderIo/qwik-city-build#fd39ca1abf09e4016ff738679030b2486ea5f7fc",
"@builder.io/qwik": "github:BuilderIo/qwik-build#7b855a75d701b9c373af5b7c4a309badf93fcd4f",
"@builder.io/qwik-city": "github:BuilderIo/qwik-city-build#79afe153b776865fbc964476236c258f11185362",
"@builder.io/qwik-labs": "workspace:*",
"@builder.io/vite-plugin-macro": "~0.0.7",
"@netlify/edge-functions": "^2.2.0",
Expand All @@ -27,7 +27,7 @@
"autoprefixer": "^10.4.14",
"better-sqlite3": "^9.0.0",
"eslint": "^8.51.0",
"eslint-plugin-qwik": "^1.2.13",
"eslint-plugin-qwik": "latest",
"netlify-cli": "^15.9.1",
"postcss": "^8.4.31",
"prettier": "^3.0.3",
Expand Down
3 changes: 3 additions & 0 deletions packages/insights/src/components/icons/copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const CopyIcon = component$<CopyIconProps>(({ onClick$, ...props }) => {
class="wrapper"
preventdefault:click
onClick$={() => {
// Disable this lint issue until new Lint version is released with the fix
// eslint version 1.3.1 and higher should work
// eslint-disable-next-line
onClick$();
copiedSig.value = true;
setTimeout(() => (copiedSig.value = false), 2000);
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"eslint-plugin-qwik": "^1.2.13",
"eslint-plugin-qwik": "latest",
"np": "^8.0.4",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/qwik/src/core/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ export interface ProgressHTMLAttributes<T extends Element> extends Attrs<'progre

// @public (undocumented)
export type PropFnInterface<ARGS extends any[], RET> = {
__qwik_serializable__?: any;
(...args: ARGS): Promise<RET>;
};

Expand All @@ -614,7 +615,7 @@ export type PublicProps<PROPS extends Record<any, any>> = TransformProps<PROPS>
//
// @public
export type QRL<TYPE = unknown> = {
__qwik_serializable__: any;
__qwik_serializable__?: any;
__brand__QRL__: TYPE;
resolve(): Promise<TYPE>;
resolved: undefined | TYPE;
Expand Down
3 changes: 2 additions & 1 deletion packages/qwik/src/core/qrl/qrl.public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : un
// </docs>
export type QRL<TYPE = unknown> = {
// Special type brand to let eslint that the Type is serializable
__qwik_serializable__: any;
__qwik_serializable__?: any;
__brand__QRL__: TYPE;

/** Resolve the QRL and return the actual value. */
Expand All @@ -162,6 +162,7 @@ type BivariantQrlFn<ARGS extends any[], RETURN> = {

/** @public */
export type PropFnInterface<ARGS extends any[], RET> = {
__qwik_serializable__?: any;
(...args: ARGS): Promise<RET>;
};

Expand Down
Loading

0 comments on commit ed09860

Please sign in to comment.