Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/frontend-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
- name: Check formatting with Prettier
run: npm run format:check

- name: Run ESLint
- name: Run ESLint (fails on warnings)
run: npm run lint
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/ --max-warnings=0",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx src/ --fix",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,json}\"",
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,json}\""
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/FileDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { RepositoryData, File } from '../types/schema';
import { RepositoryData, Component } from '../types/schema';

interface FileDetailsProps {
fileId: string;
Expand Down Expand Up @@ -32,7 +32,7 @@ const FileDetails: React.FC<FileDetailsProps> = ({ fileId, data, onClose }) => {
};

// Render a component and its children
const renderComponent = (component: any, depth = 0) => {
const renderComponent = (component: Component, depth = 0) => {
return (
<div key={component.id} className="ml-4">
<div className="font-medium">
Expand All @@ -45,7 +45,7 @@ const FileDetails: React.FC<FileDetailsProps> = ({ fileId, data, onClose }) => {
)}
{component.components && component.components.length > 0 && (
<div className="ml-4 mt-2 border-l-2 border-gray-200 pl-2">
{component.components.map((subComp: any) => renderComponent(subComp, depth + 1))}
{component.components.map((subComp: Component) => renderComponent(subComp, depth + 1))}
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const FileUpload: React.FC<FileUploadProps> = ({ onDataLoaded, onLoadExample })
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = e => resolve(e.target?.result as string);
reader.onerror = e => reject(new Error('Failed to read file'));
reader.onerror = () => reject(new Error('Failed to read file'));
reader.readAsText(file);
});
};
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Visualization/RepositoryGraph.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
import * as d3 from 'd3';
import { RepositoryData, File } from '../../types/schema';
import { RepositoryData } from '../../types/schema';

interface RepositoryGraphProps {
data: RepositoryData;
Expand Down Expand Up @@ -179,10 +179,10 @@ const RepositoryGraph = forwardRef<RepositoryGraphHandle, RepositoryGraphProps>(
.attr('stroke', '#fff')
.attr('stroke-width', 1.5)
.style('cursor', 'pointer')
.on('mouseover', function (event, d) {
.on('mouseover', function () {
d3.select(this).attr('stroke-width', 3);
})
.on('mouseout', function (event, d) {
.on('mouseout', function (_event, d) {
d3.select(this).attr('stroke-width', d.id === selectedFile ? 3 : 1.5);
})
.on('click', (event, d) => {
Expand Down Expand Up @@ -399,4 +399,5 @@ const RepositoryGraph = forwardRef<RepositoryGraphHandle, RepositoryGraphProps>(
}
);

RepositoryGraph.displayName = 'RepositoryGraph';
export default RepositoryGraph;
10 changes: 5 additions & 5 deletions frontend/src/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface RepositoryData {
files: File[];
relationships: Relationship[];
history?: History;
customData?: Record<string, any>;
customData?: Record<string, unknown>;
}

export interface Metadata {
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface FileMetrics {
linesOfCode?: number;
commentLines?: number;
emptyLines?: number;
custom?: Record<string, any>;
custom?: Record<string, unknown>;
}

export interface Component {
Expand All @@ -57,15 +57,15 @@ export interface Component {
export interface ComponentMetrics {
complexity?: number;
linesOfCode?: number;
custom?: Record<string, any>;
custom?: Record<string, unknown>;
}

export interface Relationship {
source: string;
target: string;
type: string;
strength?: number;
metadata?: Record<string, any>;
metadata?: Record<string, unknown>;
}

export interface FileChange {
Expand All @@ -85,7 +85,7 @@ export interface Commit {

export interface TimelinePoint {
commitId: string;
state: Record<string, any>;
state: Record<string, unknown>;
snapshot: {
files?: File[];
relationships?: Relationship[];
Expand Down