Skip to content

Commit

Permalink
build: Add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRatcliffe committed Sep 16, 2024
1 parent e1be629 commit 67e0344
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 184 deletions.
20 changes: 19 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ export default [
2,
{
ignoredNodes: ["TemplateLiteral"],
SwitchCase: 1,
},
],
"@stylistic/js/no-mixed-spaces-and-tabs": ["error"],
"@stylistic/js/semi": ["error", "always"],
"constructor-super": ["error"],
curly: ["error", "all"],
eqeqeq: ["error", "always"],
"for-direction": ["error"],
"getter-return": ["error"],
"no-async-promise-executor": ["error"],
Expand Down Expand Up @@ -116,12 +118,28 @@ export default [
caughtErrorsIgnorePattern: "^_",
},
],
"no-use-before-define": [
"error",
{
functions: false,
classes: true,
variables: true,
allowNamedExports: true,
},
],
"no-useless-backreference": ["error"],
"no-useless-catch": ["error"],
"no-useless-escape": ["error"],
"no-var": ["error"],
"no-with": ["error"],
"prefer-const": ["error"],
"prefer-const": [
"error",
{
destructuring: "all",
},
],
"prefer-regex-literals": ["error"],
"prefer-template": ["error"],
"require-yield": ["error"],
"use-isnan": ["error"],
"valid-typeof": ["error"],
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ global.hash_alg = "sha256";
global.locale = "en-US";

global.platform = global.platform.replace("32", "").replace("64", "");
if (global.platform == "darwin") {
if (global.platform === "darwin") {
global.platform = "mac";
}

Expand Down Expand Up @@ -345,12 +345,12 @@ ipcMain.on("sideload_update", async (event, arg) => {
ipcMain.on("device_tweaks", async (event, arg) => {
console.log("device_tweaks received", arg);

if (arg.cmd == "get") {
if (arg.cmd === "get") {
const res = await tools.deviceTweaksGet(arg);
event.reply("device_tweaks", res);
}

if (arg.cmd == "set") {
if (arg.cmd === "set") {
if (!global.adbDevice) {
console.log("Missing device, sending ask_device");
event.reply("ask_device", "");
Expand Down Expand Up @@ -486,7 +486,7 @@ function createWindow() {
};
win.loadURL(`file://${__dirname}/views/index.twig`);

if (process.argv[2] == "--dev") {
if (process.argv[2] === "--dev") {
win.webContents.openDevTools();
}

Expand Down Expand Up @@ -534,7 +534,7 @@ async function startApp() {

createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length != 0) {
if (BrowserWindow.getAllWindows().length !== 0) {
return;
}
createWindow();
Expand Down
2 changes: 1 addition & 1 deletion removeLocales.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const LOCALES = ["en-US.pak", "ru.pak"];
exports.default = async function (context) {
// console.log(context);
const fs = require("fs");
const localeDir = context.appOutDir + "/locales/";
const localeDir = `${context.appOutDir}/locales/`;

fs.readdir(localeDir, function (err, files) {
//files is array of filenames (basename form)
Expand Down
Loading

0 comments on commit 67e0344

Please sign in to comment.