Skip to content

Commit

Permalink
Merge pull request #2 from robknight/robknight/eslint-configuration
Browse files Browse the repository at this point in the history
Add ESLint configuration
  • Loading branch information
robknight authored Sep 8, 2024
2 parents 2dd36ce + 6a8d022 commit 51068e6
Show file tree
Hide file tree
Showing 41 changed files with 219 additions and 829 deletions.
5 changes: 1 addition & 4 deletions apps/client-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/json-bigint": "^1.0.1",
"@types/uuid": "^10.0.0",
"esbuild": "^0.23.1",
"eslint": "^9.9.0",
"tsx": "^4.19.0",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1"
"typescript": "^5.5.3"
}
}
28 changes: 0 additions & 28 deletions apps/client-web/eslint.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions apps/client-web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import reactInternal from "@parcnet/eslint-config/eslint.reactInternal.config.mjs";

/** @type {import("eslint").Linter.Config[]} */
export default [...reactInternal];
6 changes: 1 addition & 5 deletions apps/client-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"typescript": "^5.5",
"vite": "^5.4.1"
}
}
6 changes: 3 additions & 3 deletions apps/client-web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
autoprefixer: {}
}
};
2 changes: 0 additions & 2 deletions apps/client-web/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export class ParcnetClientProcessor implements ParcnetRPC {
});
this.pod = new ParcnetPODProcessor(this.pods, this.subscriptions);
this.identity = new ParcnetIdentityProcessor();
// @todo: implement gpc
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
this.gpc = new ParcnetGPCProcessor(this.pods, dispatch, this.clientChannel);
}
}
2 changes: 0 additions & 2 deletions apps/client-web/src/client/identity.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ParcnetIdentityRPC } from "@parcnet/client-rpc";

export class ParcnetIdentityProcessor implements ParcnetIdentityRPC {
public constructor() {}

async getSemaphoreV3Commitment(): Promise<bigint> {
return BigInt(0);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/client-web/src/client/query_subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface QuerySubscriptionEvents {
}

export class QuerySubscriptions {
private subscriptions: Map<string, Subscription> = new Map();
private subscriptions = new Map<string, Subscription>();
private emitter = new EventEmitter<QuerySubscriptionEvents>();
private nextSubscriptionId = 0;

Expand Down
13 changes: 5 additions & 8 deletions apps/client-web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
], theme: {
extend: {},
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {}
},
plugins: [],
}

plugins: []
};
4 changes: 4 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import base from "@parcnet/eslint-config/eslint.base.config.mjs";

/** @type {import("eslint").Linter.Config[]} */
export default [...base];
9 changes: 0 additions & 9 deletions examples/test-app/.eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions examples/test-app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import reactInternal from "@parcnet/eslint-config/eslint.reactInternal.config.mjs";

/** @type {import("eslint").Linter.Config[]} */
export default [...reactInternal];
9 changes: 1 addition & 8 deletions examples/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
"dependencies": {
"@parcnet/app-connector": "workspace:*",
"@parcnet/podspec": "workspace:*",
"@pcd/gpc-pcd": "0.0.5",
"@pcd/pcd-types": "0.11.4",
"@pcd/pod": "0.1.5",
"@pcd/pod-pcd": "0.1.5",
"@pcd/semaphore-identity-pcd": "0.11.4",
"dotenv": "^16.0.3",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
Expand All @@ -31,16 +27,13 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"autoprefixer": "^10.0.1",
"daisyui": "^4.12.10",
"esbuild": "^0.23.1",
"esbuild-plugin-tailwindcss": "^1.2.1",
"eslint": "8.57.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.5"
}
}
65 changes: 1 addition & 64 deletions examples/test-app/src/apis/GPC.tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,9 @@
import { PodspecProofRequest } from "@parcnet/podspec";
import { GPCPCDArgs } from "@pcd/gpc-pcd";
import { ArgumentTypeName } from "@pcd/pcd-types";
import { PODPCDPackage } from "@pcd/pod-pcd";
import { SemaphoreIdentityPCDPackage } from "@pcd/semaphore-identity-pcd";
import { ReactNode, useState } from "react";
import { ProveResult } from "../../../../packages/client-rpc/src";
import { TryIt } from "../components/TryIt";
import { useParcnetClient } from "../hooks/useParcnetClient";

const EXAMPLE_GPC_CONFIG = `{
"pods": {
"examplePOD": {
"entries": {
"origin": {
"isRevealed": true
}
}
}
}
}`;

const args: GPCPCDArgs = {
proofConfig: {
argumentType: ArgumentTypeName.String,
value: EXAMPLE_GPC_CONFIG,
userProvided: false
},
pods: {
argumentType: ArgumentTypeName.RecordContainer,
value: {
examplePOD: {
argumentType: ArgumentTypeName.PCD,
pcdType: PODPCDPackage.name,
value: undefined,
userProvided: true,
displayName: "Example POD"
}
},
validatorParams: {
proofConfig: EXAMPLE_GPC_CONFIG,
membershipLists: undefined,
prescribedEntries: undefined,
prescribedSignerPublicKeys: undefined
}
},
identity: {
argumentType: ArgumentTypeName.PCD,
pcdType: SemaphoreIdentityPCDPackage.name,
value: undefined,
userProvided: true
},
externalNullifier: {
argumentType: ArgumentTypeName.String,
value: undefined,
userProvided: false
},
membershipLists: {
argumentType: ArgumentTypeName.String,
value: undefined,
userProvided: false
},
watermark: {
argumentType: ArgumentTypeName.String,
value: "watermark",
userProvided: false
}
};

const request: PodspecProofRequest = {
pods: {
pod1: {
Expand All @@ -89,7 +26,7 @@ const request: PodspecProofRequest = {
export function GPC(): ReactNode {
const { z, connected } = useParcnetClient();
const [proof, setProof] = useState<ProveResult>();
const [verified, setVerified] = useState<boolean | undefined>();
const [verified, _setVerified] = useState<boolean | undefined>();

return !connected ? null : (
<div>
Expand Down
5 changes: 3 additions & 2 deletions examples/test-app/src/apis/PODSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ await z.pod.insert(pod);`}
await z.pod.insert(pod);
setSignature(pod.signature);
setCreationState(PODCreationState.Success);
} catch (e) {
} catch (_e) {
setCreationState(PODCreationState.Failure);
}
}}
Expand Down Expand Up @@ -381,7 +381,7 @@ function DeletePOD({ z }: { z: ParcnetAPI }): ReactNode {
try {
await z.pod.delete(signature);
setDeletionState(PODDeletionState.Success);
} catch (e) {
} catch (_e) {
setDeletionState(PODDeletionState.Failure);
}
}}
Expand All @@ -403,6 +403,7 @@ function DeletePOD({ z }: { z: ParcnetAPI }): ReactNode {

function SubscribeToPODs({ z }: { z: ParcnetAPI }): ReactNode {
const [pods, setPODs] = useState<POD[]>([]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [subscription, setSubscription] = useState<Subscription<any> | null>(
null
);
Expand Down
2 changes: 1 addition & 1 deletion examples/test-app/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getConnectionInfo(): ClientConnectionInfo {
) {
connectionInfo = parsedConnectionInfo;
}
} catch (e) {
} catch (_e) {
// JSON parsing failed
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
"node": ">=22"
},
"dependencies": {
"mprocs": "^0.7.1"
Expand Down
9 changes: 0 additions & 9 deletions packages/app-connector/.eslintrc.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions packages/app-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@
"@types/mocha": "^10.0.1",
"@types/node": "^22.5.4",
"chai-as-promised": "^7.1.1",
"eslint": "^8",
"mocha": "^10.2.0",
"tsup": "^8.2.4",
"tsx": "^4.19.0",
"typescript": "^5.3.3"
"typescript": "^5.5"
},
"publishConfig": {
"access": "public",
Expand Down
5 changes: 3 additions & 2 deletions packages/app-connector/src/adapters/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { DialogController } from "./iframe.js";

class DialogControllerImpl implements DialogController {
public show(): void {
console.log("toooooooast");
toast.info("Your PARCNET client requests interaction");
}

public close(): void {}
public close(): void {
// Does nothing
}
}

export function connectWebsocket(zapp: Zapp, url: string): Promise<ParcnetAPI> {
Expand Down
4 changes: 0 additions & 4 deletions packages/app-connector/src/api_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { EventEmitter } from "eventemitter3";
import { PodspecProofRequest } from "../../podspec/src/index.js";
import { ParcnetRPCConnector } from "./rpc_client.js";

type QueryType = p.PodSpec<p.EntriesSchema>;

/**
* A Subscription object is returned to the caller when a subscription is
* created. It allows the caller to attach event listeners to the subscription
Expand Down Expand Up @@ -120,13 +118,11 @@ class ParcnetGPCWrapper {
* query data.
*/
export class ParcnetAPI {
#api: ParcnetRPCConnector;
public pod: ParcnetPODWrapper;
public identity: ParcnetIdentityRPC;
public gpc: ParcnetGPCWrapper;

constructor(api: ParcnetRPCConnector) {
this.#api = api;
this.pod = new ParcnetPODWrapper(api);
this.identity = api.identity;
this.gpc = new ParcnetGPCWrapper(api);
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector/src/rpc_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ParcnetRPCConnector implements ParcnetRPC, ParcnetEvents {
{ resolve: (value: unknown) => void; reject: (reason?: unknown) => void }
>();
#emitter: EventEmitter;
#connected: boolean = false;
#connected = false;

/**
* Invoke a method on the remote client.
Expand Down
8 changes: 6 additions & 2 deletions packages/app-connector/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { DialogController, postRPCMessage } from "../src";
import { ParcnetRPCConnector } from "../src/rpc_client";

export const mockDialog: DialogController = {
show: () => {},
close: () => {}
show: () => {
// Intentionally empty
},
close: () => {
// Intentionally empty
}
};

export async function connectedClient(): Promise<{
Expand Down
9 changes: 0 additions & 9 deletions packages/client-helpers/.eslintrc.cjs

This file was deleted.

Loading

0 comments on commit 51068e6

Please sign in to comment.