mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 05:55:45 +08:00
Added JSDoc to ESLint (#3529)
* Added JSDoc to eslint rules Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> * Fixed JSDoc eslint errors Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> * Update the check-linters workflow to Node.js 20 --------- Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { localeDirection, currentLocale } from "./i18n";
|
||||
|
||||
/**
|
||||
* Returns the offset from UTC in hours for the current locale.
|
||||
* @param {string} timeZone Timezone to get offset for
|
||||
* @returns {number} The offset from UTC in hours.
|
||||
*
|
||||
* Generated by Trelent
|
||||
@@ -20,12 +21,11 @@ function getTimezoneOffset(timeZone) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of timezones sorted by their offset from UTC.
|
||||
* @param {Object[]} timezones An array of timezone objects.
|
||||
* @returns {Object[]} A list of the given timezones sorted by their offset from UTC.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
* Returns a list of timezones sorted by their offset from UTC.
|
||||
* @returns {object[]} A list of the given timezones sorted by their offset from UTC.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
export function timezoneList() {
|
||||
let result = [];
|
||||
|
||||
@@ -58,7 +58,10 @@ export function timezoneList() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Set the locale of the HTML page */
|
||||
/**
|
||||
* Set the locale of the HTML page
|
||||
* @returns {void}
|
||||
*/
|
||||
export function setPageLocale() {
|
||||
const html = document.documentElement;
|
||||
html.setAttribute("lang", currentLocale() );
|
||||
@@ -68,7 +71,7 @@ export function setPageLocale() {
|
||||
/**
|
||||
* Get the base URL
|
||||
* Mainly used for dev, because the backend and the frontend are in different ports.
|
||||
* @returns {string}
|
||||
* @returns {string} Base URL
|
||||
*/
|
||||
export function getResBaseURL() {
|
||||
const env = process.env.NODE_ENV;
|
||||
@@ -81,6 +84,10 @@ export function getResBaseURL() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Are we currently running in a dev container?
|
||||
* @returns {boolean} Running in dev container?
|
||||
*/
|
||||
export function isDevContainer() {
|
||||
// eslint-disable-next-line no-undef
|
||||
return (typeof DEVCONTAINER === "string" && DEVCONTAINER === "1");
|
||||
@@ -88,6 +95,7 @@ export function isDevContainer() {
|
||||
|
||||
/**
|
||||
* Supports GitHub Codespaces only currently
|
||||
* @returns {string} Dev container server hostname
|
||||
*/
|
||||
export function getDevContainerServerHostname() {
|
||||
if (!isDevContainer()) {
|
||||
@@ -99,9 +107,10 @@ export function getDevContainerServerHostname() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {} mqtt wheather or not the regex should take into account the fact that it is an mqtt uri
|
||||
* @returns RegExp The requested regex
|
||||
* Regex pattern fr identifying hostnames and IP addresses
|
||||
* @param {boolean} mqtt whether or not the regex should take into
|
||||
* account the fact that it is an mqtt uri
|
||||
* @returns {RegExp} The requested regex
|
||||
*/
|
||||
export function hostNameRegexPattern(mqtt = false) {
|
||||
// mqtt, mqtts, ws and wss schemes accepted by mqtt.js (https://github.com/mqttjs/MQTT.js/#connect)
|
||||
@@ -117,7 +126,8 @@ export function hostNameRegexPattern(mqtt = false) {
|
||||
/**
|
||||
* Get the tag color options
|
||||
* Shared between components
|
||||
* @returns {Object[]}
|
||||
* @param {any} self Component
|
||||
* @returns {object[]} Colour options
|
||||
*/
|
||||
export function colorOptions(self) {
|
||||
return [
|
||||
|
Reference in New Issue
Block a user