Fix all linting and type errors

- Remove unused imports (Badge, PullRequestCheck)
- Fix React Hook dependency warnings by using useCallback
- Replace 'any' types with proper TypeScript interfaces
- Fix unused variable errors by prefixing with underscore
- Remove placeholder comments
- Consolidate duplicate type definitions at module level
- Add proper type definitions for API responses
- Fix const vs let issues
This commit is contained in:
shakespeare.diy committed 2025-10-15 01:53:35 -05:00
1 parent 67aea6a3b2
commit 1c4b1e6263
11 files changed
+343 -96

No files matched your search

+11 -12
View File
@@ -51,7 +51,6 @@ export function PullRequestForm({ projectId, currentBranch, remoteUrl }: PullReq
const [description, setDescription] = useState('');
const [targetBranch, setTargetBranch] = useState('main');
const [remoteBranches, setRemoteBranches] = useState<string[]>([]);
const [isLoadingBranches, setIsLoadingBranches] = useState(false);
const [isCreating, setIsCreating] = useState(false);
const [remoteInfo, setRemoteInfo] = useState<RemoteInfo | null>(null);
const [forkInfo, setForkInfo] = useState<ForkInfo>({ needsFork: false });
@@ -68,15 +67,7 @@ export function PullRequestForm({ projectId, currentBranch, remoteUrl }: PullReq
// (parseRemoteUrl, checkPushPermissions, ensureFork, etc.)
// For brevity, I'll import them or duplicate the core logic
useEffect(() => {
if (remoteUrl) {
parseRemoteUrl(remoteUrl);
loadRemoteBranches();
checkPermissionsAndFork();
}
}, [remoteUrl]);
const parseRemoteUrl = (url: string) => {
const parseRemoteUrl = useCallback((url: string) => {
// Same implementation as PullRequestDialog
setError(null);
try {
@@ -118,7 +109,7 @@ export function PullRequestForm({ projectId, currentBranch, remoteUrl }: PullReq
} catch (err) {
setError('Failed to parse remote URL');
}
};
}, []);
const loadRemoteBranches = useCallback(async () => {
setIsLoadingBranches(true);
@@ -164,6 +155,14 @@ export function PullRequestForm({ projectId, currentBranch, remoteUrl }: PullReq
}
}, [remoteInfo, remoteUrl, settings.credentials]);
useEffect(() => {
if (remoteUrl) {
parseRemoteUrl(remoteUrl);
loadRemoteBranches();
checkPermissionsAndFork();
}
}, [remoteUrl, parseRemoteUrl, loadRemoteBranches, checkPermissionsAndFork]);
const createPullRequest = async () => {
if (!remoteInfo || !currentBranch) return;
@@ -343,7 +342,7 @@ export function PullRequestForm({ projectId, currentBranch, remoteUrl }: PullReq
let errorMessage = error.message || `API error: ${response.status} - ${response.statusText}`;
if (error.errors && Array.isArray(error.errors)) {
const errorDetails = error.errors.map((e: any) => {
const errorDetails = error.errors.map((e: { message?: string; field?: string; code?: string }) => {
if (e.message) return e.message;
if (e.field && e.code) return `${e.field}: ${e.code}`;
return JSON.stringify(e);