From 1e595eaa76cf35bdb8e8be24c56ede595dd1f38a Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Tue, 26 Apr 2022 01:26:57 +0200 Subject: [PATCH] Update linters --- .eslintrc.js | 1 + package.json | 12 +++---- server/database.js | 2 +- server/prometheus.js | 2 +- server/proxy.js | 2 +- server/server.js | 17 ++------- server/util-server.js | 2 +- src/components/Datetime.vue | 2 +- src/components/MonitorList.vue | 10 ++---- src/components/PingChart.vue | 10 +++--- src/components/Tag.vue | 21 +++++------ src/components/TagsManager.vue | 66 ++++++++++++++++++---------------- src/pages/EditMonitor.vue | 9 +++-- 13 files changed, 72 insertions(+), 84 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 38a16e64d..4713799d7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -48,6 +48,7 @@ module.exports = { "vue/html-self-closing": "off", "vue/require-component-is": "off", // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675 "vue/attribute-hyphenation": "off", // This change noNL to "no-n-l" unexpectedly + "vue/multi-word-component-names": "off", "no-multi-spaces": [ "error", { ignoreEOLComments: true, }], diff --git a/package.json b/package.json index 8a8bd1ebd..3096dfdb0 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ }, "devDependencies": { "@actions/github": "~5.0.1", - "@babel/eslint-parser": "~7.15.8", + "@babel/eslint-parser": "~7.17.0", "@babel/preset-env": "^7.15.8", "@types/bootstrap": "~5.1.9", "@vitejs/plugin-legacy": "~1.6.4", @@ -135,16 +135,16 @@ "core-js": "~3.18.3", "cross-env": "~7.0.3", "dns2": "~2.0.1", - "eslint": "~7.32.0", - "eslint-plugin-vue": "~7.18.0", + "eslint": "~8.14.0", + "eslint-plugin-vue": "~8.7.1", "jest": "~27.2.5", "jest-puppeteer": "~6.0.3", - "npm-check-updates": "^12.5.5", + "npm-check-updates": "^12.5.9", "postcss-html": "^1.3.1", "puppeteer": "~13.1.3", "sass": "~1.42.1", - "stylelint": "~14.2.0", - "stylelint-config-standard": "~24.0.0", + "stylelint": "~14.7.1", + "stylelint-config-standard": "~25.0.0", "typescript": "~4.4.4", "vite": "~2.6.14", "wait-on": "^6.0.1" diff --git a/server/database.js b/server/database.js index 099d15d56..6ed11c3b9 100644 --- a/server/database.js +++ b/server/database.js @@ -58,7 +58,7 @@ class Database { "patch-monitor-expiry-notification.sql": true, "patch-status-page-footer-css.sql": true, "patch-added-mqtt-monitor.sql": true, - } + }; /** * The final version should be 10 after merged tag feature diff --git a/server/prometheus.js b/server/prometheus.js index fe0896f61..9bf623fbe 100644 --- a/server/prometheus.js +++ b/server/prometheus.js @@ -33,7 +33,7 @@ const monitorStatus = new PrometheusClient.Gauge({ }); class Prometheus { - monitorLabelValues = {} + monitorLabelValues = {}; constructor(monitor) { this.monitorLabelValues = { diff --git a/server/proxy.js b/server/proxy.js index 621f24d06..22c63b39a 100644 --- a/server/proxy.js +++ b/server/proxy.js @@ -7,7 +7,7 @@ const { UptimeKumaServer } = require("./uptime-kuma-server"); class Proxy { - static SUPPORTED_PROXY_PROTOCOLS = [ "http", "https", "socks", "socks5", "socks4" ] + static SUPPORTED_PROXY_PROTOCOLS = [ "http", "https", "socks", "socks5", "socks4" ]; /** * Saves and updates given proxy entity diff --git a/server/server.js b/server/server.js index 7bee52521..4bd0b4810 100644 --- a/server/server.js +++ b/server/server.js @@ -136,13 +136,6 @@ app.use(function (req, res, next) { next(); }); -/** - * Total WebSocket client connected to server currently, no actual use - * - * @type {number} - */ -let totalClient = 0; - /** * Use for decode the auth object * @type {null} @@ -248,17 +241,11 @@ try { sendInfo(socket); - totalClient++; - if (needSetup) { log.info("server", "Redirect to setup page"); socket.emit("setup"); } - socket.on("disconnect", () => { - totalClient--; - }); - // *************************** // Public Socket API // *************************** @@ -1228,7 +1215,7 @@ try { for (let i = 0; i < monitorListData.length; i++) { // Only starts importing the monitor if the import option is "overwrite", "keep" or "skip" but the notification doesn't exists - if ((importHandle == "skip" && monitorNameListString.includes(monitorListData[i].name) == false) || importHandle == "keep" || importHandle == "overwrite") { + if ((importHandle === "skip" && monitorNameListString.includes(monitorListData[i].name) === false) || importHandle === "keep" || importHandle === "overwrite") { // Define in here every new variable for monitors which where implemented after the first version of the Import/Export function (1.6.0) // --- Start --- @@ -1325,7 +1312,7 @@ try { await updateMonitorNotification(bean.id, notificationIDList); // If monitor was active start it immediately, otherwise pause it - if (monitorListData[i].active == 1) { + if (monitorListData[i].active === 1) { await startMonitor(socket.userID, bean.id); } else { await pauseMonitor(socket.userID, bean.id); diff --git a/server/util-server.js b/server/util-server.js index 7a9d3e7d1..edbad5892 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -132,7 +132,7 @@ exports.mqttAsync = function (hostname, topic, okMessage, options = {}) { }); client.on("message", (messageTopic, message) => { - if (messageTopic == topic) { + if (messageTopic === topic) { client.end(); clearTimeout(timeoutID); if (okMessage != null && okMessage !== "" && message.toString() !== okMessage) { diff --git a/src/components/Datetime.vue b/src/components/Datetime.vue index 8662e6d8a..ed38c434d 100644 --- a/src/components/Datetime.vue +++ b/src/components/Datetime.vue @@ -5,8 +5,8 @@