fix: remove 8 unused variables in File Manager and Host Manager components

Cleaned up unused imports, state variables, and function parameters:
- DiffViewer.tsx: removed unused error parameter in catch block
- FileViewer.tsx: removed ReactPlayer import, unused originalContent state,
  node parameters from markdown code components, audio variable
- HostManager.tsx: removed onSelectView and updatedHost parameters
- TunnelViewer.tsx: removed TunnelConnection import

Reduced lint errors from 271 to 208 (63 errors fixed total)
This commit is contained in:
ZacharyZcR
2025-10-09 19:44:01 +08:00
parent c19dbbd8bd
commit 45a4f09172
4 changed files with 6 additions and 15 deletions

View File

@@ -61,7 +61,7 @@ export function DiffViewer({
userId: sshHost.userId,
});
}
} catch (error) {
} catch {
await connectSSH(sshSessionId, {
hostId: sshHost.id,
ip: sshHost.ip,

View File

@@ -60,7 +60,6 @@ import {
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
import { PhotoProvider, PhotoView } from "react-photo-view";
import "react-photo-view/dist/react-photo-view.css";
import ReactPlayer from "react-player";
import AudioPlayer from "react-h5-audio-player";
import "react-h5-audio-player/lib/styles.css";
import ReactMarkdown from "react-markdown";
@@ -311,9 +310,7 @@ export function FileViewer({
}: FileViewerProps) {
const { t } = useTranslation();
const [editedContent, setEditedContent] = useState(content);
const [originalContent, setOriginalContent] = useState(
savedContent || content,
);
const [, setOriginalContent] = useState(savedContent || content);
const [hasChanges, setHasChanges] = useState(false);
const [showLargeFileWarning, setShowLargeFileWarning] = useState(false);
const [forceShowAsText, setForceShowAsText] = useState(false);
@@ -1097,7 +1094,7 @@ export function FileViewer({
<ReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
code({ node, inline, className, children, ...props }) {
code({ inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || "");
return !inline && match ? (
<SyntaxHighlighter
@@ -1380,8 +1377,7 @@ export function FileViewer({
<div className="rounded-lg overflow-hidden">
<AudioPlayer
src={audioUrl}
onLoadedMetadata={(e) => {
const audio = e.currentTarget;
onLoadedMetadata={() => {
if (onMediaDimensionsChange) {
onMediaDimensionsChange({
width: 600,

View File

@@ -15,7 +15,6 @@ import { useTranslation } from "react-i18next";
import type { SSHHost, HostManagerProps } from "../../../types/index";
export function HostManager({
onSelectView,
isTopbarOpen,
}: HostManagerProps): React.ReactElement {
const { t } = useTranslation();
@@ -30,7 +29,7 @@ export function HostManager({
setActiveTab("add_host");
};
const handleFormSubmit = (updatedHost?: SSHHost) => {
const handleFormSubmit = () => {
setEditingHost(null);
setActiveTab("host_viewer");
};

View File

@@ -1,11 +1,7 @@
import React from "react";
import { TunnelObject } from "./TunnelObject.tsx";
import { useTranslation } from "react-i18next";
import type {
SSHHost,
TunnelConnection,
TunnelStatus,
} from "../../../types/index.js";
import type { SSHHost, TunnelStatus } from "../../../types/index.js";
interface SSHTunnelViewerProps {
hosts: SSHHost[];