From b75db276581bc9c22590e60e290ff71e65941336 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 15 Dec 2022 13:57:28 +0800 Subject: [PATCH] Fix lint --- server/model/monitor.js | 1 - server/modules/dayjs/plugin/timezone.js | 6 +++- src/modules/dayjs/constant.js | 46 ++++++++++++------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index ba0b3e83d..1cb562412 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -16,7 +16,6 @@ const { CacheableDnsHttpAgent } = require("../cacheable-dns-http-agent"); const { DockerHost } = require("../docker"); const Maintenance = require("./maintenance"); const { UptimeCacheList } = require("../uptime-cache-list"); -const zlib = require("zlib"); /** * status: diff --git a/server/modules/dayjs/plugin/timezone.js b/server/modules/dayjs/plugin/timezone.js index 894a59570..de709ae4b 100644 --- a/server/modules/dayjs/plugin/timezone.js +++ b/server/modules/dayjs/plugin/timezone.js @@ -5,6 +5,7 @@ * License: MIT */ !function (t, e) { + // eslint-disable-next-line no-undef typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs_plugin_timezone = e(); }(this, (function () { "use strict"; @@ -42,7 +43,10 @@ return r.formatToParts(o); }; let u = function (e, n) { - for (var i = a(e, n), r = [], u = 0; u < i.length; u += 1) { + let i = a(e, n); + let r = []; + let u = 0; + for (; u < i.length; u += 1) { let f = i[u]; let s = f.type; let m = f.value; diff --git a/src/modules/dayjs/constant.js b/src/modules/dayjs/constant.js index 02ffe1bce..741a623b7 100644 --- a/src/modules/dayjs/constant.js +++ b/src/modules/dayjs/constant.js @@ -1,25 +1,25 @@ -export var SECONDS_A_MINUTE = 60; -export var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60; -export var SECONDS_A_DAY = SECONDS_A_HOUR * 24; -export var SECONDS_A_WEEK = SECONDS_A_DAY * 7; -export var MILLISECONDS_A_SECOND = 1e3; -export var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND; -export var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND; -export var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND; -export var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales +export let SECONDS_A_MINUTE = 60; +export let SECONDS_A_HOUR = SECONDS_A_MINUTE * 60; +export let SECONDS_A_DAY = SECONDS_A_HOUR * 24; +export let SECONDS_A_WEEK = SECONDS_A_DAY * 7; +export let MILLISECONDS_A_SECOND = 1e3; +export let MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND; +export let MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND; +export let MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND; +export let MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales -export var MS = 'millisecond'; -export var S = 'second'; -export var MIN = 'minute'; -export var H = 'hour'; -export var D = 'day'; -export var W = 'week'; -export var M = 'month'; -export var Q = 'quarter'; -export var Y = 'year'; -export var DATE = 'date'; -export var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ'; -export var INVALID_DATE_STRING = 'Invalid Date'; // regex +export let MS = "millisecond"; +export let S = "second"; +export let MIN = "minute"; +export let H = "hour"; +export let D = "day"; +export let W = "week"; +export let M = "month"; +export let Q = "quarter"; +export let Y = "year"; +export let DATE = "date"; +export let FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ssZ"; +export let INVALID_DATE_STRING = "Invalid Date"; // regex -export var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; -export var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; \ No newline at end of file +export let REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; +export let REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;