diff --git a/.eslintrc.js b/.eslintrc.js index d9d3e4c27..bfe0404a6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -113,7 +113,7 @@ module.exports = { "error", { "noOptionalParamNames": true } ], - "jsdoc/require-throws": "error", + "jsdoc/require-throws": "warn", "jsdoc/require-jsdoc": [ "error", { @@ -124,19 +124,20 @@ module.exports = { } ], "jsdoc/no-blank-block-descriptions": "error", + "jsdoc/require-returns-description": "warn", "jsdoc/require-returns-check": [ "error", { "reportMissingReturnForUndefinedTypes": false } ], "jsdoc/require-returns": [ - "error", + "warn", { "forceRequireReturn": true, "forceReturnsWithAsync": true } ], - "jsdoc/require-param-type": "error", - "jsdoc/require-param-description": "error" + "jsdoc/require-param-type": "warn", + "jsdoc/require-param-description": "warn" }, "overrides": [ { diff --git a/server/database.js b/server/database.js index e9df008ed..c2617a0da 100644 --- a/server/database.js +++ b/server/database.js @@ -133,6 +133,9 @@ class Database { log.info("db", `Data Dir: ${Database.dataDir}`); } + /** + * + */ static readDBConfig() { let dbConfig; @@ -149,6 +152,9 @@ class Database { return dbConfig; } + /** + * @param dbConfig + */ static writeDBConfig(dbConfig) { fs.writeFileSync(path.join(Database.dataDir, "db-config.json"), JSON.stringify(dbConfig, null, 4)); } @@ -276,6 +282,10 @@ class Database { } } + /** + * @param testMode + * @param noLog + */ static async initSQLite(testMode, noLog) { await R.exec("PRAGMA foreign_keys = ON"); if (testMode) { @@ -301,6 +311,9 @@ class Database { } } + /** + * + */ static async initMariaDB() { log.debug("db", "Checking if MariaDB database exists..."); @@ -337,7 +350,6 @@ class Database { } /** - * * @returns {Promise} */ static async rollbackLatestPatch() { @@ -628,6 +640,9 @@ class Database { await R.exec("VACUUM"); } + /** + * + */ static sqlHourOffset() { if (this.dbConfig.client === "sqlite3") { return "DATETIME('now', ? || ' hours')"; diff --git a/server/embedded-mariadb.js b/server/embedded-mariadb.js index 8f82e64d5..d6395db44 100644 --- a/server/embedded-mariadb.js +++ b/server/embedded-mariadb.js @@ -24,7 +24,6 @@ class EmbeddedMariaDB { started = false; /** - * * @returns {EmbeddedMariaDB} */ static getInstance() { @@ -34,6 +33,9 @@ class EmbeddedMariaDB { return EmbeddedMariaDB.instance; } + /** + * + */ static hasInstance() { return !!EmbeddedMariaDB.instance; } @@ -100,6 +102,9 @@ class EmbeddedMariaDB { }); } + /** + * + */ stop() { if (this.childProcess) { this.childProcess.kill("SIGINT"); @@ -107,6 +112,9 @@ class EmbeddedMariaDB { } } + /** + * + */ initDB() { if (!fs.existsSync(this.mariadbDataDir)) { log.info("mariadb", `Embedded MariaDB: ${this.mariadbDataDir} is not found, create one now.`); @@ -137,6 +145,9 @@ class EmbeddedMariaDB { } + /** + * + */ async initDBAfterStarted() { const connection = mysql.createConnection({ socketPath: this.socketPath, diff --git a/server/model/monitor.js b/server/model/monitor.js index fccc4fcb7..577a55cdb 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -291,6 +291,9 @@ class Monitor extends BeanModel { return JSON.parse(this.accepted_statuscodes_json); } + /** + * + */ getGameDigGivenPortOnly() { return Boolean(this.gamedigGivenPortOnly); } diff --git a/server/setup-database.js b/server/setup-database.js index e28adf39a..43f5c3c4e 100644 --- a/server/setup-database.js +++ b/server/setup-database.js @@ -23,6 +23,10 @@ class SetupDatabase { server; + /** + * @param args + * @param server + */ constructor(args, server) { this.server = server; @@ -72,10 +76,17 @@ class SetupDatabase { return this.needSetup; } + /** + * + */ isEnabledEmbeddedMariaDB() { return process.env.UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB === "1"; } + /** + * @param hostname + * @param port + */ start(hostname, port) { return new Promise((resolve) => { const app = express(); diff --git a/src/components/HeartbeatBar.vue b/src/components/HeartbeatBar.vue index 376d88aba..d7069ffd8 100644 --- a/src/components/HeartbeatBar.vue +++ b/src/components/HeartbeatBar.vue @@ -68,8 +68,7 @@ export default { /** * Calculates the amount of beats of padding needed to fill the length of shortBeatList. - * - * @return {number} The amount of beats of padding needed to fill the length of shortBeatList. + * @returns {number} The amount of beats of padding needed to fill the length of shortBeatList. */ numPadding() { if (!this.beatList) { @@ -149,7 +148,7 @@ export default { /** * Returns the style object for positioning the time element. - * @return {Object} The style object containing the CSS properties for positioning the time element. + * @returns {object} The style object containing the CSS properties for positioning the time element. */ timeStyle() { return { @@ -159,8 +158,7 @@ export default { /** * Calculates the time elapsed since the first valid beat. - * - * @return {string} The time elapsed in minutes or hours. + * @returns {string} The time elapsed in minutes or hours. */ timeSinceFirstBeat() { const firstValidBeat = this.shortBeatList.at(this.numPadding); @@ -174,8 +172,7 @@ export default { /** * Calculates the elapsed time since the last valid beat was registered. - * - * @return {string} The elapsed time in a minutes, hours or "now". + * @returns {string} The elapsed time in a minutes, hours or "now". */ timeSinceLastBeat() { const lastValidBeat = this.shortBeatList.at(-1); diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index e5cac1a33..d66bbe6c1 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -120,8 +120,7 @@ export default { /** * Returns a sorted list of monitors based on the applied filters and search text. - * - * @return {Array} The sorted list of monitors. + * @returns {Array} The sorted list of monitors. */ sortedMonitorList() { let result = Object.values(this.$root.monitorList); @@ -222,8 +221,7 @@ export default { /** * Determines if any filters are active. - * - * @return {boolean} True if any filter is active, false otherwise. + * @returns {boolean} True if any filter is active, false otherwise. */ filtersActive() { return this.filterState.status != null || this.filterState.active != null || this.filterState.tags != null || this.searchText !== "";