diff --git a/website/.eslintrc.json b/website/.eslintrc.json
index b2253ce8..04b5d542 100644
--- a/website/.eslintrc.json
+++ b/website/.eslintrc.json
@@ -6,19 +6,9 @@
"next/core-web-vitals"
],
"rules": {
- "simple-import-sort/imports": "error",
- "simple-import-sort/exports": "error",
- "@typescript-eslint/no-unused-vars": "off",
- "unused-imports/no-unused-imports": "error",
- "unused-imports/no-unused-vars": [
- "warn",
- {
- "vars": "all",
- "varsIgnorePattern": "^_",
- "args": "after-used",
- "argsIgnorePattern": "^_"
- }
- ]
+ "unused-imports/no-unused-imports": "warn",
+ "simple-import-sort/imports": "warn",
+ "simple-import-sort/exports": "warn"
},
"plugins": ["simple-import-sort", "unused-imports"]
}
diff --git a/website/package.json b/website/package.json
index 98f18965..80bc8bb4 100644
--- a/website/package.json
+++ b/website/package.json
@@ -13,9 +13,9 @@
"cypress": "cypress open",
"cypress:run": "cypress run",
"cypress:image-baseline": "cypress-image-diff -u",
- "fix:lint": "eslint --fix src/",
+ "fix:lint": "eslint --fix src/ --ext .js,.jsx,.ts,.tsx",
"fix:format": "prettier --write ./src",
- "fix": "npm run fix:lint && npm run fix:format"
+ "fix": "npm run fix:format && npm run fix:lint"
},
"dependencies": {
"@chakra-ui/react": "^2.4.4",
diff --git a/website/src/components/Header/Header.stories.jsx b/website/src/components/Header/Header.stories.jsx
index 793d4921..6a8a3866 100644
--- a/website/src/components/Header/Header.stories.jsx
+++ b/website/src/components/Header/Header.stories.jsx
@@ -3,6 +3,7 @@ import React from "react";
import { Header } from "./Header";
+// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Header/Header",
component: Header,
diff --git a/website/src/components/Header/NavLinks.stories.jsx b/website/src/components/Header/NavLinks.stories.jsx
index f7fafae2..9f21e151 100644
--- a/website/src/components/Header/NavLinks.stories.jsx
+++ b/website/src/components/Header/NavLinks.stories.jsx
@@ -1,5 +1,6 @@
import { NavLinks } from "./NavLinks";
+// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Header/NavLinks",
component: NavLinks,
diff --git a/website/src/components/Header/UserMenu.stories.jsx b/website/src/components/Header/UserMenu.stories.jsx
index 3c489617..aeb7e1c6 100644
--- a/website/src/components/Header/UserMenu.stories.jsx
+++ b/website/src/components/Header/UserMenu.stories.jsx
@@ -3,6 +3,7 @@ import React from "react";
import UserMenu from "./UserMenu";
+// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Header/UserMenu",
component: UserMenu,
diff --git a/website/src/components/Header/UserMenu.tsx b/website/src/components/Header/UserMenu.tsx
index 8de54f3d..c42d8895 100644
--- a/website/src/components/Header/UserMenu.tsx
+++ b/website/src/components/Header/UserMenu.tsx
@@ -12,7 +12,6 @@ export function UserMenu() {
return <>>;
}
if (session && session.user) {
- const email = session.user.email;
const accountOptions = [
{
name: "Account Settings",
diff --git a/website/src/components/Loading/Loading.stories.jsx b/website/src/components/Loading/Loading.stories.jsx
index 0f068009..02579819 100644
--- a/website/src/components/Loading/Loading.stories.jsx
+++ b/website/src/components/Loading/Loading.stories.jsx
@@ -1,5 +1,6 @@
import { LoadingScreen } from "./LoadingScreen";
+// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Example/LoadingScreen",
component: LoadingScreen,
diff --git a/website/src/components/RankItem.tsx b/website/src/components/RankItem.tsx
index 3ba9da70..f424fa26 100644
--- a/website/src/components/RankItem.tsx
+++ b/website/src/components/RankItem.tsx
@@ -2,8 +2,8 @@ const RankItem = ({ username, score }) => {
return (
1
-
@username
-
20.5
+
{username}
+
{score}
gold
);
diff --git a/website/src/components/RatingRadioGroup.tsx b/website/src/components/RatingRadioGroup.tsx
index 7fbcc3ac..6a63d1ec 100644
--- a/website/src/components/RatingRadioGroup.tsx
+++ b/website/src/components/RatingRadioGroup.tsx
@@ -1,7 +1,7 @@
import { Box, HStack, useRadio, useRadioGroup } from "@chakra-ui/react";
const RatingRadioButton = (props) => {
- const { state, getInputProps, getCheckboxProps } = useRadio(props);
+ const { getInputProps, getCheckboxProps } = useRadio(props);
const input = getInputProps();
const checkbox = getCheckboxProps();
diff --git a/website/src/components/TaskInfo/TaskInfo.tsx b/website/src/components/TaskInfo/TaskInfo.tsx
index 629d5c1a..fa16615e 100644
--- a/website/src/components/TaskInfo/TaskInfo.tsx
+++ b/website/src/components/TaskInfo/TaskInfo.tsx
@@ -1,4 +1,4 @@
-export const TaskInfo = ({ id, output }: { id: string; output: any }) => {
+export const TaskInfo = ({ id, output }: { id: string; output: string }) => {
return (
Prompt
diff --git a/website/src/pages/_app.tsx b/website/src/pages/_app.tsx
index b36e3392..b9cffba1 100644
--- a/website/src/pages/_app.tsx
+++ b/website/src/pages/_app.tsx
@@ -8,6 +8,7 @@ import type { AppProps } from "next/app";
import { SessionProvider } from "next-auth/react";
import { getDefaultLayout, NextPageWithLayout } from "src/components/Layout";
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
diff --git a/website/src/pages/account/index.tsx b/website/src/pages/account/index.tsx
index b5c9d906..51f7ed38 100644
--- a/website/src/pages/account/index.tsx
+++ b/website/src/pages/account/index.tsx
@@ -8,6 +8,7 @@ export default function Account() {
const { data: session } = useSession();
const [username, setUsername] = useState("null");
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleUpdate = async () => {
const response = await fetch("../api/update", {
method: "POST",
diff --git a/website/src/pages/api/new_task/[task_type].ts b/website/src/pages/api/new_task/[task_type].ts
index b07215cd..69548b5f 100644
--- a/website/src/pages/api/new_task/[task_type].ts
+++ b/website/src/pages/api/new_task/[task_type].ts
@@ -63,7 +63,7 @@ const handler = async (req, res) => {
message_id: registeredTask.id,
}),
});
- const ack = await ackRes.json();
+ await ackRes.json();
// Send the results to the client.
res.status(200).json(registeredTask);
diff --git a/website/src/pages/api/username.tsx b/website/src/pages/api/username.tsx
index 36c8360e..0a88ad20 100644
--- a/website/src/pages/api/username.tsx
+++ b/website/src/pages/api/username.tsx
@@ -5,7 +5,6 @@ import { getSession } from "next-auth/react";
// Optional fields in body: content
export default async function handle(req, res) {
const { username } = req.body;
- const { email } = req.body;
const session = await getSession({ req });
const result = await prisma.user.update({
diff --git a/website/src/pages/auth/signin.tsx b/website/src/pages/auth/signin.tsx
index bcb51835..2ead2414 100644
--- a/website/src/pages/auth/signin.tsx
+++ b/website/src/pages/auth/signin.tsx
@@ -6,6 +6,7 @@ import React, { useRef } from "react";
import { FaBug, FaDiscord, FaEnvelope, FaGithub } from "react-icons/fa";
import { AuthLayout } from "src/components/AuthLayout";
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default function Signin({ csrfToken, providers }) {
const { discord, email, github, credentials } = providers;
const emailEl = useRef(null);
@@ -104,6 +105,7 @@ export default function Signin({ csrfToken, providers }) {
);
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function getServerSideProps(context) {
const csrfToken = await getCsrfToken();
const providers = await getProviders();
diff --git a/website/src/pages/auth/verify.tsx b/website/src/pages/auth/verify.tsx
index cbf40241..e004f504 100644
--- a/website/src/pages/auth/verify.tsx
+++ b/website/src/pages/auth/verify.tsx
@@ -16,6 +16,7 @@ export default function Verify() {
);
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function getServerSideProps(context) {
const csrfToken = await getCsrfToken();
const providers = await getProviders();
diff --git a/website/src/pages/create/assistant_reply.tsx b/website/src/pages/create/assistant_reply.tsx
index d28a0ad0..54badd71 100644
--- a/website/src/pages/create/assistant_reply.tsx
+++ b/website/src/pages/create/assistant_reply.tsx
@@ -22,7 +22,7 @@ const AssistantReply = () => {
},
});
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
setTasks((oldTasks) => [...oldTasks, newTask]);
diff --git a/website/src/pages/create/summarize_story.tsx b/website/src/pages/create/summarize_story.tsx
index 8746b03e..e136035a 100644
--- a/website/src/pages/create/summarize_story.tsx
+++ b/website/src/pages/create/summarize_story.tsx
@@ -29,7 +29,7 @@ const SummarizeStory = () => {
// Every time we submit an answer to the latest task, let the backend handle
// all the interactions then add the resulting task to the queue. This ends
// when we hit the done task.
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
// This is the more efficient way to update a react state array.
diff --git a/website/src/pages/create/user_reply.tsx b/website/src/pages/create/user_reply.tsx
index 36c912d5..1b221571 100644
--- a/website/src/pages/create/user_reply.tsx
+++ b/website/src/pages/create/user_reply.tsx
@@ -22,7 +22,7 @@ const UserReply = () => {
},
});
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
setTasks((oldTasks) => [...oldTasks, newTask]);
diff --git a/website/src/pages/evaluate/rank_assistant_replies.tsx b/website/src/pages/evaluate/rank_assistant_replies.tsx
index cd6d7811..da3b8d4e 100644
--- a/website/src/pages/evaluate/rank_assistant_replies.tsx
+++ b/website/src/pages/evaluate/rank_assistant_replies.tsx
@@ -25,7 +25,7 @@ const RankAssistantReplies = () => {
},
});
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
setTasks((oldTasks) => [...oldTasks, newTask]);
diff --git a/website/src/pages/evaluate/rank_initial_prompts.tsx b/website/src/pages/evaluate/rank_initial_prompts.tsx
index 4f236b50..4bfc5163 100644
--- a/website/src/pages/evaluate/rank_initial_prompts.tsx
+++ b/website/src/pages/evaluate/rank_initial_prompts.tsx
@@ -25,7 +25,7 @@ const RankInitialPrompts = () => {
},
});
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
setTasks((oldTasks) => [...oldTasks, newTask]);
diff --git a/website/src/pages/evaluate/rank_user_replies.tsx b/website/src/pages/evaluate/rank_user_replies.tsx
index b67fda10..0a1c6d16 100644
--- a/website/src/pages/evaluate/rank_user_replies.tsx
+++ b/website/src/pages/evaluate/rank_user_replies.tsx
@@ -25,7 +25,7 @@ const RankUserReplies = () => {
},
});
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
setTasks((oldTasks) => [...oldTasks, newTask]);
diff --git a/website/src/pages/evaluate/rate_summary.tsx b/website/src/pages/evaluate/rate_summary.tsx
index f11e19f6..f64b0f1a 100644
--- a/website/src/pages/evaluate/rate_summary.tsx
+++ b/website/src/pages/evaluate/rate_summary.tsx
@@ -30,7 +30,7 @@ const RateSummary = () => {
// Every time we submit an answer to the latest task, let the backend handle
// all the interactions then add the resulting task to the queue. This ends
// when we hit the done task.
- const { trigger, isMutating } = useSWRMutation("/api/update_task", poster, {
+ const { trigger } = useSWRMutation("/api/update_task", poster, {
onSuccess: async (data) => {
const newTask = await data.json();
// This is the more efficient way to update a react state array.