fix: Resolve all ESLint errors and warnings in web package
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixes all 542 ESLint problems in the web package to achieve 0 errors and 0 warnings. Changes: - Fixed 144 issues: nullish coalescing, return types, unused variables - Fixed 118 issues: unnecessary conditions, type safety, template literals - Fixed 79 issues: non-null assertions, unsafe assignments, empty functions - Fixed 67 issues: explicit return types, promise handling, enum comparisons - Fixed 45 final warnings: missing return types, optional chains - Fixed 25 typecheck-related issues: async/await, type assertions, formatting - Fixed JSX.Element namespace errors across 90+ files All Quality Rails violations resolved. Lint and typecheck both pass with 0 problems. Files modified: 118 components, tests, hooks, and utilities Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ interface Agent {
|
||||
taskCount: number;
|
||||
}
|
||||
|
||||
export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps) {
|
||||
export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): React.JSX.Element {
|
||||
const [agents, setAgents] = useState<Agent[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
@@ -52,7 +52,7 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps) {
|
||||
}, 500);
|
||||
}, []);
|
||||
|
||||
const getStatusIcon = (status: Agent["status"]) => {
|
||||
const getStatusIcon = (status: Agent["status"]): React.JSX.Element => {
|
||||
switch (status) {
|
||||
case "WORKING":
|
||||
return <Activity className="w-4 h-4 text-blue-500 animate-pulse" />;
|
||||
@@ -69,19 +69,19 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusText = (status: Agent["status"]) => {
|
||||
const getStatusText = (status: Agent["status"]): string => {
|
||||
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
|
||||
};
|
||||
|
||||
const getTimeSinceLastHeartbeat = (timestamp: string) => {
|
||||
const getTimeSinceLastHeartbeat = (timestamp: string): string => {
|
||||
const now = new Date();
|
||||
const last = new Date(timestamp);
|
||||
const diffMs = now.getTime() - last.getTime();
|
||||
|
||||
if (diffMs < 60000) return "Just now";
|
||||
if (diffMs < 3600000) return `${Math.floor(diffMs / 60000)}m ago`;
|
||||
if (diffMs < 86400000) return `${Math.floor(diffMs / 3600000)}h ago`;
|
||||
return `${Math.floor(diffMs / 86400000)}d ago`;
|
||||
if (diffMs < 3600000) return `${String(Math.floor(diffMs / 60000))}m ago`;
|
||||
if (diffMs < 86400000) return `${String(Math.floor(diffMs / 3600000))}h ago`;
|
||||
return `${String(Math.floor(diffMs / 86400000))}d ago`;
|
||||
};
|
||||
|
||||
const stats = {
|
||||
|
||||
Reference in New Issue
Block a user