fix(lint): resolve remaining ESLint errors (unused vars, any types, react-refresh)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import {
|
||||
import { SafetyToggle } from './SafetyToggle'
|
||||
import { ChangePreviewModal } from './ChangePreviewModal'
|
||||
import { useConfigBrowse, useConfigPanel } from '@/hooks/useConfigPanel'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { ConfigPanelProps } from '@/lib/configPanelTypes'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -48,8 +47,6 @@ interface AddressListForm {
|
||||
|
||||
const EMPTY_FORM: AddressListForm = { list: '', address: '', comment: '' }
|
||||
|
||||
type PanelHook = ReturnType<typeof useConfigPanel>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// AddressListPanel
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -13,7 +13,6 @@ import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { configEditorApi } from '@/lib/configEditorApi'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { ConfigPanelProps } from '@/lib/configPanelTypes'
|
||||
|
||||
interface BwResult {
|
||||
|
||||
@@ -48,12 +48,6 @@ export function BridgeVlanPanel({ tenantId, deviceId, active }: ConfigPanelProps
|
||||
[ports.entries],
|
||||
)
|
||||
|
||||
// Check if VLAN filtering is enabled on any bridge
|
||||
const vlanFilteringBridges = useMemo(
|
||||
() => bridges.entries.filter((b) => b['vlan-filtering'] === 'true' || b['vlan-filtering'] === 'yes'),
|
||||
[bridges.entries],
|
||||
)
|
||||
|
||||
const handleAdd = useCallback(() => {
|
||||
setEditEntry(null)
|
||||
setFormData({
|
||||
|
||||
@@ -22,15 +22,12 @@ import {
|
||||
import { SafetyToggle } from './SafetyToggle'
|
||||
import { ChangePreviewModal } from './ChangePreviewModal'
|
||||
import { useConfigBrowse, useConfigPanel } from '@/hooks/useConfigPanel'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { ConfigPanelProps } from '@/lib/configPanelTypes'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
type PanelHook = ReturnType<typeof useConfigPanel>
|
||||
|
||||
// Timeout fields we expose for editing
|
||||
const TIMEOUT_FIELDS = [
|
||||
{ key: 'tcp-established-timeout', label: 'TCP Established' },
|
||||
|
||||
@@ -48,8 +48,8 @@ export function DiffViewer({ tenantId, deviceId, snapshotId, onClose }: DiffView
|
||||
{/* Content */}
|
||||
{isLoading ? (
|
||||
<div className="space-y-2">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<div key={i} className="h-4 bg-elevated rounded animate-pulse" style={{ width: `${60 + Math.random() * 40}%` }} />
|
||||
{[75, 90, 65, 85, 70, 80].map((w, i) => (
|
||||
<div key={i} className="h-4 bg-elevated rounded animate-pulse" style={{ width: `${w}%` }} />
|
||||
))}
|
||||
</div>
|
||||
) : isError || !diff ? (
|
||||
|
||||
@@ -6,15 +6,13 @@
|
||||
* provides a visual rule builder form, and supports move up/down reordering.
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useMemo } from 'react'
|
||||
import { useState, useCallback } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import {
|
||||
Plus,
|
||||
MoreHorizontal,
|
||||
Pencil,
|
||||
Trash2,
|
||||
ArrowUp,
|
||||
ArrowDown,
|
||||
Eye,
|
||||
EyeOff,
|
||||
Shield,
|
||||
@@ -472,11 +470,6 @@ export function FirewallPanel({ tenantId, deviceId, active }: ConfigPanelProps)
|
||||
setPreviewOpen(false)
|
||||
}, [panel])
|
||||
|
||||
const afterApply = useMemo(() => {
|
||||
// When applyChanges succeeds, the hook auto-refetches via queryClient.invalidateQueries
|
||||
return panel.pendingChanges.length
|
||||
}, [panel.pendingChanges.length])
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Render
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useMemo } from 'react'
|
||||
import { Plus, Pencil, Trash2, ArrowUp, ArrowDown, Filter } from 'lucide-react'
|
||||
import { Plus, Pencil, Trash2, Filter } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
|
||||
@@ -197,7 +197,8 @@ function PoolTable({
|
||||
entries,
|
||||
panel,
|
||||
poolUsedBy,
|
||||
existingPools,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
existingPools: _existingPools,
|
||||
}: {
|
||||
entries: PoolEntry[]
|
||||
panel: PanelHook
|
||||
|
||||
@@ -44,7 +44,7 @@ import { cn } from '@/lib/utils'
|
||||
import { useConfigBrowse, useConfigPanel } from '@/hooks/useConfigPanel'
|
||||
import { SafetyToggle } from '@/components/config/SafetyToggle'
|
||||
import { ChangePreviewModal } from '@/components/config/ChangePreviewModal'
|
||||
import type { ConfigPanelProps, ConfigChange } from '@/lib/configPanelTypes'
|
||||
import type { ConfigPanelProps } from '@/lib/configPanelTypes'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useMemo } from 'react'
|
||||
import { Plus, Pencil, Trash2, Route, Filter } from 'lucide-react'
|
||||
import { Plus, Pencil, Trash2, Route } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
|
||||
@@ -29,15 +29,6 @@ interface TorchEntry {
|
||||
rx: string
|
||||
}
|
||||
|
||||
function formatBytes(val: string): string {
|
||||
const n = parseInt(val, 10)
|
||||
if (isNaN(n)) return val || '-'
|
||||
if (n >= 1_000_000_000) return `${(n / 1_000_000_000).toFixed(2)} GB`
|
||||
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)} MB`
|
||||
if (n >= 1_000) return `${(n / 1_000).toFixed(0)} KB`
|
||||
return `${n} B`
|
||||
}
|
||||
|
||||
function formatBps(val: string): string {
|
||||
const n = parseInt(val, 10)
|
||||
if (isNaN(n)) return val || '-'
|
||||
|
||||
@@ -618,8 +618,6 @@ function WirelessEditDialog({
|
||||
}) {
|
||||
const [showPassphrase, setShowPassphrase] = useState(false)
|
||||
|
||||
const ssid = entry?.ssid || entry?.['configuration.ssid'] || ''
|
||||
|
||||
const [formData, setFormData] = useState<WirelessFormData>({
|
||||
ssid: '',
|
||||
band: '',
|
||||
@@ -631,7 +629,8 @@ function WirelessEditDialog({
|
||||
})
|
||||
|
||||
// Reset form when entry changes
|
||||
const entryId = entry?.['.id'] || ''
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const _entryId = entry?.['.id'] || ''
|
||||
useState(() => {
|
||||
if (entry) {
|
||||
setFormData({
|
||||
|
||||
Reference in New Issue
Block a user