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:
@@ -41,7 +41,10 @@ interface EntryGraphViewerProps {
|
||||
initialDepth?: number;
|
||||
}
|
||||
|
||||
export function EntryGraphViewer({ slug, initialDepth = 1 }: EntryGraphViewerProps) {
|
||||
export function EntryGraphViewer({
|
||||
slug,
|
||||
initialDepth = 1,
|
||||
}: EntryGraphViewerProps): React.JSX.Element {
|
||||
const [graphData, setGraphData] = useState<EntryGraphResponse | null>(null);
|
||||
const [depth, setDepth] = useState(initialDepth);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -65,7 +68,7 @@ export function EntryGraphViewer({ slug, initialDepth = 1 }: EntryGraphViewerPro
|
||||
void loadGraph();
|
||||
}, [loadGraph]);
|
||||
|
||||
const handleDepthChange = (newDepth: number) => {
|
||||
const handleDepthChange = (newDepth: number): void => {
|
||||
setDepth(newDepth);
|
||||
};
|
||||
|
||||
@@ -77,7 +80,7 @@ export function EntryGraphViewer({ slug, initialDepth = 1 }: EntryGraphViewerPro
|
||||
);
|
||||
}
|
||||
|
||||
if (error || !graphData) {
|
||||
if (error ?? !graphData) {
|
||||
return (
|
||||
<div className="p-8 text-center">
|
||||
<div className="text-red-500 mb-2">Error loading graph</div>
|
||||
@@ -91,7 +94,7 @@ export function EntryGraphViewer({ slug, initialDepth = 1 }: EntryGraphViewerPro
|
||||
// Group nodes by depth for better visualization
|
||||
const nodesByDepth = nodes.reduce<Record<number, GraphNode[]>>((acc, node) => {
|
||||
const d = node.depth;
|
||||
if (!acc[d]) acc[d] = [];
|
||||
acc[d] ??= [];
|
||||
acc[d].push(node);
|
||||
return acc;
|
||||
}, {});
|
||||
@@ -194,7 +197,7 @@ export function EntryGraphViewer({ slug, initialDepth = 1 }: EntryGraphViewerPro
|
||||
key={tag.id}
|
||||
className="inline-flex items-center px-2.5 py-0.5 rounded text-xs font-medium"
|
||||
style={{
|
||||
backgroundColor: tag.color || "#6B7280",
|
||||
backgroundColor: tag.color ?? "#6B7280",
|
||||
color: "#FFFFFF",
|
||||
}}
|
||||
>
|
||||
@@ -242,7 +245,13 @@ interface NodeCardProps {
|
||||
connections?: { incoming: number; outgoing: number };
|
||||
}
|
||||
|
||||
function NodeCard({ node, isCenter, onClick, isSelected, connections }: NodeCardProps) {
|
||||
function NodeCard({
|
||||
node,
|
||||
isCenter,
|
||||
onClick,
|
||||
isSelected,
|
||||
connections,
|
||||
}: NodeCardProps): React.JSX.Element {
|
||||
return (
|
||||
<div
|
||||
onClick={onClick}
|
||||
@@ -269,7 +278,7 @@ function NodeCard({ node, isCenter, onClick, isSelected, connections }: NodeCard
|
||||
key={tag.id}
|
||||
className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium"
|
||||
style={{
|
||||
backgroundColor: tag.color || "#6B7280",
|
||||
backgroundColor: tag.color ?? "#6B7280",
|
||||
color: "#FFFFFF",
|
||||
}}
|
||||
>
|
||||
@@ -294,7 +303,10 @@ function NodeCard({ node, isCenter, onClick, isSelected, connections }: NodeCard
|
||||
);
|
||||
}
|
||||
|
||||
function getNodeConnections(nodeId: string, edges: GraphEdge[]) {
|
||||
function getNodeConnections(
|
||||
nodeId: string,
|
||||
edges: GraphEdge[]
|
||||
): { incoming: number; outgoing: number } {
|
||||
const incoming = edges.filter((e) => e.targetId === nodeId).length;
|
||||
const outgoing = edges.filter((e) => e.sourceId === nodeId).length;
|
||||
return { incoming, outgoing };
|
||||
|
||||
Reference in New Issue
Block a user