Linting fixes.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,11 +11,11 @@ export interface ActiveBodyshopQueryResult {
|
||||
}>;
|
||||
}
|
||||
// No variables needed for this query
|
||||
interface ActiveBodyshopQueryVariables {}
|
||||
|
||||
// Transform the string query into a TypedQueryDocumentNode
|
||||
export const QUERY_ACTIVE_BODYSHOP_TYPED: TypedQueryDocumentNode<
|
||||
ActiveBodyshopQueryResult,
|
||||
ActiveBodyshopQueryVariables
|
||||
Record<never, never>
|
||||
> = parse(gql`
|
||||
query QUERY_ACTIVE_BODYSHOP {
|
||||
bodyshops(where: { associations: { active: { _eq: true } } }) {
|
||||
@@ -24,10 +24,7 @@ export const QUERY_ACTIVE_BODYSHOP_TYPED: TypedQueryDocumentNode<
|
||||
region_config
|
||||
}
|
||||
}
|
||||
`) as TypedQueryDocumentNode<
|
||||
ActiveBodyshopQueryResult,
|
||||
ActiveBodyshopQueryVariables
|
||||
>;
|
||||
`) as TypedQueryDocumentNode<ActiveBodyshopQueryResult, Record<never, never>>;
|
||||
|
||||
export interface MasterdataQueryResult {
|
||||
masterdata: Array<{
|
||||
|
||||
@@ -2,15 +2,17 @@ import cors from "cors";
|
||||
import { app } from "electron";
|
||||
import log from "electron-log/main";
|
||||
import express from "express";
|
||||
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
|
||||
import http from "http";
|
||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
|
||||
|
||||
export default class LocalServer {
|
||||
private app: express.Application;
|
||||
private server: any;
|
||||
private server: http.Server | null;
|
||||
private PORT = 1337;
|
||||
|
||||
constructor() {
|
||||
this.server = null;
|
||||
this.app = express();
|
||||
this.configureMiddleware();
|
||||
this.configureRoutes();
|
||||
@@ -96,10 +98,10 @@ export default class LocalServer {
|
||||
|
||||
private configureRoutes(): void {
|
||||
// Basic health check endpoint
|
||||
this.app.get("/health", (req: express.Request, res: express.Response) => {
|
||||
this.app.get("/health", (_req: express.Request, res: express.Response) => {
|
||||
res.status(200).json({ status: "ok" });
|
||||
});
|
||||
this.app.post("/ping", (req, res) => {
|
||||
this.app.post("/ping", (_req, res) => {
|
||||
res.status(200).json({
|
||||
appVer: app.getVersion(),
|
||||
qbPath: app.getPath("userData"), //TODO: Resolve to actual QB file path.
|
||||
@@ -112,9 +114,11 @@ export default class LocalServer {
|
||||
|
||||
public start(): void {
|
||||
try {
|
||||
this.server = this.app.listen(this.PORT, (error: Error) => {
|
||||
this.server = this.app.listen(this.PORT, (error: Error | undefined) => {
|
||||
if (error) {
|
||||
log.error(`[HTTP Server] Error starting server: ${error}`);
|
||||
log.error(
|
||||
`[HTTP Server] Error starting server: ${errorTypeCheck(error)}`,
|
||||
);
|
||||
} else {
|
||||
log.info(
|
||||
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
removeWatcherPath,
|
||||
StartWatcher,
|
||||
StopWatcher,
|
||||
watcher,
|
||||
} from "../watcher/watcher";
|
||||
|
||||
const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
||||
@@ -31,7 +30,7 @@ const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
||||
return Store.get("settings.filepaths");
|
||||
};
|
||||
const SettingsWatchedFilePathsRemove = async (
|
||||
event: IpcMainInvokeEvent,
|
||||
_event: IpcMainInvokeEvent,
|
||||
path: string,
|
||||
): Promise<string[]> => {
|
||||
Store.set(
|
||||
@@ -56,7 +55,7 @@ const SettingsWatcherPollingGet = async (): Promise<{
|
||||
return { enabled: pollingEnabled.enabled, interval: pollingEnabled.interval };
|
||||
};
|
||||
const SettingsWatcherPollingSet = async (
|
||||
event: IpcMainInvokeEvent,
|
||||
_event: IpcMainInvokeEvent,
|
||||
pollingSettings: {
|
||||
enabled: boolean;
|
||||
interval: number;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import log from "electron-log/main";
|
||||
|
||||
import { Request, Response } from "express";
|
||||
import { UUID } from "crypto";
|
||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
import { Request, Response } from "express";
|
||||
import _ from "lodash";
|
||||
import store from "../store/store";
|
||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
|
||||
|
||||
if (process.platform === "win32") {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
Winax = require("winax");
|
||||
}
|
||||
|
||||
@@ -99,11 +100,11 @@ export function TestQB(): void {
|
||||
let requestProcessor, ticket;
|
||||
try {
|
||||
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
||||
const connection = requestProcessor.OpenConnection("", "ShopPartnerOneoFf");
|
||||
requestProcessor.OpenConnection("", "ShopPartnerOneoFf");
|
||||
|
||||
ticket = requestProcessor.BeginSession("", 2); //2 indicated qbFileOFpenModeDoNotCare
|
||||
ticket = requestProcessor.BeginSession("", 2); //2 indicated qbFileOOpenModeDoNotCare
|
||||
|
||||
const qbre = requestProcessor.ProcessRequest(
|
||||
requestProcessor.ProcessRequest(
|
||||
ticket,
|
||||
`<?qbxml version="16.0"?>
|
||||
<QBXML>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable react/prop-types */
|
||||
//TODO: remove eslint-disable
|
||||
import { Button, Result } from "antd";
|
||||
import { FallbackProps } from "react-error-boundary";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { auth } from "@renderer/util/firebase";
|
||||
import type { FormProps } from "antd";
|
||||
import { Alert, Button, Checkbox, Form, Input } from "antd";
|
||||
import { Alert, Button, Form, Input } from "antd";
|
||||
import log from "electron-log/renderer";
|
||||
import { signInWithEmailAndPassword } from "firebase/auth";
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//Set up all of the IPC handlers.
|
||||
import {
|
||||
selectWatcherPolling,
|
||||
setWatcherPolling,
|
||||
updateAvailable,
|
||||
updateChecking,
|
||||
@@ -19,40 +18,29 @@ const dispatch = store.dispatch;
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.test,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
(_event: Electron.IpcRendererEvent, arg) => {
|
||||
console.log("Received test message from main process");
|
||||
console.log(arg);
|
||||
},
|
||||
);
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.user.getToken,
|
||||
async (event: Electron.IpcRendererEvent, arg) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.user.getToken, async () => {
|
||||
const token = await auth.currentUser?.getIdToken();
|
||||
ipcRenderer.send(ipcTypes.toMain.user.getTokenResponse, token);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.watcher.started,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.watcher.started, () => {
|
||||
console.log("Watcher has started");
|
||||
console.log(arg);
|
||||
dispatch(watcherStarted());
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.watcher.stopped,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.watcher.stopped, () => {
|
||||
console.log("Watcher has stopped");
|
||||
console.log(arg);
|
||||
dispatch(watcherStopped());
|
||||
},
|
||||
);
|
||||
});
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.watcher.error,
|
||||
(event: Electron.IpcRendererEvent, error: string) => {
|
||||
(_event: Electron.IpcRendererEvent, error: string) => {
|
||||
console.log("Watcher has encountered an error");
|
||||
console.log(error);
|
||||
dispatch(watcherError(error));
|
||||
@@ -60,33 +48,29 @@ ipcRenderer.on(
|
||||
);
|
||||
|
||||
//Update Handlers
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.updates.checking,
|
||||
(event: Electron.IpcRendererEvent) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.updates.checking, () => {
|
||||
console.log("Checking for updates...");
|
||||
dispatch(updateChecking());
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.updates.available,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.updates.available, () => {
|
||||
dispatch(updateAvailable());
|
||||
},
|
||||
);
|
||||
});
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.updates.downloading,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
(_event: Electron.IpcRendererEvent, arg) => {
|
||||
dispatch(updateProgress({ progress: arg.progress, speed: arg.speed }));
|
||||
},
|
||||
);
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.updates.downloaded,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
ipcRenderer.on(ipcTypes.toRenderer.updates.downloaded, () => {
|
||||
dispatch(updateDownloaded());
|
||||
});
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.watcher.polling,
|
||||
(_event: Electron.IpcRendererEvent, arg) => {
|
||||
dispatch(
|
||||
setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
ipcRenderer.on(ipcTypes.toRenderer.watcher.polling, (event, arg) => {
|
||||
dispatch(setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }));
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// eslint-disable-all
|
||||
import { createContext, useContext } from "react";
|
||||
import { notification } from "antd";
|
||||
|
||||
@@ -10,6 +11,7 @@ const NotificationContext = createContext(null);
|
||||
/**
|
||||
* A custom hook to make usage easier in child components.
|
||||
*/
|
||||
// eslint-disable-next-line react-refresh/only-export-components, @typescript-eslint/explicit-function-return-type
|
||||
export const useNotification = () => {
|
||||
return useContext(NotificationContext);
|
||||
};
|
||||
@@ -20,7 +22,14 @@ export const useNotification = () => {
|
||||
* - Render contextHolder somewhere high-level in your app (so the notifications mount properly).
|
||||
* - Provide `api` via the NotificationContext.
|
||||
*/
|
||||
export const NotificationProvider = ({ children }) => {
|
||||
interface NotificationProviderProps {
|
||||
children?: React.ReactNode | React.ReactNode[];
|
||||
}
|
||||
|
||||
export const NotificationProvider: React.FC<NotificationProviderProps> = ({
|
||||
// eslint-disable-next-line react/prop-types
|
||||
children, //TODO: Unable to resolve this. Adding an eslint disable.
|
||||
}) => {
|
||||
const [api, contextHolder] = notification.useNotification({
|
||||
placement: "bottomRight",
|
||||
bottom: 70,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/**
|
||||
* Casts specified properties of an object to the desired types
|
||||
* Casts specified properties of an object to the desired types by specifying keys and their corresponding desired type.
|
||||
*
|
||||
* @param obj The object whose properties need to be cast
|
||||
* @param typeMappings An object where keys are property names from the source object
|
||||
|
||||
Reference in New Issue
Block a user