Cleaning up a suite of eslint warnings

This commit is contained in:
Keith Stevens
2023-01-10 13:02:17 +09:00
parent 2e2efdec65
commit 34a1715923
12 changed files with 20 additions and 24 deletions
-5
View File
@@ -1,10 +1,6 @@
import {
Button,
ButtonProps,
Menu,
MenuButton,
MenuItem,
MenuList,
Modal,
ModalBody,
ModalCloseButton,
@@ -16,7 +12,6 @@ import {
useDisclosure,
} from "@chakra-ui/react";
import { useState } from "react";
import { FaChevronDown } from "react-icons/fa";
interface SkipButtonProps extends ButtonProps {
onSkip: (reason: string) => void;
+1 -1
View File
@@ -12,7 +12,7 @@ import React from "react";
export const CollapsableText = ({ text, maxLength = 220 }) => {
const { isOpen, onOpen, onClose } = useDisclosure();
if (typeof text != "string" || text.length <= maxLength) {
if (typeof text !== "string" || text.length <= maxLength) {
return text;
} else {
return (
+2 -2
View File
@@ -69,14 +69,14 @@ export const FlaggableElement = (props) => {
const handleCheckboxState = (isChecked, idx) => {
setCheckboxValues(
checkboxValues.map((val, i) => {
return i == idx ? isChecked : val;
return i === idx ? isChecked : val;
})
);
};
const handleSliderState = (newVal, idx) => {
setSliderValues(
sliderValues.map((val, i) => {
return i == idx ? newVal : val;
return i === idx ? newVal : val;
})
);
};
+6 -2
View File
@@ -43,7 +43,7 @@ export const Messages = ({
return <Grid gap={2}>{items}</Grid>;
};
export const MessageView = forwardRef(({ is_assistant, text, message_id }: Message, ref) => {
export const MessageView = forwardRef(({ is_assistant, text }: Message, ref) => {
const { colorMode } = useColorMode();
const bgColor = useMemo(() => {
@@ -54,7 +54,11 @@ export const MessageView = forwardRef(({ is_assistant, text, message_id }: Messa
}
}, [colorMode, is_assistant]);
return <div className={`${bgColor} p-4 rounded-md text-white whitespace-pre-wrap`}>{text}</div>;
return (
<div ref={ref} className={`${bgColor} p-4 rounded-md text-white whitespace-pre-wrap`}>
{text}
</div>
);
});
MessageView.displayName = "MessageView";
+1 -2
View File
@@ -1,10 +1,9 @@
import { useState } from "react";
import { Messages } from "src/components/Messages";
import { TaskControls } from "src/components/Survey/TaskControls";
import { TrackedTextarea } from "src/components/Survey/TrackedTextarea";
import { TwoColumnsWithCards } from "src/components/Survey/TwoColumnsWithCards";
import { TaskType } from "./TaskTypes";
import { TaskType } from "src/components/Tasks/TaskTypes";
export interface CreateTaskProps {
// we need a task type
@@ -48,7 +48,7 @@ export const EvaluateTask = ({ tasks, trigger, onSkipTask, onNextTask, mainBgCla
<TaskControlsOverridable
tasks={tasks}
isValid={ranking.length == tasks[0].task[sortables].length}
isValid={ranking.length === tasks[0].task[sortables].length}
prepareForSubmit={() => setRanking(tasks[0].task[sortables].map((_, idx) => idx))}
onSubmitResponse={submitResponse}
onSkipTask={(task, reason) => {
+4 -4
View File
@@ -1,8 +1,8 @@
import { CreateTask } from "./CreateTask";
import { EvaluateTask } from "./EvaluateTask";
import { TaskCategory, TaskTypes } from "./TaskTypes";
import useSWRMutation from "swr/mutation";
import { CreateTask } from "src/components/Tasks/CreateTask";
import { EvaluateTask } from "src/components/Tasks/EvaluateTask";
import { TaskCategory, TaskTypes } from "src/components/Tasks/TaskTypes";
import poster from "src/lib/poster";
import useSWRMutation from "swr/mutation";
export const Task = ({ tasks, trigger, mutate, mainBgClasses }) => {
const task = tasks[0].task;
+2 -2
View File
@@ -30,7 +30,7 @@ export class OasstApiClient {
body: JSON.stringify(body),
});
if (resp.status == 204) {
if (resp.status === 204) {
return null;
}
@@ -57,7 +57,7 @@ export class OasstApiClient {
},
});
if (resp.status == 204) {
if (resp.status === 204) {
return null;
}
+1 -2
View File
@@ -1,5 +1,4 @@
import { getToken } from "next-auth/jwt";
import prisma from "src/lib/prismadb";
/**
* Sets the Label in the Backend.
@@ -15,7 +14,7 @@ const handler = async (req, res) => {
}
// Parse out the local message_id, task ID and the interaction contents.
const { message_id, post_id, label_map, text } = await JSON.parse(req.body);
const { message_id, label_map, text } = await JSON.parse(req.body);
const interactionRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/text_labels`, {
method: "POST",
-1
View File
@@ -1,7 +1,6 @@
import { useColorMode } from "@chakra-ui/react";
import Head from "next/head";
import { getCsrfToken, getProviders } from "next-auth/react";
import { AuthLayout } from "src/components/AuthLayout";
export default function Verify() {
const { colorMode } = useColorMode();
+1 -1
View File
@@ -63,7 +63,7 @@ const SummarizeStory = () => {
return <LoadingScreen text="Loading..." />;
}
if (tasks.length == 0) {
if (tasks.length === 0) {
return <div className="p-6 bg-slate-100 text-gray-800">No tasks found...</div>;
}
+1 -1
View File
@@ -60,7 +60,7 @@ const RateSummary = () => {
return <LoadingScreen text="Loading..." />;
}
if (tasks.length == 0) {
if (tasks.length === 0) {
return (
<div className={`p-12 ${mainBgClasses}`}>
<div className="flex h-full">