mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Change some jsdoc rule to warn instead of error
This commit is contained in:
parent
d33b4f46e4
commit
db3a7d69fe
7 changed files with 53 additions and 17 deletions
|
@ -113,7 +113,7 @@ module.exports = {
|
||||||
"error",
|
"error",
|
||||||
{ "noOptionalParamNames": true }
|
{ "noOptionalParamNames": true }
|
||||||
],
|
],
|
||||||
"jsdoc/require-throws": "error",
|
"jsdoc/require-throws": "warn",
|
||||||
"jsdoc/require-jsdoc": [
|
"jsdoc/require-jsdoc": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -124,19 +124,20 @@ module.exports = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"jsdoc/no-blank-block-descriptions": "error",
|
"jsdoc/no-blank-block-descriptions": "error",
|
||||||
|
"jsdoc/require-returns-description": "warn",
|
||||||
"jsdoc/require-returns-check": [
|
"jsdoc/require-returns-check": [
|
||||||
"error",
|
"error",
|
||||||
{ "reportMissingReturnForUndefinedTypes": false }
|
{ "reportMissingReturnForUndefinedTypes": false }
|
||||||
],
|
],
|
||||||
"jsdoc/require-returns": [
|
"jsdoc/require-returns": [
|
||||||
"error",
|
"warn",
|
||||||
{
|
{
|
||||||
"forceRequireReturn": true,
|
"forceRequireReturn": true,
|
||||||
"forceReturnsWithAsync": true
|
"forceReturnsWithAsync": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"jsdoc/require-param-type": "error",
|
"jsdoc/require-param-type": "warn",
|
||||||
"jsdoc/require-param-description": "error"
|
"jsdoc/require-param-description": "warn"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,9 @@ class Database {
|
||||||
log.info("db", `Data Dir: ${Database.dataDir}`);
|
log.info("db", `Data Dir: ${Database.dataDir}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
static readDBConfig() {
|
static readDBConfig() {
|
||||||
let dbConfig;
|
let dbConfig;
|
||||||
|
|
||||||
|
@ -149,6 +152,9 @@ class Database {
|
||||||
return dbConfig;
|
return dbConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dbConfig
|
||||||
|
*/
|
||||||
static writeDBConfig(dbConfig) {
|
static writeDBConfig(dbConfig) {
|
||||||
fs.writeFileSync(path.join(Database.dataDir, "db-config.json"), JSON.stringify(dbConfig, null, 4));
|
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) {
|
static async initSQLite(testMode, noLog) {
|
||||||
await R.exec("PRAGMA foreign_keys = ON");
|
await R.exec("PRAGMA foreign_keys = ON");
|
||||||
if (testMode) {
|
if (testMode) {
|
||||||
|
@ -301,6 +311,9 @@ class Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
static async initMariaDB() {
|
static async initMariaDB() {
|
||||||
log.debug("db", "Checking if MariaDB database exists...");
|
log.debug("db", "Checking if MariaDB database exists...");
|
||||||
|
|
||||||
|
@ -337,7 +350,6 @@ class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async rollbackLatestPatch() {
|
static async rollbackLatestPatch() {
|
||||||
|
@ -628,6 +640,9 @@ class Database {
|
||||||
await R.exec("VACUUM");
|
await R.exec("VACUUM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
static sqlHourOffset() {
|
static sqlHourOffset() {
|
||||||
if (this.dbConfig.client === "sqlite3") {
|
if (this.dbConfig.client === "sqlite3") {
|
||||||
return "DATETIME('now', ? || ' hours')";
|
return "DATETIME('now', ? || ' hours')";
|
||||||
|
|
|
@ -24,7 +24,6 @@ class EmbeddedMariaDB {
|
||||||
started = false;
|
started = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @returns {EmbeddedMariaDB}
|
* @returns {EmbeddedMariaDB}
|
||||||
*/
|
*/
|
||||||
static getInstance() {
|
static getInstance() {
|
||||||
|
@ -34,6 +33,9 @@ class EmbeddedMariaDB {
|
||||||
return EmbeddedMariaDB.instance;
|
return EmbeddedMariaDB.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
static hasInstance() {
|
static hasInstance() {
|
||||||
return !!EmbeddedMariaDB.instance;
|
return !!EmbeddedMariaDB.instance;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +102,9 @@ class EmbeddedMariaDB {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
stop() {
|
stop() {
|
||||||
if (this.childProcess) {
|
if (this.childProcess) {
|
||||||
this.childProcess.kill("SIGINT");
|
this.childProcess.kill("SIGINT");
|
||||||
|
@ -107,6 +112,9 @@ class EmbeddedMariaDB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
initDB() {
|
initDB() {
|
||||||
if (!fs.existsSync(this.mariadbDataDir)) {
|
if (!fs.existsSync(this.mariadbDataDir)) {
|
||||||
log.info("mariadb", `Embedded MariaDB: ${this.mariadbDataDir} is not found, create one now.`);
|
log.info("mariadb", `Embedded MariaDB: ${this.mariadbDataDir} is not found, create one now.`);
|
||||||
|
@ -137,6 +145,9 @@ class EmbeddedMariaDB {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
async initDBAfterStarted() {
|
async initDBAfterStarted() {
|
||||||
const connection = mysql.createConnection({
|
const connection = mysql.createConnection({
|
||||||
socketPath: this.socketPath,
|
socketPath: this.socketPath,
|
||||||
|
|
|
@ -291,6 +291,9 @@ class Monitor extends BeanModel {
|
||||||
return JSON.parse(this.accepted_statuscodes_json);
|
return JSON.parse(this.accepted_statuscodes_json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
getGameDigGivenPortOnly() {
|
getGameDigGivenPortOnly() {
|
||||||
return Boolean(this.gamedigGivenPortOnly);
|
return Boolean(this.gamedigGivenPortOnly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ class SetupDatabase {
|
||||||
|
|
||||||
server;
|
server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
* @param server
|
||||||
|
*/
|
||||||
constructor(args, server) {
|
constructor(args, server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
@ -72,10 +76,17 @@ class SetupDatabase {
|
||||||
return this.needSetup;
|
return this.needSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
isEnabledEmbeddedMariaDB() {
|
isEnabledEmbeddedMariaDB() {
|
||||||
return process.env.UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB === "1";
|
return process.env.UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB === "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hostname
|
||||||
|
* @param port
|
||||||
|
*/
|
||||||
start(hostname, port) {
|
start(hostname, port) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
|
@ -68,8 +68,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the amount of beats of padding needed to fill the length of shortBeatList.
|
* Calculates 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.
|
||||||
* @return {number} The amount of beats of padding needed to fill the length of shortBeatList.
|
|
||||||
*/
|
*/
|
||||||
numPadding() {
|
numPadding() {
|
||||||
if (!this.beatList) {
|
if (!this.beatList) {
|
||||||
|
@ -149,7 +148,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the style object for positioning the time element.
|
* 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() {
|
timeStyle() {
|
||||||
return {
|
return {
|
||||||
|
@ -159,8 +158,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the time elapsed since the first valid beat.
|
* Calculates the time elapsed since the first valid beat.
|
||||||
*
|
* @returns {string} The time elapsed in minutes or hours.
|
||||||
* @return {string} The time elapsed in minutes or hours.
|
|
||||||
*/
|
*/
|
||||||
timeSinceFirstBeat() {
|
timeSinceFirstBeat() {
|
||||||
const firstValidBeat = this.shortBeatList.at(this.numPadding);
|
const firstValidBeat = this.shortBeatList.at(this.numPadding);
|
||||||
|
@ -174,8 +172,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the elapsed time since the last valid beat was registered.
|
* Calculates the elapsed time since the last valid beat was registered.
|
||||||
*
|
* @returns {string} The elapsed time in a minutes, hours or "now".
|
||||||
* @return {string} The elapsed time in a minutes, hours or "now".
|
|
||||||
*/
|
*/
|
||||||
timeSinceLastBeat() {
|
timeSinceLastBeat() {
|
||||||
const lastValidBeat = this.shortBeatList.at(-1);
|
const lastValidBeat = this.shortBeatList.at(-1);
|
||||||
|
|
|
@ -120,8 +120,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a sorted list of monitors based on the applied filters and search text.
|
* Returns a sorted list of monitors based on the applied filters and search text.
|
||||||
*
|
* @returns {Array} The sorted list of monitors.
|
||||||
* @return {Array} The sorted list of monitors.
|
|
||||||
*/
|
*/
|
||||||
sortedMonitorList() {
|
sortedMonitorList() {
|
||||||
let result = Object.values(this.$root.monitorList);
|
let result = Object.values(this.$root.monitorList);
|
||||||
|
@ -222,8 +221,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if any filters are active.
|
* Determines if any filters are active.
|
||||||
*
|
* @returns {boolean} True if any filter is active, false otherwise.
|
||||||
* @return {boolean} True if any filter is active, false otherwise.
|
|
||||||
*/
|
*/
|
||||||
filtersActive() {
|
filtersActive() {
|
||||||
return this.filterState.status != null || this.filterState.active != null || this.filterState.tags != null || this.searchText !== "";
|
return this.filterState.status != null || this.filterState.active != null || this.filterState.tags != null || this.searchText !== "";
|
||||||
|
|
Loading…
Reference in a new issue