Skip to content

Commit

Permalink
chore: manually fix linter warning
Browse files Browse the repository at this point in the history
  • Loading branch information
croumegous committed Dec 31, 2022
1 parent a0b9005 commit 8c79cad
Show file tree
Hide file tree
Showing 23 changed files with 26 additions and 29 deletions.
16 changes: 3 additions & 13 deletions website/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions website/src/components/Header/Header.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions website/src/components/Header/NavLinks.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NavLinks } from "./NavLinks";

// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Header/NavLinks",
component: NavLinks,
Expand Down
1 change: 1 addition & 0 deletions website/src/components/Header/UserMenu.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion website/src/components/Header/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export function UserMenu() {
return <></>;
}
if (session && session.user) {
const email = session.user.email;
const accountOptions = [
{
name: "Account Settings",
Expand Down
1 change: 1 addition & 0 deletions website/src/components/Loading/Loading.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LoadingScreen } from "./LoadingScreen";

// eslint-disable-next-line import/no-anonymous-default-export
export default {
title: "Example/LoadingScreen",
component: LoadingScreen,
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/RankItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const RankItem = ({ username, score }) => {
return (
<div className="flex flex-row justify-between p-6 border-2 border-slate-100 text-left font-semibold hover:bg-sky-50">
<div>1</div>
<div>@username</div>
<div>20.5</div>
<div>{username}</div>
<div>{score}</div>
<div>gold</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/RatingRadioGroup.tsx
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/TaskInfo/TaskInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const TaskInfo = ({ id, output }: { id: string; output: any }) => {
export const TaskInfo = ({ id, output }: { id: string; output: string }) => {
return (
<div className="grid grid-cols-[min-content_auto] gap-x-2 text-gray-700">
<b>Prompt</b>
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/api/new_task/[task_type].ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion website/src/pages/api/username.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 2 additions & 0 deletions website/src/pages/auth/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/auth/verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/create/assistant_reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/create/summarize_story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/create/user_reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/evaluate/rank_assistant_replies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/evaluate/rank_initial_prompts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/evaluate/rank_user_replies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/evaluate/rate_summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8c79cad

Please sign in to comment.