mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
feat: enhance ESLint configuration and improve component error handling
- Updated ESLint configuration to include support for `.mjs` and `.cjs` file types, adding necessary global variables for Node.js and browser environments. - Introduced a new `vite-env.d.ts` file to define environment variables for Vite, improving type safety. - Refactored error handling in `file-browser-dialog.tsx`, `description-image-dropzone.tsx`, and `feature-image-upload.tsx` to omit error parameters, simplifying the catch blocks. - Removed unused bug report button functionality from the sidebar, streamlining the component structure. - Adjusted various components to improve code readability and maintainability, including updates to type imports and component props. These changes aim to enhance the development experience by improving linting support and simplifying error handling across components.
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
* Centralizes the logic for determining where projects should be created/opened
|
||||
*/
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
import { getHttpApiClient } from "./http-api-client";
|
||||
import { getElectronAPI } from "./electron";
|
||||
import { getItem, setItem } from "./storage";
|
||||
import path from "path";
|
||||
import { getHttpApiClient } from './http-api-client';
|
||||
import { getElectronAPI } from './electron';
|
||||
import { getItem, setItem } from './storage';
|
||||
import path from 'path';
|
||||
|
||||
const LAST_PROJECT_DIR_KEY = "automaker:lastProjectDir";
|
||||
const LAST_PROJECT_DIR_KEY = 'automaker:lastProjectDir';
|
||||
|
||||
/**
|
||||
* Gets the default Documents/Automaker directory path
|
||||
@@ -18,11 +17,11 @@ const LAST_PROJECT_DIR_KEY = "automaker:lastProjectDir";
|
||||
async function getDefaultDocumentsPath(): Promise<string | null> {
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
const documentsPath = await api.getPath("documents");
|
||||
return path.join(documentsPath, "Automaker");
|
||||
const documentsPath = await api.getPath('documents');
|
||||
return path.join(documentsPath, 'Automaker');
|
||||
} catch (error) {
|
||||
if (typeof window !== "undefined" && window.console) {
|
||||
window.console.error("Failed to get documents path:", error);
|
||||
if (typeof window !== 'undefined' && window.console) {
|
||||
window.console.error('Failed to get documents path:', error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -82,8 +81,8 @@ export async function getDefaultWorkspaceDirectory(): Promise<string | null> {
|
||||
const documentsPath = await getDefaultDocumentsPath();
|
||||
return documentsPath;
|
||||
} catch (error) {
|
||||
if (typeof window !== "undefined" && window.console) {
|
||||
window.console.error("Failed to get default workspace directory:", error);
|
||||
if (typeof window !== 'undefined' && window.console) {
|
||||
window.console.error('Failed to get default workspace directory:', error);
|
||||
}
|
||||
|
||||
// On error, try last used dir and Documents
|
||||
|
||||
Reference in New Issue
Block a user