diff --git a/eslint.config.mjs b/eslint.config.mjs index 33e2a550..a22a0dc6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,6 +3,7 @@ import globals from "globals"; import {flatConfigs as importX} from "eslint-plugin-import-x"; import jest from "eslint-plugin-jest"; import js from "@eslint/js"; +import jsdoc from "eslint-plugin-jsdoc"; import packageJson from "eslint-plugin-package-json"; import stylistic from "@stylistic/eslint-plugin"; @@ -22,8 +23,8 @@ export default defineConfig([ moment: "readonly" } }, - plugins: {js, stylistic}, - extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", "stylistic/all"], + plugins: {js, jsdoc, stylistic}, + extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", jsdoc.configs["flat/recommended"], "stylistic/all"], rules: { "@stylistic/array-element-newline": ["error", "consistent"], "@stylistic/arrow-parens": ["error", "always"], diff --git a/js/check_config.js b/js/check_config.js index d159d9f4..50cf4f44 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -72,6 +72,10 @@ function checkConfigFile () { } } +/** + * + * @param {string} configFileName - The path and filename of the configuration file to validate. + */ function validateModulePositions (configFileName) { Log.info("Checking modules structure configuration ..."); diff --git a/modules/default/calendar/calendarfetcherutils.js b/modules/default/calendar/calendarfetcherutils.js index df567af4..e5f5ce2e 100644 --- a/modules/default/calendar/calendarfetcherutils.js +++ b/modules/default/calendar/calendarfetcherutils.js @@ -502,10 +502,10 @@ const CalendarFetcherUtils = { }, /** - * fixup thew event fields that have dates to use local time - * BEFORE calling rrule.between - * @param the event being processed - * @returns nothing + * Fixes the event fields that have dates to use local time + * before calling rrule.between. + * @param {object} event - The event being processed. + * @returns {void} */ fixEventtoLocal (event) { // if there are excluded dates, their date is incorrect and possibly key as well. @@ -542,9 +542,9 @@ const CalendarFetcherUtils = { /** * convert a UTC date to local time * BEFORE calling rrule.between - * @param date ti conert - * tz event is currently in - * @returns updated date object + * @param {Date} date The date to convert + * @param {string} tz The timezone string to convert the date to. + * @returns {Date} updated date object */ convertDateToLocalTime (date, tz) { let delta_tz_offset = 0; @@ -585,8 +585,8 @@ const CalendarFetcherUtils = { /** * get the exdate/recurrence hash key from the date object * BEFORE calling rrule.between - * @param the date of the event - * @returns string date key YYYY-MM-DD + * @param {Date} date The date of the event + * @returns {string} date key in the format YYYY-MM-DD */ getDateKeyFromDate (date) { // get our runtime timezone offset @@ -611,9 +611,8 @@ const CalendarFetcherUtils = { /** * get the timezone offset from the timezone string - * - * @param the timezone string - * @returns the numerical offset + * @param {string} timeZone The timezone string + * @returns {number} The numerical offset in minutes from UTC. */ getTimezoneOffsetFromTimezone (timeZone) { const str = new Date().toLocaleString("en", { timeZone, timeZoneName: "longOffset" }); @@ -624,10 +623,10 @@ const CalendarFetcherUtils = { /** * fixup the date start moment after rrule.between returns date array - * - * @param date object from rrule.between results + * @param {Date} date object from rrule.between results * the event object it came from - * @returns moment object + * @param {object} event - The event object it came from. + * @returns {Moment} moment object */ getAdjustedStartMoment (date, event) { diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 2907439d..1e8cadfe 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -181,6 +181,7 @@ Module.register("newsfeed", { * Gets a feed property by name * @param {object} feed A feed object. * @param {string} property The name of the property. + * @returns {*} The value of the specified property for the feed. */ getFeedProperty (feed, property) { let res = this.config[property]; diff --git a/modules/default/utils.js b/modules/default/utils.js index 12d9b36a..2d6e43ab 100644 --- a/modules/default/utils.js +++ b/modules/default/utils.js @@ -5,7 +5,7 @@ * @param {boolean} useCorsProxy A flag to indicate * @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send * @param {Array.} expectedResponseHeaders the expected HTTP headers to receive - * @param {string} basePath, default / + * @param {string} basePath The base path, default is "/" * @returns {Promise} resolved when the fetch is done. The response headers is placed in a headers-property (provided the response does not already contain a headers-property). */ async function performWebRequest (url, type = "json", useCorsProxy = false, requestHeaders = undefined, expectedResponseHeaders = undefined, basePath = "/") { @@ -38,7 +38,7 @@ async function performWebRequest (url, type = "json", useCorsProxy = false, requ * @param {string} url the url to fetch from * @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send * @param {Array.} expectedResponseHeaders the expected HTTP headers to receive - * @param {string} basePath, default / + * @param {string} basePath The base path, default is "/" * @returns {string} to be used as URL when calling CORS-method on server. */ const getCorsUrl = function (url, requestHeaders, expectedResponseHeaders, basePath = "/") { diff --git a/tests/electron/modules/compliments_spec.js b/tests/electron/modules/compliments_spec.js index 1cb23914..50332b0b 100644 --- a/tests/electron/modules/compliments_spec.js +++ b/tests/electron/modules/compliments_spec.js @@ -5,6 +5,7 @@ describe("Compliments module", () => { /** * move similar tests in function doTest * @param {Array} complimentsArray The array of compliments. + * @param {string} state The state of the element (e.g., "visible" or "attached"). * @returns {boolean} result */ const doTest = async (complimentsArray, state = "visible") => {