Skip to content

Commit

Permalink
Update eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Feb 20, 2022
1 parent 74d254d commit 78fdcd6
Show file tree
Hide file tree
Showing 14 changed files with 4,632 additions and 8,063 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
es2021: true,
node: true,
},
extends: ["standard", "prettier", "plugin:node/recommended"],
extends: ["standard", "eslint:recommended", "plugin:node/recommended", "plugin:promise/recommended", "plugin:prettier/recommended"],
plugins: ["prettier"],
ignorePatterns: ["/node_modules/*", "/dist/*", "/build/*", "/src/*"],
parserOptions: {
Expand All @@ -23,13 +23,18 @@ module.exports = {
"prefer-const": ["warn"],
"prefer-arrow-callback": ["error"],
"prefer-template": ["error"],
"node/no-unpublished-require": ["off"],
"func-style": ["error"],
"no-var": ["error"],
"no-unused-vars": ["off"],
"no-undef": ["off"],
"no-case-declarations": ["off"],
"node/no-unpublished-require": ["off"],
"node/no-missing-require": ["warn"],
"node/no-extraneous-require": ["off"],
"node/no-unsupported-features/node-builtins": ["off"],
"node/no-callback-literal": ["off"],
"promise/no-nesting": ["off"],
"promise/always-return": ["off"],
"promise/catch-or-return": ["off"],
},
}
34 changes: 16 additions & 18 deletions app/application/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "application", error: error })
ipc.send("rendererError", { renderer: "application", error })
}

/**
Expand Down Expand Up @@ -640,7 +640,7 @@ const loadCodes = async () => {
key = Buffer.from(aes.generateKey(password, Buffer.from(storage.key, "base64")))
}

fs.readFile(path.join(folder_path, "codes", "codes.authme"), (err, content) => {
fs.readFile(path.join(folder_path, "codes", "codes.authme"), async (err, content) => {
if (err) {
logger.warn("The file codes.authme don't exists")

Expand All @@ -660,21 +660,19 @@ const loadCodes = async () => {
password.fill(0)
key.fill(0)
} else {
dialog
.showMessageBox({
title: "Authme",
buttons: [lang.button.close, lang.application_dialog.guide],
defaultId: 0,
cancelId: 0,
type: "error",
noLink: true,
message: "The saved codes are only compatible with Authme 2. \n\nPlease read the migration guide!",
})
.then((result) => {
if (result.response === 1) {
shell.openExternal("https://docs.authme.levminer.com/migration")
}
})
const result = await dialog.showMessageBox({
title: "Authme",
buttons: [lang.button.close, lang.application_dialog.guide],
defaultId: 0,
cancelId: 0,
type: "error",
noLink: true,
message: "The saved codes are only compatible with Authme 2. \n\nPlease read the migration guide!",
})

if (result.response === 1) {
shell.openExternal("https://docs.authme.levminer.com/migration")
}
}
}
})
Expand Down Expand Up @@ -885,7 +883,7 @@ const infoBar = async () => {
const bar_link = document.querySelector(".barLink")
const info_bar = document.querySelector(".infoBar")

if (opens % 5 === 0) {
if (opens % 4 === 0) {
switch (random) {
case 0:
info_bar.style.display = "flex"
Expand Down
2 changes: 1 addition & 1 deletion app/confirm/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "confirm", error: error })
ipc.send("rendererError", { renderer: "confirm", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/edit/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "edit", error: error })
ipc.send("rendererError", { renderer: "edit", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/export/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "export", error: error })
ipc.send("rendererError", { renderer: "export", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/import/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { gaImport, gaCamera } = require(path.join(__dirname, "src", "js", "ga.js"
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "import", error: error })
ipc.send("rendererError", { renderer: "import", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/landing/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "landing", error: error })
ipc.send("rendererError", { renderer: "landing", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/settings/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require("fs")
* Send error to main process
*/
window.onerror = (error) => {
ipc.send("rendererError", { renderer: "settings", error: error })
ipc.send("rendererError", { renderer: "settings", error })
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/base32.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const base32 = {
31: "7",
}

if (typeof input == "undefined" || input == null) {
if (typeof input === "undefined" || input == null) {
return null
}
const aAscii2 = []
Expand Down
20 changes: 10 additions & 10 deletions lib/logger/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = logger = {
* @return {string} log
*/
log: (message, log) => {
if (typeof log == "object") {
if (typeof log === "object") {
log = JSON.stringify(log)
} else if (typeof log === "undefined") {
log = undefined
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = logger = {
* @return {string} log
*/
rendererLog: (id, message, log) => {
if (typeof log == "object") {
if (typeof log === "object") {
log = JSON.stringify(log)
} else if (typeof log === "undefined") {
log = undefined
Expand Down Expand Up @@ -87,9 +87,9 @@ module.exports = logger = {
* @return {string} warn
*/
warn: (message, warn) => {
if (typeof warn == "object") {
if (typeof warn === "object") {
warn = JSON.stringify(warn)
} else if (typeof warn == "undefined") {
} else if (typeof warn === "undefined") {
warn = undefined
}

Expand All @@ -116,9 +116,9 @@ module.exports = logger = {
* @return {string} warn
*/
rendererWarn: (id, message, warn) => {
if (typeof warn == "object") {
if (typeof warn === "object") {
warn = JSON.stringify(warn)
} else if (typeof warn == "undefined") {
} else if (typeof warn === "undefined") {
warn = undefined
}

Expand All @@ -144,9 +144,9 @@ module.exports = logger = {
* @return {string} error
*/
error: (message, error) => {
if (typeof error == "object") {
if (typeof error === "object") {
error = JSON.stringify(error)
} else if (typeof error == "undefined") {
} else if (typeof error === "undefined") {
error = undefined
}

Expand All @@ -173,9 +173,9 @@ module.exports = logger = {
* @return {string} error
*/
rendererError: (id, message, error) => {
if (typeof error == "object") {
if (typeof error === "object") {
error = JSON.stringify(error)
} else if (typeof error == "undefined") {
} else if (typeof error === "undefined") {
error = undefined
}

Expand Down
6 changes: 3 additions & 3 deletions lib/logger/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
log: (message, log) => {
console.log(message)

electron.ipcRenderer.send("loggerLog", { id: window, message: message, log: log })
electron.ipcRenderer.send("loggerLog", { id: window, message, log })
},

/**
Expand All @@ -24,7 +24,7 @@ module.exports = {
warn: (message, warn) => {
console.warn(message)

electron.ipcRenderer.send("loggerWarn", { id: window, message: message, warn: warn })
electron.ipcRenderer.send("loggerWarn", { id: window, message, warn })
},

/**
Expand All @@ -36,7 +36,7 @@ module.exports = {
error: (message, error) => {
console.error(message)

electron.ipcRenderer.send("loggerError", { id: window, message: message, error: error })
electron.ipcRenderer.send("loggerError", { id: window, message, error })
},

/**
Expand Down
Loading

0 comments on commit 78fdcd6

Please sign in to comment.