chore(web): add ignore pattern to eslint for the unused-vars rule (#965)

* allow eslint ununsed vars and params if starts with _

* comment rests of unused code on Irc.tsx

* fix some eslint warn about unused code
This commit is contained in:
Fabricio Silva 2023-07-02 13:19:03 +01:00 committed by GitHub
parent 32ffc875b0
commit a5e05284d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 44 deletions

View file

@ -31,26 +31,26 @@ const RowItem = ({ label, value, title, emptyText }: RowItemProps) => {
);
};
interface RowItemNumberProps {
label: string;
value?: string | number;
title?: string;
unit?: string;
}
// interface RowItemNumberProps {
// label: string;
// value?: string | number;
// title?: string;
// unit?: string;
// }
const RowItemNumber = ({ label, value, title, unit }: RowItemNumberProps) => {
return (
<div className="py-4 sm:py-5 sm:grid sm:grid-cols-4 sm:gap-4 sm:px-6">
<dt className="font-medium text-gray-500 dark:text-white" title={title}>{label}:</dt>
<dd className="mt-1 text-gray-900 dark:text-white sm:mt-0 sm:col-span-2 break-all">
<span className="px-1 py-0.5 bg-gray-700 rounded shadow">{value}</span>
{unit &&
<span className="ml-1 text-sm text-gray-800 dark:text-gray-400">{unit}</span>
}
</dd>
</div>
);
};
// const RowItemNumber = ({ label, value, title, unit }: RowItemNumberProps) => {
// return (
// <div className="py-4 sm:py-5 sm:grid sm:grid-cols-4 sm:gap-4 sm:px-6">
// <dt className="font-medium text-gray-500 dark:text-white" title={title}>{label}:</dt>
// <dd className="mt-1 text-gray-900 dark:text-white sm:mt-0 sm:col-span-2 break-all">
// <span className="px-1 py-0.5 bg-gray-700 rounded shadow">{value}</span>
// {unit &&
// <span className="ml-1 text-sm text-gray-800 dark:text-gray-400">{unit}</span>
// }
// </dd>
// </div>
// );
// };
const RowItemVersion = ({ label, value, title, newUpdate }: RowItemProps) => {
if (!value) {

View file

@ -132,7 +132,7 @@ function FeedSettings() {
Last run <span className="sort-indicator">{sortedFeeds.getSortIndicator("last_run")}</span>
</div>
</li>
{sortedFeeds.items.map((feed, idx) => (
{sortedFeeds.items.map((feed) => (
<ListItem key={feed.id} feed={feed}/>
))}
</ol>

View file

@ -25,7 +25,7 @@ import { EmptySimple } from "@components/emptystates";
import { DeleteModal } from "@components/modals";
import Toast from "@components/notifications/Toast";
import { SettingsContext } from "@utils/Context";
import { useForm } from "react-hook-form";
// import { useForm } from "react-hook-form";
export const ircKeys = {
all: ["irc_networks"] as const,
@ -586,9 +586,9 @@ type IrcEvent = {
time: string;
};
type IrcMsg = {
msg: string;
};
// type IrcMsg = {
// msg: string;
// };
interface EventsProps {
network: IrcNetwork;
@ -606,27 +606,27 @@ export const Events = ({ network, channel }: EventsProps) => {
// messagesEndRef.current?.scrollIntoView({ behavior: "smooth", block: "end", inline: "end" });
// };
const { handleSubmit, register , resetField } = useForm<IrcMsg>({
defaultValues: { msg: "" },
mode: "onBlur"
});
// const { handleSubmit, register , resetField } = useForm<IrcMsg>({
// defaultValues: { msg: "" },
// mode: "onBlur"
// });
const cmdMutation = useMutation({
mutationFn: (data: SendIrcCmdRequest) => APIClient.irc.sendCmd(data),
onSuccess: (_, variables) => {
resetField("msg");
},
onError: () => {
toast.custom((t) => (
<Toast type="error" body="Error sending IRC cmd" t={t} />
));
}
});
// const cmdMutation = useMutation({
// mutationFn: (data: SendIrcCmdRequest) => APIClient.irc.sendCmd(data),
// onSuccess: (_, _variables) => {
// resetField("msg");
// },
// onError: () => {
// toast.custom((t) => (
// <Toast type="error" body="Error sending IRC cmd" t={t} />
// ));
// }
// });
const onSubmit = (msg: IrcMsg) => {
const payload = { network_id: network.id, nick: network.nick, server: network.server, channel: channel, msg: msg.msg };
cmdMutation.mutate(payload);
};
// const onSubmit = (msg: IrcMsg) => {
// const payload = { network_id: network.id, nick: network.nick, server: network.server, channel: channel, msg: msg.msg };
// cmdMutation.mutate(payload);
// };
useEffect(() => {
// Following RFC4648