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 {
clm_total: number;
depreciation_taxes: number;
cieca_ttl: DecodedTtlLine;
cieca_ttl: { data: DecodedTtlLine };
}
export interface DecodedTtlLine {

View File

@@ -47,6 +47,10 @@ const DecodeTtl = async (
//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;

View File

@@ -45,7 +45,8 @@ async function ImportJob(filepath: string): Promise<void> {
const pfm: DecodedPfm = await DecodePfm(extensionlessFilePath);
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 ttl: DecodedTtl = await DecodeTtl(extensionlessFilePath); //
const ttl: DecodedTtl = await DecodeTtl(extensionlessFilePath);
log.debug("EMS Object", {
ad1,
ad2,

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,7 +12,11 @@ const ErrorBoundaryFallback: React.FC<FallbackProps> = ({
status={"500"}
title={t("app.errors.errorboundary")}
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 { t } = useTranslation();
const handleStart = () => {
const handleStart = (): void => {
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 errorTypeCheck from "../../../../util/errorTypeCheck";
type SignInFormProps = {};
type FieldType = {
username: string;
password: string;
remember?: string;
};
const SignInForm: React.FC<SignInFormProps> = ({}) => {
const SignInForm: React.FC = () => {
const onFinish: FormProps<FieldType>["onFinish"] = async (values) => {
log.info("Form submitted successfully:", values);
const { username, password } = values;

View File

@@ -1,5 +1,5 @@
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
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
* @param obj - The object to transform