Misc linting fixes.

This commit is contained in:
Patrick Fic
2025-03-19 13:52:49 -07:00
parent 3277af73f6
commit e67309ed4d
12 changed files with 36 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
export interface DecodedTtl { export interface DecodedTtl {
clm_total: number; clm_total: number;
depreciation_taxes: number; depreciation_taxes: number;
cieca_ttl: DecodedTtlLine; cieca_ttl: { data: DecodedTtlLine };
} }
export interface DecodedTtlLine { export interface DecodedTtlLine {

View File

@@ -47,6 +47,10 @@ const DecodeTtl = async (
//Apply business logic transfomrations. //Apply business logic transfomrations.
return { clm_total: 0, depreciation_taxes: 0, cieca_ttl: rawTtlData }; return {
clm_total: 0,
depreciation_taxes: 0,
cieca_ttl: { data: rawTtlData },
};
}; };
export default DecodeTtl; export default DecodeTtl;

View File

@@ -45,7 +45,8 @@ async function ImportJob(filepath: string): Promise<void> {
const pfm: DecodedPfm = await DecodePfm(extensionlessFilePath); const pfm: DecodedPfm = await DecodePfm(extensionlessFilePath);
const pfo: DecodedPfo = await DecodePfo(extensionlessFilePath); // TODO: This will be the `cieca_pfo` object const pfo: DecodedPfo = await DecodePfo(extensionlessFilePath); // TODO: This will be the `cieca_pfo` object
const stl: DecodedStl[] = await DecodeStl(extensionlessFilePath); // TODO: This will be the `cieca_stl` object const stl: DecodedStl[] = await DecodeStl(extensionlessFilePath); // TODO: This will be the `cieca_stl` object
const ttl: DecodedTtl = await DecodeTtl(extensionlessFilePath); // const ttl: DecodedTtl = await DecodeTtl(extensionlessFilePath);
log.debug("EMS Object", { log.debug("EMS Object", {
ad1, ad1,
ad2, ad2,

View File

@@ -37,8 +37,8 @@ const logIpcMessages = (): void => {
}); });
}; };
ipcMain.on(ipcTypes.toMain.test, (payload: any) => ipcMain.on(ipcTypes.toMain.test, () =>
console.log("** Verify that ipcMain is loaded and working.", payload) console.log("** Verify that ipcMain is loaded and working.")
); );
//Auth handler //Auth handler
@@ -48,18 +48,15 @@ ipcMain.on(ipcTypes.toMain.authStateChanged, ipcMainHandleAuthStateChanged);
if (import.meta.env.DEV) { if (import.meta.env.DEV) {
log.debug("[IPC Debug Functions] Adding Debug Handlers"); log.debug("[IPC Debug Functions] Adding Debug Handlers");
ipcMain.on( ipcMain.on(ipcTypes.toMain.debug.decodeEstimate, async (): Promise<void> => {
ipcTypes.toMain.debug.decodeEstimate, const relativeEmsFilepath = `_reference/ems/MPI_1/3698420.ENV`;
async (event, payload): Promise<void> => { // Get the app's root directory and create an absolute path
const relativeEmsFilepath = `_reference/ems/MPI_1/3698420.ENV`; const rootDir = app.getAppPath();
// Get the app's root directory and create an absolute path const absoluteFilepath = path.join(rootDir, relativeEmsFilepath);
const rootDir = app.getAppPath();
const absoluteFilepath = path.join(rootDir, relativeEmsFilepath);
log.debug("[IPC Debug Function] Decode test Estimate", absoluteFilepath); log.debug("[IPC Debug Function] Decode test Estimate", absoluteFilepath);
await ImportJob(absoluteFilepath); await ImportJob(absoluteFilepath);
} });
);
} }
//Settings Handlers //Settings Handlers

View File

@@ -3,11 +3,11 @@ import log from "electron-log/main";
import _ from "lodash"; import _ from "lodash";
import Store from "../store/store"; import Store from "../store/store";
const SettingsWatchedFilePathsAdd = async (event: IpcMainInvokeEvent) => { const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
const mainWindow = BrowserWindow.getAllWindows()[0]; //TODO: Filter to only main window once a proper key has been set. const mainWindow = BrowserWindow.getAllWindows()[0]; //TODO: Filter to only main window once a proper key has been set.
if (!mainWindow) { if (!mainWindow) {
log.error("No main window found when trying to open dialog"); log.error("No main window found when trying to open dialog");
return; return [];
} }
const result = await dialog.showOpenDialog(mainWindow, { const result = await dialog.showOpenDialog(mainWindow, {
properties: ["openDirectory"], properties: ["openDirectory"],
@@ -25,7 +25,7 @@ const SettingsWatchedFilePathsAdd = async (event: IpcMainInvokeEvent) => {
const SettingsWatchedFilePathsRemove = async ( const SettingsWatchedFilePathsRemove = async (
event: IpcMainInvokeEvent, event: IpcMainInvokeEvent,
path: string path: string
) => { ): Promise<string[]> => {
Store.set( Store.set(
"settings.filepaths", "settings.filepaths",
_.without(Store.get("settings.filepaths"), path) _.without(Store.get("settings.filepaths"), path)
@@ -34,8 +34,8 @@ const SettingsWatchedFilePathsRemove = async (
return Store.get("settings.filepaths"); return Store.get("settings.filepaths");
}; };
const SettingsWatchedFilePathsGet = async (event: IpcMainInvokeEvent) => { const SettingsWatchedFilePathsGet = async (): Promise<string[]> => {
const filepaths = Store.get("settings.filepaths"); const filepaths: string[] = Store.get("settings.filepaths") || [];
return filepaths; return filepaths;
}; };

View File

@@ -5,7 +5,7 @@ import Store from "../store/store";
const ipcMainHandleAuthStateChanged = async ( const ipcMainHandleAuthStateChanged = async (
event: IpcMainEvent, event: IpcMainEvent,
user: User | null user: User | null
) => { ): Promise<void> => {
Store.set("user", user); Store.set("user", user);
}; };

View File

@@ -9,8 +9,8 @@ import ImportJob from "../decoder/decoder";
let watcher: FSWatcher; let watcher: FSWatcher;
async function StartWatcher(): Promise<boolean> { async function StartWatcher(): Promise<boolean> {
const filePaths = store.get("settings.filepaths") || []; const filePaths: string[] = store.get("settings.filepaths") || [];
log.info("Use polling? ", store.get("settings.polling").enabled);
if (filePaths.length === 0) { if (filePaths.length === 0) {
new Notification({ new Notification({
//TODO: Add Translations //TODO: Add Translations

View File

@@ -12,7 +12,11 @@ const ErrorBoundaryFallback: React.FC<FallbackProps> = ({
status={"500"} status={"500"}
title={t("app.errors.errorboundary")} title={t("app.errors.errorboundary")}
subTitle={error?.message} subTitle={error?.message}
extra={[<Button onClick={resetErrorBoundary}>Try again</Button>]} extra={[
<Button key="try-again" onClick={resetErrorBoundary}>
Try again
</Button>,
]}
/> />
); );
}; };

View File

@@ -5,7 +5,7 @@ import ipcTypes from "../../../../util/ipcTypes.json";
const SettingsWatcher: React.FC = () => { const SettingsWatcher: React.FC = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const handleStart = () => { const handleStart = (): void => {
window.electron.ipcRenderer.send(ipcTypes.toMain.watcher.start); window.electron.ipcRenderer.send(ipcTypes.toMain.watcher.start);
}; };

View File

@@ -5,15 +5,13 @@ import log from "electron-log/renderer";
import { signInWithEmailAndPassword } from "firebase/auth"; import { signInWithEmailAndPassword } from "firebase/auth";
import errorTypeCheck from "../../../../util/errorTypeCheck"; import errorTypeCheck from "../../../../util/errorTypeCheck";
type SignInFormProps = {};
type FieldType = { type FieldType = {
username: string; username: string;
password: string; password: string;
remember?: string; remember?: string;
}; };
const SignInForm: React.FC<SignInFormProps> = ({}) => { const SignInForm: React.FC = () => {
const onFinish: FormProps<FieldType>["onFinish"] = async (values) => { const onFinish: FormProps<FieldType>["onFinish"] = async (values) => {
log.info("Form submitted successfully:", values); log.info("Form submitted successfully:", values);
const { username, password } = values; const { username, password } = values;

View File

@@ -1,5 +1,5 @@
import { initializeApp } from "firebase/app"; import { initializeApp } from "firebase/app";
import { getAuth, updatePassword, updateProfile } from "firebase/auth"; import { getAuth } from "firebase/auth";
// TODO: Replace the following with your app's Firebase project configuration // TODO: Replace the following with your app's Firebase project configuration
const firebaseConfig = JSON.parse(import.meta.env.VITE_FIREBASE_CONFIG); const firebaseConfig = JSON.parse(import.meta.env.VITE_FIREBASE_CONFIG);

View File

@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/** /**
* Deep renames all keys in an object to lowercase * Deep renames all keys in an object to lowercase
* @param obj - The object to transform * @param obj - The object to transform