Skip to content

Commit

Permalink
Use same eslint everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Mar 17, 2024
1 parent 32ce708 commit 1a4835e
Show file tree
Hide file tree
Showing 13 changed files with 888 additions and 276 deletions.
4 changes: 4 additions & 0 deletions apps/anon-message-client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: ["@pcd/eslint-config-custom"],
root: true,
};
4 changes: 2 additions & 2 deletions apps/anon-message-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"typescript": "5.3.3"
},
"devDependencies": {
"eslint": "8.47.0",
"eslint-config-next": "13.4.13",
"@pcd/eslint-config-custom": "*",
"eslint": "8.57.0",
"nodemon": "^3.0.1",
"ts-node": "^10.9.2"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/anon-message-client/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function RootLayout({
children
}: {
children: React.ReactNode;
}) {
}): JSX.Element {
return (
<html lang="en">
<body>{children}</body>
Expand Down
20 changes: 10 additions & 10 deletions apps/anon-message-client/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function requestProof(
chatId: number,
topicId: number,
validEventIds: string[]
) {
): Promise<void> {
const watermark = getMessageWatermark(message).toString();
console.log("WATERMARK", watermark);
const revealedFields = {};
Expand Down Expand Up @@ -82,7 +82,7 @@ async function requestProof(
}
};

let passportOrigin = `${process.env.NEXT_PUBLIC_PASSPORT_CLIENT_URL}/`;
const passportOrigin = `${process.env.NEXT_PUBLIC_PASSPORT_CLIENT_URL}/`;
const returnUrl = `${
process.env.NEXT_PUBLIC_PASSPORT_SERVER_URL
}/telegram/message/?message=${encodeURIComponent(
Expand All @@ -101,7 +101,7 @@ async function requestProof(
window.location.href = proofUrl;
}

export default function () {
export default function (): JSX.Element {
const [message, setMessage] = useState("");
const [invalidMessage, setInvalidMessage] = useState<
InvalidMessage | undefined
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function () {
} else if (invalidMessage) {
setInvalidMessage(undefined);
}
}, [message]);
}, [message, invalidMessage]);

const onClick = useCallback(async () => {
setLoadingProofUrl(true);
Expand All @@ -160,7 +160,7 @@ export default function () {
topicData.value.validEventIds
);
setLoadingProofUrl(false);
}, [message]);
}, [message, topicData]);

if (!topicData) {
return (
Expand All @@ -185,7 +185,7 @@ export default function () {
<textarea
placeholder="Type your anonymous message here"
value={message}
onChange={(e) => setMessage(e.target.value)}
onChange={(e): void => setMessage(e.target.value)}
className={`border-2 text-2xl rounded-lg text-black resize-none p-2 h-[25vh] select-text`}
autoFocus
/>
Expand Down Expand Up @@ -224,7 +224,7 @@ export default function () {
<div className="flex justify-between items-center mb-3">
{expanded ? (
<div
onClick={() => setExpanded(false)}
onClick={(): void => setExpanded(false)}
className="cursor-pointer"
>
<svg
Expand All @@ -244,7 +244,7 @@ export default function () {
</div>
) : (
<div
onClick={() => setExpanded(true)}
onClick={(): void => setExpanded(true)}
className="cursor-pointer"
>
<svg
Expand All @@ -269,7 +269,7 @@ export default function () {
</span>
<div
className="cursor-pointer"
onClick={() => setShowInfo(false)}
onClick={(): void => setShowInfo(false)}
>
<svg
width="15"
Expand Down Expand Up @@ -297,7 +297,7 @@ export default function () {
<div className="flex item-center gap-4 mx-auto mt-4 w-full">
<button
className="w-full flex justify-center items-center rounded-lg bg-white text-[#50acf9] px-6 py-2 cursor-pointer mx-auto font-medium shadow-sm"
onClick={() => setExpanded(true)}
onClick={(): void => setExpanded(true)}
>
Learn More
</button>
Expand Down
4 changes: 2 additions & 2 deletions apps/anon-message-client/src/app/profile/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function Loading() {
export default function Loading(): JSX.Element {
return (
<div className="flex flex-col items-center bg-white p-4">
<div className="flex items-center justify-center p-2 w-full">
Expand All @@ -16,7 +16,7 @@ export default function Loading() {
</span>
</div>
<div className="flex flex-col gap-2 mt-4 w-full">
{[...Array(5)].map((_message: any, i: number) => (
{[...Array(5)].map((_message: unknown, i: number) => (
<div
className="w-full flex flex-col border border-black border-opacity-10 rounded-lg p-4 animate-pulse"
key={i}
Expand Down
2 changes: 1 addition & 1 deletion apps/anon-message-client/src/app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface AnonymousProfileResponse {
totalKarma: number;
}

export default function Page() {
export default function Page(): JSX.Element {
const [response, setResponse] = useState<
AnonymousProfileResponse | undefined
>(undefined);
Expand Down
4 changes: 2 additions & 2 deletions apps/anon-message-client/src/components/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ interface CopyButtonProps {
const CopyButton: React.FC<CopyButtonProps> = ({ link }) => {
const [copied, setCopied] = useState<boolean>(false);

const copyLink = () => {
const copyLink = (): void => {
navigator.clipboard.writeText(link);
};

return (
<button
className="justify-center w-full flex items-center rounded-lg bg-white text-[#50acf9] px-6 py-2 cursor-pointer mx-auto font-medium shadow-sm"
onClick={() => {
onClick={(): void => {
copyLink();
setCopied(true);
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/anon-message-client/src/components/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function reactionsToReactionCount(reactions: string[]): Record<string, number> {
}

// from: https://github.com/dcposch/zucast/blob/master/src/components/PostBox.tsx
function formatTime(timeMs: number) {
function formatTime(timeMs: number): string {
const secsAgo = Math.floor((Date.now() - timeMs) / 1000);
if (secsAgo < 60) return "Now";
if (secsAgo < 60 * 60) return `${Math.floor(secsAgo / 60)}m`;
Expand Down
2 changes: 1 addition & 1 deletion apps/passport-server/src/services/zubox/zuboxService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ export class ZuboxService {
continue;
}

for (const capability of pipeline?.instance.capabilities) {
for (const capability of pipeline?.instance.capabilities ?? []) {
if (
isCheckinCapability(capability) &&
capability.canHandleCheckinForEvent(eventId)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
},
"resolutions": {
"@types/react": "^18.0.22",
"@typescript-eslint/typescript-estree": "^7.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-node": "^10.9.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/tools/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
},
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-next": "13.0.0",
"eslint-config-next": "14.1.3",
"eslint-config-prettier": "^8.3.0",
"eslint-config-turbo": "latest",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down
4 changes: 4 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"TEST_LEMONADE_BACKEND_URL",
"PAGER_DUTY_API_KEY",
"PAGER_DUTY_SERVICE_ID",
"NEXT_PUBLIC_PASSPORT_CLIENT_URL",
"NEXT_PUBLIC_PASSPORT_SERVER_URL",
"//// add env vars above this line ////"
],
"globalEnv": [
Expand Down Expand Up @@ -180,6 +182,8 @@
"PAGER_DUTY_SERVICE_ID",
"PODBOX_TITLE_TAG",
"STYTCH_BYPASS",
"NEXT_PUBLIC_PASSPORT_CLIENT_URL",
"NEXT_PUBLIC_PASSPORT_SERVER_URL",
"//// add env vars above this line ////"
]
}
Loading

0 comments on commit 1a4835e

Please sign in to comment.