From f84f590f1d55944d4501698c571f236386a6df17 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 24 Jul 2021 09:49:46 +0200 Subject: [PATCH 1/5] Start filling last gaps of jsdoc --- tests/unit/classes/translator_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/classes/translator_spec.js b/tests/unit/classes/translator_spec.js index 2756b41b..09e14f20 100644 --- a/tests/unit/classes/translator_spec.js +++ b/tests/unit/classes/translator_spec.js @@ -68,7 +68,7 @@ describe("Translator", function () { }; /** - * @param Translator + * @param {object} Translator the global Translator object */ function setTranslations(Translator) { Translator.translations = translations; From 3a5052c871eee93cb6e52ad81efe9b6f8c118a09 Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 5 Aug 2021 16:38:57 +0200 Subject: [PATCH 2/5] Final jsdoc comments --- modules/default/weather/providers/smhi.js | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/default/weather/providers/smhi.js b/modules/default/weather/providers/smhi.js index c7155193..244fc1de 100644 --- a/modules/default/weather/providers/smhi.js +++ b/modules/default/weather/providers/smhi.js @@ -102,7 +102,7 @@ WeatherProvider.register("smhi", { * * @param {object} weatherData Weatherdata to convert * @param {object} coordinates Coordinates of the locations of the weather - * @returns {WeatherObject} + * @returns {WeatherObject} The converted weatherdata at the specified location */ convertWeatherDataToObject(weatherData, coordinates) { let currentWeather = new WeatherObject("metric", "metric", "metric"); //Weather data is only for Sweden and nobody in Sweden would use imperial @@ -145,9 +145,9 @@ WeatherProvider.register("smhi", { /** * Takes all of the data points and converts it to one WeatherObject per day. * - * @param allWeatherData - * @param {object} coordinates - * @returns {*[]} + * @param {object[]} allWeatherData Array of weatherdata + * @param {object} coordinates Coordinates of the locations of the weather + * @returns {WeatherObject[]} Array of weatherobjects */ convertWeatherDataGroupedByDay(allWeatherData, coordinates) { let currentWeather; @@ -204,8 +204,8 @@ WeatherProvider.register("smhi", { /** * Checks if the weatherObject is at dayTime. * - * @param weatherObject - * @returns {boolean} + * @param {WeatherObject} weatherObject The weatherObject to look at + * @returns {boolean} true if it is at dayTime */ isDayTime(weatherObject) { return weatherObject.date.isBetween(weatherObject.sunrise, weatherObject.sunset, undefined, "[]"); @@ -235,12 +235,11 @@ WeatherProvider.register("smhi", { }, /** - * Helper method to fetch a property from the returned data set. - * The returned values is an array with always one value in it. + * Helper method to get a property from the returned data set. * - * @param {object} weatherData Weatherdata to fetch from + * @param {object} currentWeatherData Weatherdata to get from * @param {string} name The name of the property - * @returns {unknown} + * @returns {*} The value of the property in the weatherdata */ paramValue(currentWeatherData, name) { return currentWeatherData.parameters.filter((p) => p.name === name).flatMap((p) => p.values)[0]; @@ -251,9 +250,9 @@ WeatherProvider.register("smhi", { * Uses different icons depending if its daytime or nighttime. * SHMI's description of what the numeric value means is the comment after the case. * - * @param input - * @param isDayTime - * @returns {string|string} + * @param {number} input The smhi icon value + * @param {boolean} isDayTime True if the icon should be for daytime, false for nightime + * @returns {string} The icon name for the MagicMirror */ convertWeatherType(input, isDayTime) { switch (input) { From 385c4c32f917434b25b908c0bfff15974c96daaf Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 5 Aug 2021 16:39:14 +0200 Subject: [PATCH 3/5] Update dependencies --- package-lock.json | 32 ++++++++++++++++---------------- package.json | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94e2e4d9..82c8dcbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "express-basic-auth": "^1.2.0", "husky": "^7.0.1", "jest": "^27.0.6", - "jsdom": "^16.6.0", + "jsdom": "^16.7.0", "lodash": "^4.17.21", "nyc": "^15.1.0", "prettier": "^2.3.2", @@ -50,7 +50,7 @@ "node": ">=12" }, "optionalDependencies": { - "electron": "^13.1.7" + "electron": "^13.1.8" } }, "node_modules/@babel/code-frame": { @@ -3243,9 +3243,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "node_modules/electron": { - "version": "13.1.7", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.7.tgz", - "integrity": "sha512-sVfpP/0s6a82FK32LMuEe9L+aWZw15u3uYn9xUJArPjy4OZHteE6yM5871YCNXNiDnoCLQ5eqQWipiVgHsf8nQ==", + "version": "13.1.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.8.tgz", + "integrity": "sha512-ei2ZyyG81zUOlvm5Zxri668TdH5GNLY0wF+XrC2FRCqa8AABAPjJIWTRkhFEr/H6PDVPNZjMPvSs3XhHyVVk2g==", "devOptional": true, "hasInstallScript": true, "dependencies": { @@ -6012,9 +6012,9 @@ } }, "node_modules/jsdom": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", - "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", + "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", "dev": true, "dependencies": { "abab": "^2.0.5", @@ -6042,7 +6042,7 @@ "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", "whatwg-url": "^8.5.0", - "ws": "^7.4.5", + "ws": "^7.4.6", "xml-name-validator": "^3.0.0" }, "engines": { @@ -12916,9 +12916,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron": { - "version": "13.1.7", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.7.tgz", - "integrity": "sha512-sVfpP/0s6a82FK32LMuEe9L+aWZw15u3uYn9xUJArPjy4OZHteE6yM5871YCNXNiDnoCLQ5eqQWipiVgHsf8nQ==", + "version": "13.1.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.8.tgz", + "integrity": "sha512-ei2ZyyG81zUOlvm5Zxri668TdH5GNLY0wF+XrC2FRCqa8AABAPjJIWTRkhFEr/H6PDVPNZjMPvSs3XhHyVVk2g==", "devOptional": true, "requires": { "@electron/get": "^1.0.1", @@ -14994,9 +14994,9 @@ "dev": true }, "jsdom": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", - "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", + "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", "dev": true, "requires": { "abab": "^2.0.5", @@ -15024,7 +15024,7 @@ "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", "whatwg-url": "^8.5.0", - "ws": "^7.4.5", + "ws": "^7.4.6", "xml-name-validator": "^3.0.0" }, "dependencies": { diff --git a/package.json b/package.json index 9f51c5d8..cfc834cb 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "express-basic-auth": "^1.2.0", "husky": "^7.0.1", "jest": "^27.0.6", - "jsdom": "^16.6.0", + "jsdom": "^16.7.0", "lodash": "^4.17.21", "nyc": "^15.1.0", "prettier": "^2.3.2", @@ -65,7 +65,7 @@ "stylelint-prettier": "^1.2.0" }, "optionalDependencies": { - "electron": "^13.1.7" + "electron": "^13.1.8" }, "dependencies": { "colors": "^1.4.0", From 3d19a08cc7f2d33eec2568f45c1ba7b477bd868e Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 5 Aug 2021 16:40:49 +0200 Subject: [PATCH 4/5] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b6404c..b6e7ba29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ _This release is scheduled to be released on 2021-10-01._ - Refactor test configs, use default test config for all tests. - Updated github templates. - Actually test all js and css files when lint script is run. +- Update jsdocs and print warnings during testing too ### Fixed From 490151267ad19f1d18cf13f3c7031d08cee3fb7a Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 5 Aug 2021 16:41:10 +0200 Subject: [PATCH 5/5] Print warnings about jsdoc during testing too --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cfc834cb..cec44b26 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "test:e2e": "NODE_ENV=test jest --selectProjects e2e -i --forceExit", "test:unit": "NODE_ENV=test jest --selectProjects unit -i --forceExit", "test:prettier": "prettier . --check", - "test:js": "eslint 'js/**/*.js' 'modules/default/**/*.js' 'clientonly/*.js' 'serveronly/*.js' 'translations/*.js' 'vendor/*.js' 'tests/**/*.js' 'config/*' --config .eslintrc.json --quiet", + "test:js": "eslint 'js/**/*.js' 'modules/default/**/*.js' 'clientonly/*.js' 'serveronly/*.js' 'translations/*.js' 'vendor/*.js' 'tests/**/*.js' 'config/*' --config .eslintrc.json", "test:css": "stylelint 'css/main.css' 'fonts/*.css' 'modules/default/**/*.css' 'vendor/*.css' --config .stylelintrc.json", "test:calendar": "node ./modules/default/calendar/debug.js", "config:check": "node js/check_config.js",