feat: implement linter with config file

This commit is contained in:
MasterAcnolo
2026-09-13 12:06:33 +02:00
parent 8af5a4a383
commit 58b6637eeb
8 changed files with 1127 additions and 16 deletions

View File

@@ -97,7 +97,7 @@ function startRPC() {
details: `Open Source Download Tools - ${config.version}`, details: `Open Source Download Tools - ${config.version}`,
state: "masteracnolo.github.io/FreedomLoader", state: "masteracnolo.github.io/FreedomLoader",
}; };
rpc.clearActivity() rpc.clearActivity();
rpc.setActivity(presence); rpc.setActivity(presence);
}); });

View File

@@ -118,11 +118,11 @@ function registerIpcHandlers(getMainWindow) {
ipcMain.on("window-minimize", () => { ipcMain.on("window-minimize", () => {
// Minimize to tray // Minimize to tray
if (configFeatures.systemTray) { if (configFeatures.systemTray) {
getMainWindow()?.hide() getMainWindow()?.hide();
logger.info("Window Minimized in SystemTray (Using Minimize Button)"); logger.info("Window Minimized in SystemTray (Using Minimize Button)");
} else { } else {
// Native minimize // Native minimize
getMainWindow()?.minimize() getMainWindow()?.minimize();
logger.info("Window minimized normally"); logger.info("Window minimized normally");
} }
} }
@@ -210,7 +210,7 @@ function registerIpcHandlers(getMainWindow) {
*/ */
ipcMain.handle("send-report", async (_, params) => { ipcMain.handle("send-report", async (_, params) => {
return await sendReport(params); return await sendReport(params);
}) });
/** /**
* Updates a runtime feature flag and persists it to disk. * Updates a runtime feature flag and persists it to disk.

View File

@@ -95,7 +95,7 @@ function createSystemTray(devMode) {
} else { } else {
window.show(); window.show();
window.focus(); window.focus();
logger.info("Window Restored from SystemTray (Double Click on Tray Icon)") logger.info("Window Restored from SystemTray (Double Click on Tray Icon)");
} }
}); });

40
eslint.config.js Normal file
View File

@@ -0,0 +1,40 @@
const js = require("@eslint/js");
const globals = require("globals");
module.exports = [
js.configs.recommended,
{ignores: ["node_modules/**", "srpm-out/**", "dist/**", "test/**"]},
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
},
rules: {
"no-unused-vars": ["error", {argsIgnorePattern: "^_"}],
"no-console": "off",
"semi": ["error", "always"]
},
},
{
files: ["app/**", "server/**", "main.js"],
languageOptions: {
globals: {...globals.node}
}
},
{
files: ["public/**"],
languageOptions: {
globals: {...globals.browser}
}
},
{
files: ["preload.js"],
languageOptions: {
globals: {...globals.node, ...globals.browser}
}
}
];

View File

@@ -48,9 +48,9 @@ const { configFeatures, devMode} = require("./config");
*/ */
if (!configFeatures.enableHardwareAcceleration){ if (!configFeatures.enableHardwareAcceleration){
app.disableHardwareAcceleration(); app.disableHardwareAcceleration();
logger.info("Disabled Hardware Acceleration") logger.info("Disabled Hardware Acceleration");
} else { } else {
logger.info("Enable Hardware Acceleration") logger.info("Enable Hardware Acceleration");
} }
if(devMode){ if(devMode){
@@ -58,8 +58,8 @@ if(devMode){
* Start devTron extensions - @see https://github.com/electron/devtron * Start devTron extensions - @see https://github.com/electron/devtron
*/ */
const { devtron } = require('@electron/devtron'); const { devtron } = require('@electron/devtron');
devtron.install(); devtron.install();
logger.info("Loaded DevTron Extension") logger.info("Loaded DevTron Extension");
} }
/** /**

1077
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,8 @@
"release:dry-run": "bash scripts/release.sh --dry-run", "release:dry-run": "bash scripts/release.sh --dry-run",
"test": "jest", "test": "jest",
"test:unit": "jest test/unit", "test:unit": "jest test/unit",
"lint": "eslint . --format pretty",
"lint:fix": "eslint . --fix --format pretty",
"update": "npm update" "update": "npm update"
}, },
"dependencies": { "dependencies": {
@@ -49,10 +51,14 @@
}, },
"devDependencies": { "devDependencies": {
"@electron/devtron": "^2.1.1", "@electron/devtron": "^2.1.1",
"@eslint/js": "^10.0.1",
"@jest/globals": "^30.4.1", "@jest/globals": "^30.4.1",
"@playwright/test": "^1.62.1", "@playwright/test": "^1.62.1",
"electron": "^44.3.0", "electron": "^44.3.0",
"electron-builder": "^26.15.3", "electron-builder": "^26.15.3",
"eslint": "^10.10.0",
"eslint-formatter-pretty": "^7.1.0",
"globals": "^17.12.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"nodemon": "^3.1.14", "nodemon": "^3.1.14",
"playwright": "^1.62.1" "playwright": "^1.62.1"

View File

@@ -269,7 +269,7 @@ async function init() {
infoDiv.classList.add("visible"); infoDiv.classList.add("visible");
}); });
}) });
} }