From f4eae72c489660eb88db9eef79b25b0584c9ff1d Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 13:10:07 +0200 Subject: [PATCH 01/41] Install eslint jsdoc plugin --- .eslintrc.json | 4 +- package-lock.json | 104 ++++++++++++++++++++++++++++++++++++---------- package.json | 3 +- 3 files changed, 86 insertions(+), 25 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6d6839d6..f24799a5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,6 @@ { - "extends": ["eslint:recommended", "plugin:prettier/recommended"], - "plugins": ["prettier"], + "extends": ["eslint:recommended", "plugin:prettier/recommended", "plugin:jsdoc/recommended"], + "plugins": ["prettier", "jsdoc"], "env": { "browser": true, "es6": true, diff --git a/package-lock.json b/package-lock.json index 87374cc7..ebb2fb56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1480,6 +1480,12 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "comment-parser": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.5.tgz", + "integrity": "sha512-iH9YA35ccw94nx5244GVkpyC9eVTsL71jZz6iz5w6RIf79JLF2AsXHXq9p6Oaohyl3sx5qSMnGsWUDFIAfWL4w==", + "dev": true + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2378,9 +2384,9 @@ } }, "eslint": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.4.0.tgz", - "integrity": "sha512-gU+lxhlPHu45H3JkEGgYhWhkR9wLHHEXC9FbWFnTlEkbKyZKWgWRLgf61E8zWmBuI6g5xKBph9ltg3NtZMVF8g==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.5.0.tgz", + "integrity": "sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q==", "requires": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", @@ -2390,9 +2396,9 @@ "doctrine": "^3.0.0", "enquirer": "^2.3.5", "eslint-scope": "^5.1.0", - "eslint-utils": "^2.0.0", - "eslint-visitor-keys": "^1.2.0", - "espree": "^7.1.0", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^1.3.0", + "espree": "^7.2.0", "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -2406,7 +2412,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.14", + "lodash": "^4.17.19", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -2538,9 +2544,9 @@ } }, "strip-json-comments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", - "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" }, "supports-color": { "version": "7.1.0", @@ -2585,6 +2591,48 @@ } } }, + "eslint-plugin-jsdoc": { + "version": "30.0.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.0.3.tgz", + "integrity": "sha512-EviSu0Hgc9Bhz00WhA6829KYC9BaP6JWoycOTA1xFxjQ/2XguRlB3r6nGNA/jkmMDQp5dTQ22s1kAJIaC+dE8Q==", + "dev": true, + "requires": { + "comment-parser": "^0.7.5", + "debug": "^4.1.1", + "jsdoctypeparser": "^8.0.0", + "lodash": "^4.17.15", + "regextras": "^0.7.1", + "semver": "^7.3.2", + "spdx-expression-parse": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + } + } + }, "eslint-plugin-prettier": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", @@ -2617,13 +2665,13 @@ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" }, "espree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.1.0.tgz", - "integrity": "sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz", + "integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==", "requires": { - "acorn": "^7.2.0", + "acorn": "^7.3.1", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.2.0" + "eslint-visitor-keys": "^1.3.0" } }, "esprima": { @@ -3718,11 +3766,11 @@ } }, "iconv-lite": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.1.tgz", - "integrity": "sha512-ONHr16SQvKZNSqjQT9gy5z24Jw+uqfO02/ngBSBoqChZ+W8qXX7GPRa1RoUnzGADw8K63R1BXUMzarCVQBpY8Q==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz", + "integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==", "requires": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "ieee754": { @@ -4188,6 +4236,12 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsdoctypeparser": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-8.0.0.tgz", + "integrity": "sha512-eLCs6s4JqN8TjFJfgdiLHRvogLhOAJz+5RIA2FtoMe6ZDyuvghvppnlIToqAEnVbxRqLMrfnNXpW8FpmR6IMBw==", + "dev": true + }, "jsdom": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", @@ -5210,9 +5264,9 @@ "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" }, "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", + "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" }, "mri": { "version": "1.1.5", @@ -6757,6 +6811,12 @@ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==" }, + "regextras": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.7.1.tgz", + "integrity": "sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==", + "dev": true + }, "release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", diff --git a/package.json b/package.json index 3941f415..f021abce 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "current-week-number": "^1.0.7", "danger": "^3.1.3", "eslint-config-prettier": "^6.11.0", + "eslint-plugin-jsdoc": "^30.0.3", "eslint-plugin-prettier": "^3.1.4", "http-auth": "^3.2.3", "husky": "^4.2.5", @@ -70,7 +71,7 @@ "dependencies": { "colors": "^1.1.2", "console-stamp": "^0.2.9", - "eslint": "^7.4.0", + "eslint": "^7.5.0", "express": "^4.16.2", "express-ipfilter": "^1.0.1", "feedme": "latest", From 43bcf4ab985bcfa4c5eebaa6ec9f16a2804423b9 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 14:24:30 +0200 Subject: [PATCH 02/41] Run eslint over files, see what gets fixed automatically and clean up --- clientonly/index.js | 20 +++++++++++++++++--- js/app.js | 6 +++--- js/check_config.js | 5 ++++- js/class.js | 11 ++++++++--- js/electron.js | 3 +++ js/module.js | 10 ++++++---- js/translator.js | 21 ++++++++++++++------- modules/default/alert/notificationFx.js | 5 +++++ modules/default/calendar/calendar.js | 5 ++--- modules/default/clock/clock.js | 4 ++++ modules/default/weather/weatherprovider.js | 6 ++++++ 11 files changed, 72 insertions(+), 24 deletions(-) diff --git a/clientonly/index.js b/clientonly/index.js index 7d1c4fe3..e42aa186 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -4,10 +4,17 @@ (function () { var config = {}; - // Helper function to get server address/hostname from either the commandline or env + /** + * Helper function to get server address/hostname from either the commandline or env + */ function getServerAddress() { - // Helper function to get command line parameters - // Assumes that a cmdline parameter is defined with `--key [value]` + /** + * Helper function to get command line parameters + * Assumes that a cmdline parameter is defined with `--key [value]` + * + * @param key + * @param defaultValue + */ function getCommandLineParameter(key, defaultValue = undefined) { var index = process.argv.indexOf(`--${key}`); var value = index > -1 ? process.argv[index + 1] : undefined; @@ -23,6 +30,9 @@ config["tls"] = process.argv.indexOf("--use-tls") > 0; } + /** + * @param url + */ function getServerConfig(url) { // Return new pending promise return new Promise((resolve, reject) => { @@ -47,6 +57,10 @@ }); } + /** + * @param message + * @param code + */ function fail(message, code = 1) { if (message !== undefined && typeof message === "string") { console.log(message); diff --git a/js/app.js b/js/app.js index b1fcc9bb..49b3ee85 100644 --- a/js/app.js +++ b/js/app.js @@ -169,11 +169,11 @@ var App = function () { loadNextModule(); }; - /* cmpVersions(a,b) + /** * Compare two semantic version numbers and return the difference. * - * argument a string - Version number a. - * argument a string - Version number b. + * @param {string} a Version number a. + * @param {string} b Version number b. */ function cmpVersions(a, b) { var i, diff; diff --git a/js/check_config.js b/js/check_config.js index cfd56824..64dbbc6e 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -16,7 +16,7 @@ const config = require(rootPath + "/.eslintrc.json"); const Log = require(rootPath + "/js/logger.js"); const Utils = require(rootPath + "/js/utils.js"); -/* getConfigFile() +/** * Return string with path of configuration file * Check if set by environment variable MM_CONFIG_FILE */ @@ -29,6 +29,9 @@ function getConfigFile() { return configFileName; } +/** + * + */ function checkConfigFile() { const configFileName = getConfigFile(); diff --git a/js/class.js b/js/class.js index f52ac405..5dc6fbd0 100644 --- a/js/class.js +++ b/js/class.js @@ -57,7 +57,9 @@ : prop[name]; } - // The dummy class constructor + /** + * The dummy class constructor + */ function Class() { // All construction is actually done in the init method if (!initializing && this.init) { @@ -78,8 +80,11 @@ }; })(); -//Define the clone method for later use. -//Helper Method +/** + * Define the clone method for later use. Helper Method. + * + * @param obj + */ function cloneObject(obj) { if (obj === null || typeof obj !== "object") { return obj; diff --git a/js/electron.js b/js/electron.js index 0978cd0d..216dee48 100644 --- a/js/electron.js +++ b/js/electron.js @@ -15,6 +15,9 @@ const BrowserWindow = electron.BrowserWindow; // be closed automatically when the JavaScript object is garbage collected. let mainWindow; +/** + * + */ function createWindow() { app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required"); var electronOptionsDefaults = { diff --git a/js/module.js b/js/module.js index 4aa26a80..17236b74 100644 --- a/js/module.js +++ b/js/module.js @@ -157,7 +157,7 @@ var Module = Class.extend({ /** nunjucksEnvironment() * Returns the nunjucks environment for the current module. * The environment is checked in the _nunjucksEnvironment instance variable. - + * @returns Nunjucks Environment */ nunjucksEnvironment: function () { @@ -451,11 +451,13 @@ Module.create = function (name) { return new ModuleClass(); }; -/* cmpVersions(a,b) +/** * Compare two semantic version numbers and return the difference. * - * argument a string - Version number a. - * argument a string - Version number b. + * @param {string} a Version number a. + * @param {string} b Version number b. + * + * @returns {number} */ function cmpVersions(a, b) { var i, diff; diff --git a/js/translator.js b/js/translator.js index ee4e1051..aa70a846 100644 --- a/js/translator.js +++ b/js/translator.js @@ -7,11 +7,11 @@ * MIT Licensed. */ var Translator = (function () { - /* loadJSON(file, callback) + /** * Load a JSON file via XHR. * - * argument file string - Path of the file we want to load. - * argument callback function - Function called when done. + * @param {string} file Path of the file we want to load. + * @param {Function} callback Function called when done. */ function loadJSON(file, callback) { var xhr = new XMLHttpRequest(); @@ -41,10 +41,17 @@ var Translator = (function () { translate: function (module, key, variables) { variables = variables || {}; //Empty object by default - // Combines template and variables like: - // template: "Please wait for {timeToWait} before continuing with {work}." - // variables: {timeToWait: "2 hours", work: "painting"} - // to: "Please wait for 2 hours before continuing with painting." + /** + * Combines template and variables like: + * template: "Please wait for {timeToWait} before continuing with {work}." + * variables: {timeToWait: "2 hours", work: "painting"} + * to: "Please wait for 2 hours before continuing with painting." + * + * @param template + * @param variables + * + * @returns {*} + */ function createStringFromTemplate(template, variables) { if (Object.prototype.toString.call(template) !== "[object String]") { return template; diff --git a/modules/default/alert/notificationFx.js b/modules/default/alert/notificationFx.js index 61ba59d7..44b2f01a 100644 --- a/modules/default/alert/notificationFx.js +++ b/modules/default/alert/notificationFx.js @@ -13,6 +13,9 @@ (function (window) { /** * extend obj function + * + * @param a + * @param b */ function extend(a, b) { for (let key in b) { @@ -25,6 +28,8 @@ /** * NotificationFx function + * + * @param options */ function NotificationFx(options) { this.options = extend({}, this.options); diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 06026363..8e9d4ce3 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -556,12 +556,11 @@ Module.register("calendar", { }, /** - * symbolsForEvent(event) * Retrieves the symbols for a specific event. * - * argument event object - Event to look for. + * @param {object} event Event to look for. * - * return array - The Symbols + * @returns {*} array The Symbols */ symbolsForEvent: function (event) { let symbols = this.getCalendarPropertyAsArray(event.url, "symbol", this.config.defaultSymbol); diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index cfcd1e40..8911b7d4 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -152,6 +152,10 @@ Module.register("clock", { timeWrapper.appendChild(periodWrapper); } + /** + * @param config + * @param time + */ function formatTime(config, time) { var formatString = hourSymbol + ":mm"; if (config.showPeriod && config.timeFormat !== 24) { diff --git a/modules/default/weather/weatherprovider.js b/modules/default/weather/weatherprovider.js index cfcb3ef6..22897337 100644 --- a/modules/default/weather/weatherprovider.js +++ b/modules/default/weather/weatherprovider.js @@ -119,6 +119,9 @@ WeatherProvider.providers = []; /** * Static method to register a new weather provider. + * + * @param providerIdentifier + * @param providerDetails */ WeatherProvider.register = function (providerIdentifier, providerDetails) { WeatherProvider.providers[providerIdentifier.toLowerCase()] = WeatherProvider.extend(providerDetails); @@ -126,6 +129,9 @@ WeatherProvider.register = function (providerIdentifier, providerDetails) { /** * Static method to initialize a new weather provider. + * + * @param providerIdentifier + * @param delegate */ WeatherProvider.initialize = function (providerIdentifier, delegate) { providerIdentifier = providerIdentifier.toLowerCase(); From 79f93310739e2029ac8e323608c62a33ce861741 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 14:26:01 +0200 Subject: [PATCH 03/41] Cleanup translator jsdoc --- js/translator.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/js/translator.js b/js/translator.js index aa70a846..e043de39 100644 --- a/js/translator.js +++ b/js/translator.js @@ -31,12 +31,14 @@ var Translator = (function () { translations: {}, translationsFallback: {}, - /* translate(module, key, variables) + /** * Load a translation for a given key for a given module. * - * argument module Module - The module to load the translation for. - * argument key string - The key of the text to translate. - * argument variables - The variables to use within the translation template (optional) + * @param {object} module The module to load the translation for. + * @param {string} key The key of the text to translate. + * @param {object} variables The variables to use within the translation template (optional) + * + * @returns {string} the translated key */ translate: function (module, key, variables) { variables = variables || {}; //Empty object by default @@ -47,10 +49,10 @@ var Translator = (function () { * variables: {timeToWait: "2 hours", work: "painting"} * to: "Please wait for 2 hours before continuing with painting." * - * @param template - * @param variables + * @param {string} template Text with placeholder + * @param {object} variables Variables for the placeholder * - * @returns {*} + * @returns {string} the template filled with the variables */ function createStringFromTemplate(template, variables) { if (Object.prototype.toString.call(template) !== "[object String]") { @@ -87,13 +89,13 @@ var Translator = (function () { return key; }, - /* load(module, file, isFallback, callback) + /** * Load a translation file (json) and remember the data. * - * argument module Module - The module to load the translation file for. - * argument file string - Path of the file we want to load. - * argument isFallback boolean - Flag to indicate fallback translations. - * argument callback function - Function called when done. + * @param {object} module The module to load the translation file for. + * @param {string} file Path of the file we want to load. + * @param {boolean} isFallback Flag to indicate fallback translations. + * @param {Function} callback Function called when done. */ load: function (module, file, isFallback, callback) { if (!isFallback) { @@ -117,10 +119,10 @@ var Translator = (function () { } }, - /* loadCoreTranslations(lang) + /** * Load the core translations. * - * argument lang String - The language identifier of the core language. + * @param {string} lang The language identifier of the core language. */ loadCoreTranslations: function (lang) { var self = this; @@ -137,7 +139,7 @@ var Translator = (function () { self.loadCoreTranslationsFallback(); }, - /* loadCoreTranslationsFallback() + /** * Load the core translations fallback. * The first language defined in translations.js will be used. */ From 5ec51d0cccb08047de79446a581311f88415d4f9 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 20:10:31 +0200 Subject: [PATCH 04/41] Cleanup app jsdoc --- js/app.js | 57 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/js/app.js b/js/app.js index 49b3ee85..52405bec 100644 --- a/js/app.js +++ b/js/app.js @@ -40,16 +40,19 @@ process.on("uncaughtException", function (err) { Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues"); }); -/* App - The core app. +/** + * The core app. + * + * @class */ var App = function () { var nodeHelpers = []; - /* loadConfig(callback) - * Loads the config file. combines it with the defaults, - * and runs the callback with the found config as argument. + /** + * Loads the config file. Combines it with the defaults, and runs the + * callback with the found config as argument. * - * argument callback function - The callback function. + * @param {Function} callback Function to be called after loading the config */ var loadConfig = function (callback) { Log.log("Loading config ..."); @@ -80,6 +83,12 @@ var App = function () { } }; + /** + * Checks the config for deprecated options and throws a warning in the logs + * if it encounters one option from the deprecated.js list + * + * @param {object} userConfig The user config + */ var checkDeprecatedOptions = function (userConfig) { var deprecated = require(global.root_path + "/js/deprecated.js"); var deprecatedOptions = deprecated.configs; @@ -96,10 +105,11 @@ var App = function () { } }; - /* loadModule(module) + /** * Loads a specific module. * - * argument module string - The name of the module (including subpath). + * @param {string} module The name of the module (including subpath). + * @param {Function} callback Function to be called after loading */ var loadModule = function (module, callback) { var elements = module.split("/"); @@ -144,10 +154,11 @@ var App = function () { } }; - /* loadModules(modules) + /** * Loads all modules. * - * argument module string - The name of the module (including subpath). + * @param {Array} modules All modules to be loaded + * @param {Function} callback Function to be called after loading */ var loadModules = function (modules, callback) { Log.log("Loading module helpers ..."); @@ -174,6 +185,9 @@ var App = function () { * * @param {string} a Version number a. * @param {string} b Version number b. + * + * @returns {number} A positive number if a is larger than b, a negative + * number if a is smaller and 0 if they are the same */ function cmpVersions(a, b) { var i, diff; @@ -191,12 +205,13 @@ var App = function () { return segmentsA.length - segmentsB.length; } - /* start(callback) - * This methods starts the core app. - * It loads the config, then it loads all modules. - * When it's done it executes the callback with the config as argument. + /** + * Start the core app. * - * argument callback function - The callback function. + * It loads the config, then it loads all modules. When it's done it + * executes the callback with the config as argument. + * + * @param {Function} callback Function to be called after start */ this.start = function (callback) { loadConfig(function (c) { @@ -234,9 +249,10 @@ var App = function () { }); }; - /* stop() - * This methods stops the core app. - * This calls each node_helper's STOP() function, if it exists. + /** + * Stops the core app. This calls each node_helper's STOP() function, if it + * exists. + * * Added to fix #1056 */ this.stop = function () { @@ -248,7 +264,8 @@ var App = function () { } }; - /* Listen for SIGINT signal and call stop() function. + /** + * Listen for SIGINT signal and call stop() function. * * Added to fix #1056 * Note: this is only used if running `server-only`. Otherwise @@ -263,7 +280,9 @@ var App = function () { process.exit(0); }); - /* We also need to listen to SIGTERM signals so we stop everything when we are asked to stop by the OS. + /** + * Listen to SIGTERM signals so we can stop everything when we + * are asked to stop by the OS. */ process.on("SIGTERM", () => { Log.log("[SIGTERM] Received. Shutting down server..."); From 9888f66c84c0c2d71c546a254c91960fe4e38754 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 20:14:10 +0200 Subject: [PATCH 05/41] Cleanup check_config jsdoc --- js/check_config.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/check_config.js b/js/check_config.js index 64dbbc6e..7ed6ea96 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -17,8 +17,10 @@ const Log = require(rootPath + "/js/logger.js"); const Utils = require(rootPath + "/js/utils.js"); /** - * Return string with path of configuration file + * Returns a string with path of configuration file. * Check if set by environment variable MM_CONFIG_FILE + * + * @returns {string} path and filename of the config file */ function getConfigFile() { // FIXME: This function should be in core. Do you want refactor me ;) ?, be good! @@ -30,7 +32,7 @@ function getConfigFile() { } /** - * + * Checks the config file using eslint. */ function checkConfigFile() { const configFileName = getConfigFile(); @@ -41,7 +43,7 @@ function checkConfigFile() { throw new Error("No config file present!"); } - // check permission + // Check permission try { fs.accessSync(configFileName, fs.F_OK); } catch (e) { From d1e8dded68e5a16928b8e6e1937e148a3e02536d Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 27 Jul 2020 21:39:25 +0200 Subject: [PATCH 06/41] Cleanup class jsdoc --- js/class.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/class.js b/js/class.js index 5dc6fbd0..9c46a894 100644 --- a/js/class.js +++ b/js/class.js @@ -83,7 +83,9 @@ /** * Define the clone method for later use. Helper Method. * - * @param obj + * @param {object} obj Object to be cloned + * + * @returns {object} the cloned object */ function cloneObject(obj) { if (obj === null || typeof obj !== "object") { From 2d5a19b676654ea6de63dcb0d8fbf8c84199853e Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 28 Jul 2020 16:48:03 +0200 Subject: [PATCH 07/41] Cleanup module jsdoc --- js/module.js | 195 ++++++++++++++++++++++++++------------------------- 1 file changed, 101 insertions(+), 94 deletions(-) diff --git a/js/module.js b/js/module.js index 17236b74..7c581a31 100644 --- a/js/module.js +++ b/js/module.js @@ -29,53 +29,56 @@ var Module = Class.extend({ // Use the nunjucksEnvironment() to get it. _nunjucksEnvironment: null, - /* init() - * Is called when the module is instantiated. + /** + * Called when the module is instantiated. */ init: function () { //Log.log(this.defaults); }, - /* start() - * Is called when the module is started. + /** + * Called when the module is started. */ start: function () { Log.info("Starting module: " + this.name); }, - /* getScripts() + /** * Returns a list of scripts the module requires to be loaded. + * return Array - * - * return Array - An array with filenames. + * @returns {*[]} An array with filenames. */ getScripts: function () { return []; }, - /* getStyles() + /** * Returns a list of stylesheets the module requires to be loaded. * - * return Array - An array with filenames. + * @returns {*[]} An array with filenames. */ getStyles: function () { return []; }, - /* getTranslations() + /** * Returns a map of translation files the module requires to be loaded. * - * return Map - A map with langKeys and filenames. + * return Map - + * + * @returns {*} A map with langKeys and filenames. */ getTranslations: function () { return false; }, - /* getDom() - * This method generates the dom which needs to be displayed. This method is called by the Magic Mirror core. + /** + * Generates the dom which needs to be displayed. This method is called by the Magic Mirror core. * This method can to be subclassed if the module wants to display info on the mirror. * Alternatively, the getTemplate method could be subclassed. * - * return DomObject | Promise - The dom or a promise with the dom to display. + * @returns {HTMLElement|Promise} The dom or a promise with the dom to display. */ getDom: function () { var self = this; @@ -105,46 +108,45 @@ var Module = Class.extend({ }); }, - /* getHeader() - * This method generates the header string which needs to be displayed if a user has a header configured for this module. + /** + * Generates the header string which needs to be displayed if a user has a header configured for this module. * This method is called by the Magic Mirror core, but only if the user has configured a default header for the module. * This method needs to be subclassed if the module wants to display modified headers on the mirror. * - * return string - The header to display above the header. + * @returns {string} The header to display above the header. */ getHeader: function () { return this.data.header; }, - /* getTemplate() - * This method returns the template for the module which is used by the default getDom implementation. + /** + * Returns the template for the module which is used by the default getDom implementation. * This method needs to be subclassed if the module wants to use a template. * It can either return a template sting, or a template filename. * If the string ends with '.html' it's considered a file from within the module's folder. * - * return string - The template string of filename. + * @returns {string} The template string of filename. */ getTemplate: function () { return '
' + this.name + '
' + this.identifier + "
"; }, - /* getTemplateData() - * This method returns the data to be used in the template. + /** + * Returns the data to be used in the template. * This method needs to be subclassed if the module wants to use a custom data. * - * return Object + * @returns {object} The data for the template */ getTemplateData: function () { return {}; }, - /* notificationReceived(notification, payload, sender) - * This method is called when a notification arrives. - * This method is called by the Magic Mirror core. + /** + * Called by the Magic Mirror core when a notification arrives. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. - * argument sender Module - The module that sent the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. + * @param {object} sender The module that sent the notification. */ notificationReceived: function (notification, payload, sender) { if (sender) { @@ -154,11 +156,11 @@ var Module = Class.extend({ } }, - /** nunjucksEnvironment() + /** * Returns the nunjucks environment for the current module. * The environment is checked in the _nunjucksEnvironment instance variable. - - * @returns Nunjucks Environment + * + * @returns {object} The Nunjucks Environment */ nunjucksEnvironment: function () { if (this._nunjucksEnvironment !== null) { @@ -171,6 +173,7 @@ var Module = Class.extend({ trimBlocks: true, lstripBlocks: true }); + this._nunjucksEnvironment.addFilter("translate", function (str) { return self.translate(str); }); @@ -178,25 +181,25 @@ var Module = Class.extend({ return this._nunjucksEnvironment; }, - /* socketNotificationReceived(notification, payload) - * This method is called when a socket notification arrives. + /** + * Called when a socket notification arrives. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. */ socketNotificationReceived: function (notification, payload) { Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload); }, - /* suspend() - * This method is called when a module is hidden. + /* + * Called when the module is hidden. */ suspend: function () { Log.log(this.name + " is suspended."); }, - /* resume() - * This method is called when a module is shown. + /* + * Called when the module is shown. */ resume: function () { Log.log(this.name + " is resumed."); @@ -206,10 +209,10 @@ var Module = Class.extend({ * The methods below don"t need subclassing. * *********************************************/ - /* setData(data) + /** * Set the module data. * - * argument data object - Module data. + * @param {object} data The module data */ setData: function (data) { this.data = data; @@ -220,18 +223,20 @@ var Module = Class.extend({ this.setConfig(data.config); }, - /* setConfig(config) + /** * Set the module config and combine it with the module defaults. * - * argument config object - Module config. + * @param {object} config The combined module config. */ setConfig: function (config) { this.config = Object.assign({}, this.defaults, config); }, - /* socket() - * Returns a socket object. If it doesn't exist, it"s created. + /** + * Returns a socket object. If it doesn't exist, it's created. * It also registers the notification callback. + * + * @returns {MMSocket} a socket object */ socket: function () { if (typeof this._socket === "undefined") { @@ -246,40 +251,39 @@ var Module = Class.extend({ return this._socket; }, - /* file(file) + /** * Retrieve the path to a module file. * - * argument file string - Filename. - * - * return string - File path. + * @param {string} file Filename + * @returns {string} the file path */ file: function (file) { return (this.data.path + "/" + file).replace("//", "/"); }, - /* loadStyles() + /** * Load all required stylesheets by requesting the MM object to load the files. * - * argument callback function - Function called when done. + * @param {Function} callback Function called when done. */ loadStyles: function (callback) { this.loadDependencies("getStyles", callback); }, - /* loadScripts() + /** * Load all required scripts by requesting the MM object to load the files. * - * argument callback function - Function called when done. + * @param {Function} callback Function called when done. */ loadScripts: function (callback) { this.loadDependencies("getScripts", callback); }, - /* loadDependencies(funcName, callback) + /** * Helper method to load all dependencies. * - * argument funcName string - Function name to call to get scripts or styles. - * argument callback function - Function called when done. + * @param {string} funcName Function name to call to get scripts or styles. + * @param {Function} callback Function called when done. */ loadDependencies: function (funcName, callback) { var self = this; @@ -300,10 +304,10 @@ var Module = Class.extend({ loadNextDependency(); }, - /* loadScripts() - * Load all required scripts by requesting the MM object to load the files. + /** + * Load all translations. * - * argument callback function - Function called when done. + * @param {Function} callback Function called when done. */ loadTranslations: function (callback) { var self = this; @@ -334,12 +338,14 @@ var Module = Class.extend({ } }, - /* translate(key, defaultValueOrVariables, defaultValue) + /** * Request the translation for a given key with optional variables and default value. * - * argument key string - The key of the string to translate - * argument defaultValueOrVariables string/object - The default value or variables for translating. (Optional) - * argument defaultValue string - The default value with variables. (Optional) + * @param {string} key The key of the string to translate + * @param {string|object} [defaultValueOrVariables] The default value or variables for translating. + * @param {string} [defaultValue] The default value with variables. + * + * @returns {string} the translated key */ translate: function (key, defaultValueOrVariables, defaultValue) { if (typeof defaultValueOrVariables === "object") { @@ -348,41 +354,41 @@ var Module = Class.extend({ return Translator.translate(this, key) || defaultValueOrVariables || ""; }, - /* updateDom(speed) + /** * Request an (animated) update of the module. * - * argument speed Number - The speed of the animation. (Optional) + * @param {number} [speed] The speed of the animation. */ updateDom: function (speed) { MM.updateDom(this, speed); }, - /* sendNotification(notification, payload) + /** * Send a notification to all modules. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. */ sendNotification: function (notification, payload) { MM.sendNotification(notification, payload, this); }, - /* sendSocketNotification(notification, payload) + /** * Send a socket notification to the node helper. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. */ sendSocketNotification: function (notification, payload) { this.socket().sendNotification(notification, payload); }, - /* hideModule(module, speed, callback) + /** * Hide this module. * - * argument speed Number - The speed of the hide animation. - * argument callback function - Called when the animation is done. - * argument options object - Optional settings for the hide method. + * @param {number} speed The speed of the hide animation. + * @param {Function} callback Called when the animation is done. + * @param {object} options Optional settings for the hide method. */ hide: function (speed, callback, options) { if (typeof callback === "object") { @@ -405,12 +411,12 @@ var Module = Class.extend({ ); }, - /* showModule(module, speed, callback) + /** * Show this module. * - * argument speed Number - The speed of the show animation. - * argument callback function - Called when the animation is done. - * argument options object - Optional settings for the hide method. + * @param {number} speed The speed of the show animation. + * @param {Function} callback Called when the animation is done. + * @param {object} options Optional settings for the show method. */ show: function (speed, callback, options) { if (typeof callback === "object") { @@ -451,13 +457,28 @@ Module.create = function (name) { return new ModuleClass(); }; +Module.register = function (name, moduleDefinition) { + if (moduleDefinition.requiresVersion) { + Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + window.version); + if (cmpVersions(window.version, moduleDefinition.requiresVersion) >= 0) { + Log.log("Version is ok!"); + } else { + Log.log("Version is incorrect. Skip module: '" + name + "'"); + return; + } + } + Log.log("Module registered: " + name); + Module.definitions[name] = moduleDefinition; +}; + /** * Compare two semantic version numbers and return the difference. * * @param {string} a Version number a. * @param {string} b Version number b. * - * @returns {number} + * @returns {number} A positive number if a is larger than b, a negative + * number if a is smaller and 0 if they are the same */ function cmpVersions(a, b) { var i, diff; @@ -474,17 +495,3 @@ function cmpVersions(a, b) { } return segmentsA.length - segmentsB.length; } - -Module.register = function (name, moduleDefinition) { - if (moduleDefinition.requiresVersion) { - Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + window.version); - if (cmpVersions(window.version, moduleDefinition.requiresVersion) >= 0) { - Log.log("Version is ok!"); - } else { - Log.log("Version is incorrect. Skip module: '" + name + "'"); - return; - } - } - Log.log("Module registered: " + name); - Module.definitions[name] = moduleDefinition; -}; From 6f1c7d62538a2190fd4a87e15c7ea8fb4a2fd48b Mon Sep 17 00:00:00 2001 From: Brandon Marlowe Date: Tue, 28 Jul 2020 23:51:38 -0400 Subject: [PATCH 08/41] added --dry-run option to prevent updatenotification module from consuming fetch result --- modules/default/updatenotification/node_helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/updatenotification/node_helper.js b/modules/default/updatenotification/node_helper.js index 0c206c5f..973dca51 100644 --- a/modules/default/updatenotification/node_helper.js +++ b/modules/default/updatenotification/node_helper.js @@ -72,7 +72,7 @@ module.exports = NodeHelper.create({ performFetch: function () { var self = this; simpleGits.forEach((sg) => { - sg.git.fetch().status((err, data) => { + sg.git.fetch(["--dry-run"]).status((err, data) => { data.module = sg.module; if (!err) { sg.git.log({ "-1": null }, (err, data2) => { From a0d4e8dafcbd0cdfb80ef9017932d388f9fb976a Mon Sep 17 00:00:00 2001 From: Brandon Marlowe Date: Tue, 28 Jul 2020 23:55:39 -0400 Subject: [PATCH 09/41] updated changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f75d5e1..05446f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ _This release is scheduled to be released on 2020-10-01._ ### Added +- `--dry-run` option adde in fetch call within updatenotification node_helper. This is to prevent + MagicMirror from consuming any fetch result. Causes conflict with MMPM when attempting to check + for updates to MagicMirror and/or MagicMirror modules. - Test coverage with Istanbul, run it with `npm run test:coverage`. - Add lithuanian language. - Added support in weatherforecast for OpenWeather onecall API. From eee64c8064c2bbf7bd5cd2de8a5fda5daab17fec Mon Sep 17 00:00:00 2001 From: rejas Date: Wed, 29 Jul 2020 22:13:19 +0200 Subject: [PATCH 10/41] Cleanup clientonly jsdoc --- clientonly/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/clientonly/index.js b/clientonly/index.js index e42aa186..bfde722e 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -9,11 +9,13 @@ */ function getServerAddress() { /** - * Helper function to get command line parameters + * Get command line parameters * Assumes that a cmdline parameter is defined with `--key [value]` * - * @param key - * @param defaultValue + * @param {string} key key to look for at the command line + * @param {string} defaultValue value if no key is given at the command line + * + * @returns {string} the value of the parameter */ function getCommandLineParameter(key, defaultValue = undefined) { var index = process.argv.indexOf(`--${key}`); @@ -31,12 +33,15 @@ } /** - * @param url + * Gets the config from the specified server url + * + * @param {string} url location where the server is running + * @returns {Promise} the config */ function getServerConfig(url) { // Return new pending promise return new Promise((resolve, reject) => { - // Select http or https module, depending on reqested url + // Select http or https module, depending on requested url const lib = url.startsWith("https") ? require("https") : require("http"); const request = lib.get(url, (response) => { var configData = ""; @@ -58,8 +63,10 @@ } /** - * @param message - * @param code + * Print a message to the console in case of errors + * + * @param {string} [message] error message to print + * @param {number} code error code for the exit call */ function fail(message, code = 1) { if (message !== undefined && typeof message === "string") { From e489b7101c27d3a092a3064d6eb765a45e41e25c Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 30 Jul 2020 09:33:19 +0200 Subject: [PATCH 11/41] Cleanup notificationFx jsdoc --- modules/default/alert/notificationFx.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/default/alert/notificationFx.js b/modules/default/alert/notificationFx.js index 44b2f01a..89034420 100644 --- a/modules/default/alert/notificationFx.js +++ b/modules/default/alert/notificationFx.js @@ -12,10 +12,11 @@ */ (function (window) { /** - * extend obj function + * Extend one object with another one * - * @param a - * @param b + * @param {object} a The object to extend + * @param {object} b The object which extends the other, overwrites existing keys + * @returns {object} The merged object */ function extend(a, b) { for (let key in b) { @@ -27,9 +28,10 @@ } /** - * NotificationFx function + * NotificationFx constructor * - * @param options + * @param {object} options The configuration options + * @class */ function NotificationFx(options) { this.options = extend({}, this.options); @@ -71,8 +73,7 @@ }; /** - * init function - * initialize and cache some vars + * Initialize and cache some vars */ NotificationFx.prototype._init = function () { // create HTML structure @@ -100,7 +101,7 @@ }; /** - * init events + * Init events */ NotificationFx.prototype._initEvents = function () { // dismiss notification by tapping on it if someone has a touchscreen @@ -110,7 +111,7 @@ }; /** - * show the notification + * Show the notification */ NotificationFx.prototype.show = function () { this.active = true; @@ -120,7 +121,7 @@ }; /** - * dismiss the notification + * Dismiss the notification */ NotificationFx.prototype.dismiss = function () { this.active = false; @@ -149,7 +150,7 @@ }; /** - * add to global namespace + * Add to global namespace */ window.NotificationFx = NotificationFx; })(window); From 90cca28e01bbb4a0cf2e7c03794399ff6788b4a6 Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 30 Jul 2020 09:36:01 +0200 Subject: [PATCH 12/41] Cleanup clock jsdoc --- modules/default/clock/clock.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 8911b7d4..1c7109b6 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -153,8 +153,11 @@ Module.register("clock", { } /** - * @param config - * @param time + * Format the time according to the config + * + * @param {object} config The config of the module + * @param {object} time time to format + * @returns {string} The formatted time string */ function formatTime(config, time) { var formatString = hourSymbol + ":mm"; @@ -163,6 +166,7 @@ Module.register("clock", { } return moment(time).format(formatString); } + if (this.config.showSunTimes) { const sunTimes = SunCalc.getTimes(now, this.config.lat, this.config.lon); const isVisible = now.isBetween(sunTimes.sunrise, sunTimes.sunset); From 8ce1e2c956b5bd98266c152f4a214ec4621f26de Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 30 Jul 2020 12:54:39 +0200 Subject: [PATCH 13/41] Cleanup calendar jsdoc --- modules/default/calendar/calendar.js | 110 +++++++++++++-------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 8e9d4ce3..c513a6f0 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -416,7 +416,7 @@ Module.register("calendar", { * it will a localeSpecification object with the system locale time format. * * @param {number} timeFormat Specifies either 12 or 24 hour time format - * @returns {moment.LocaleSpecification} + * @returns {moment.LocaleSpecification} formatted time */ getLocaleSpecification: function (timeFormat) { switch (timeFormat) { @@ -432,12 +432,11 @@ Module.register("calendar", { } }, - /* hasCalendarURL(url) - * Check if this config contains the calendar url. + /** + * Checks if this config contains the calendar url. * - * argument url string - Url to look for. - * - * return bool - Has calendar url + * @param {string} url The calendar url + * @returns {boolean} True if the calendar config contains the url, False otherwise */ hasCalendarURL: function (url) { for (var c in this.config.calendars) { @@ -450,10 +449,10 @@ Module.register("calendar", { return false; }, - /* createEventList() + /** * Creates the sorted list of all events. * - * return array - Array with events. + * @returns {*[]} Array with events. */ createEventList: function () { var events = []; @@ -535,10 +534,17 @@ Module.register("calendar", { }, /* createEventList(url) - * Requests node helper to add calendar url. * * argument url string - Url to add. */ + + /** + * Requests node helper to add calendar url. + * + * @param {string} url The calendar url to add + * @param {object} auth The authentication method and credentials + * @param {object} calendarConfig The config of the specific calendar + */ addCalendar: function (url, auth, calendarConfig) { this.sendSocketNotification("ADD_CALENDAR", { id: this.identifier, @@ -559,8 +565,7 @@ Module.register("calendar", { * Retrieves the symbols for a specific event. * * @param {object} event Event to look for. - * - * @returns {*} array The Symbols + * @returns {string[]} The symbols */ symbolsForEvent: function (event) { let symbols = this.getCalendarPropertyAsArray(event.url, "symbol", this.config.defaultSymbol); @@ -585,82 +590,72 @@ Module.register("calendar", { }, /** - * symbolClassForUrl(url) - * Retrieves the symbolClass for a specific url. + * Retrieves the symbolClass for a specific calendar url. * - * @param url string - Url to look for. - * - * @returns string + * @param {string} url The calendar url + * @returns {string} The class to be used for the symbols of the calendar */ symbolClassForUrl: function (url) { return this.getCalendarProperty(url, "symbolClass", ""); }, /** - * titleClassForUrl(url) - * Retrieves the titleClass for a specific url. + * Retrieves the titleClass for a specific calendar url. * - * @param url string - Url to look for. - * - * @returns string + * @param {string} url The calendar url + * @returns {string} The class to be used for the title of the calendar */ titleClassForUrl: function (url) { return this.getCalendarProperty(url, "titleClass", ""); }, /** - * timeClassForUrl(url) - * Retrieves the timeClass for a specific url. + * Retrieves the timeClass for a specific calendar url. * - * @param url string - Url to look for. - * - * @returns string + * @param {string} url The calendar url + * @returns {string} The class to be used for the time of the calendar */ timeClassForUrl: function (url) { return this.getCalendarProperty(url, "timeClass", ""); }, - /* calendarNameForUrl(url) - * Retrieves the calendar name for a specific url. + /** + * Retrieves the calendar name for a specific calendar url. * - * argument url string - Url to look for. - * - * return string - The name of the calendar + * @param {string} url The calendar url + * @returns {string} The name of the calendar */ calendarNameForUrl: function (url) { return this.getCalendarProperty(url, "name", ""); }, - /* colorForUrl(url) - * Retrieves the color for a specific url. + /** + * Retrieves the color for a specific calendar url. * - * argument url string - Url to look for. - * - * return string - The Color + * @param {string} url The calendar url + * @returns {string} The color */ colorForUrl: function (url) { return this.getCalendarProperty(url, "color", "#fff"); }, - /* countTitleForUrl(url) - * Retrieves the name for a specific url. + /** + * Retrieves the count title for a specific calendar url. * - * argument url string - Url to look for. - * - * return string - The Symbol + * @param {string} url The calendar url + * @returns {string} The title */ countTitleForUrl: function (url) { return this.getCalendarProperty(url, "repeatingCountTitle", this.config.defaultRepeatingCountTitle); }, - /* getCalendarProperty(url, property, defaultValue) - * Helper method to retrieve the property for a specific url. + /** + * Helper method to retrieve the property for a specific calendar url. * - * argument url string - Url to look for. - * argument property string - Property to look for. - * argument defaultValue string - Value if property is not found. - * - * return string - The Property + * @param {string} url The calendar url + * @param {string} property The property to look for + * @param {string} defaultValue The value if the property is not found + * @returns {*} The property */ getCalendarProperty: function (url, property, defaultValue) { for (var c in this.config.calendars) { @@ -736,22 +731,27 @@ Module.register("calendar", { } }, - /* capFirst(string) + /** * Capitalize the first letter of a string - * Return capitalized string + * + * @param {string} string The string to capitalize + * @returns {string} The capitalized string */ capFirst: function (string) { return string.charAt(0).toUpperCase() + string.slice(1); }, - /* titleTransform(title) + /** * Transforms the title of an event for usage. * Replaces parts of the text as defined in config.titleReplace. * Shortens title based on config.maxTitleLength and config.wrapEvents * - * argument title string - The title to transform. - * - * return string - The transformed title. + * @param {string} title The title to transform. + * @param {object} titleReplace Pairs of strings to be replaced in the title + * @param {boolean} wrapEvents Wrap the text after the line has reached maxLength + * @param {number} maxTitleLength The max length of the string + * @param {number} maxTitleLines The max number of vertical lines before cutting event title + * @returns {string} The transformed title. */ titleTransform: function (title, titleReplace, wrapEvents, maxTitleLength, maxTitleLines) { for (var needle in titleReplace) { @@ -770,7 +770,7 @@ Module.register("calendar", { return title; }, - /* broadcastEvents() + /** * Broadcasts the events to all other modules for reuse. * The all events available in one array, sorted on startdate. */ From c8664d59522c0b9079b238bf1348acf4558e4f9b Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 30 Jul 2020 12:58:35 +0200 Subject: [PATCH 14/41] Cleanup weatherprovider jsdoc --- modules/default/weather/weatherprovider.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/default/weather/weatherprovider.js b/modules/default/weather/weatherprovider.js index 22897337..ed22054b 100644 --- a/modules/default/weather/weatherprovider.js +++ b/modules/default/weather/weatherprovider.js @@ -12,7 +12,7 @@ var WeatherProvider = Class.extend({ // Weather Provider Properties providerName: null, - // The following properties have accestor methods. + // The following properties have accessor methods. // Try to not access them directly. currentWeatherObject: null, weatherForecastArray: null, @@ -120,8 +120,8 @@ WeatherProvider.providers = []; /** * Static method to register a new weather provider. * - * @param providerIdentifier - * @param providerDetails + * @param {string} providerIdentifier The name of the weather provider + * @param {object} providerDetails The details of the weather provider */ WeatherProvider.register = function (providerIdentifier, providerDetails) { WeatherProvider.providers[providerIdentifier.toLowerCase()] = WeatherProvider.extend(providerDetails); @@ -130,8 +130,9 @@ WeatherProvider.register = function (providerIdentifier, providerDetails) { /** * Static method to initialize a new weather provider. * - * @param providerIdentifier - * @param delegate + * @param {string} providerIdentifier The name of the weather provider + * @param {object} delegate The weather module + * @returns {object} The new weather provider */ WeatherProvider.initialize = function (providerIdentifier, delegate) { providerIdentifier = providerIdentifier.toLowerCase(); From 0674c0aff68a78d7e0403829eba76ff9ba125811 Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 30 Jul 2020 13:00:02 +0200 Subject: [PATCH 15/41] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f75d5e1..5a7c03dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,13 @@ _This release is scheduled to be released on 2020-10-01._ - Add lithuanian language. - Added support in weatherforecast for OpenWeather onecall API. - Added config option to calendar-icons for recurring- and fullday-events +- Added eslint-plugin for jsdoc comments ### Updated - Change incorrect weather.js default properties. - Cleaned up newsfeed module. +- Cleaned up jsdoc comments. ### Deleted From 522f7644a33fd2b98ebee688ed3ed6fab7f241e0 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 16:31:42 +0200 Subject: [PATCH 16/41] Add typedef for Module, use it in other jsdocs --- js/app.js | 2 +- js/module.js | 15 ++++++++------- js/translator.js | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index 52405bec..64844269 100644 --- a/js/app.js +++ b/js/app.js @@ -157,7 +157,7 @@ var App = function () { /** * Loads all modules. * - * @param {Array} modules All modules to be loaded + * @param {Module[]} modules All modules to be loaded * @param {Function} callback Function to be called after loading */ var loadModules = function (modules, callback) { diff --git a/js/module.js b/js/module.js index 7c581a31..0148a2d9 100644 --- a/js/module.js +++ b/js/module.js @@ -2,9 +2,11 @@ /* Magic Mirror * Module Blueprint. + * @typedef {Object} Module * * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. + * */ var Module = Class.extend({ /********************************************************* @@ -45,9 +47,8 @@ var Module = Class.extend({ /** * Returns a list of scripts the module requires to be loaded. - * return Array - * - * @returns {*[]} An array with filenames. + * @returns {string[]} An array with filenames. */ getScripts: function () { return []; @@ -56,7 +57,7 @@ var Module = Class.extend({ /** * Returns a list of stylesheets the module requires to be loaded. * - * @returns {*[]} An array with filenames. + * @returns {string[]} An array with filenames. */ getStyles: function () { return []; @@ -146,7 +147,7 @@ var Module = Class.extend({ * * @param {string} notification The identifier of the notification. * @param {*} payload The payload of the notification. - * @param {object} sender The module that sent the notification. + * @param {Module} sender The module that sent the notification. */ notificationReceived: function (notification, payload, sender) { if (sender) { @@ -212,7 +213,7 @@ var Module = Class.extend({ /** * Set the module data. * - * @param {object} data The module data + * @param {Module} data The module data */ setData: function (data) { this.data = data; @@ -388,7 +389,7 @@ var Module = Class.extend({ * * @param {number} speed The speed of the hide animation. * @param {Function} callback Called when the animation is done. - * @param {object} options Optional settings for the hide method. + * @param {object} [options] Optional settings for the hide method. */ hide: function (speed, callback, options) { if (typeof callback === "object") { @@ -416,7 +417,7 @@ var Module = Class.extend({ * * @param {number} speed The speed of the show animation. * @param {Function} callback Called when the animation is done. - * @param {object} options Optional settings for the show method. + * @param {object} [options] Optional settings for the show method. */ show: function (speed, callback, options) { if (typeof callback === "object") { diff --git a/js/translator.js b/js/translator.js index e043de39..eb1482ae 100644 --- a/js/translator.js +++ b/js/translator.js @@ -34,7 +34,7 @@ var Translator = (function () { /** * Load a translation for a given key for a given module. * - * @param {object} module The module to load the translation for. + * @param {Module} module The module to load the translation for. * @param {string} key The key of the text to translate. * @param {object} variables The variables to use within the translation template (optional) * @@ -92,7 +92,7 @@ var Translator = (function () { /** * Load a translation file (json) and remember the data. * - * @param {object} module The module to load the translation file for. + * @param {Module} module The module to load the translation file for. * @param {string} file Path of the file we want to load. * @param {boolean} isFallback Flag to indicate fallback translations. * @param {Function} callback Function called when done. From 935c9b6a42f0b7c48f6cc982563c7378f56f53e1 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 16:38:32 +0200 Subject: [PATCH 17/41] Cleanup loader jsdoc --- js/loader.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/js/loader.js b/js/loader.js index bc376bd9..4ba75578 100644 --- a/js/loader.js +++ b/js/loader.js @@ -15,7 +15,7 @@ var Loader = (function () { /* Private Methods */ - /* loadModules() + /** * Loops thru all modules and requests load for every module. */ var loadModules = function () { @@ -43,7 +43,7 @@ var Loader = (function () { loadNextModule(); }; - /* startModules() + /** * Loops thru all modules and requests start for every module. */ var startModules = function () { @@ -56,19 +56,19 @@ var Loader = (function () { MM.modulesStarted(moduleObjects); }; - /* getAllModules() + /** * Retrieve list of all modules. * - * return array - module data as configured in config + * @returns {object[]} module data as configured in config */ var getAllModules = function () { return config.modules; }; - /* getModuleData() + /** * Generate array with module information including module paths. * - * return array - Module information. + * @returns {object[]} Module information. */ var getModuleData = function () { var modules = getAllModules(); @@ -106,11 +106,11 @@ var Loader = (function () { return moduleFiles; }; - /* loadModule(module) - * Load modules via ajax request and create module objects. + /** + * Load modules via ajax request and create module objects.s * - * argument callback function - Function called when done. - * argument module object - Information about the module we want to load. + * @param {object} module Information about the module we want to load. + * @param {Function} callback Function called when done. */ var loadModule = function (module, callback) { var url = module.path + "/" + module.file; @@ -136,12 +136,12 @@ var Loader = (function () { } }; - /* bootstrapModule(module, mObj) + /** * Bootstrap modules by setting the module data and loading the scripts & styles. * - * argument module object - Information about the module we want to load. - * argument mObj object - Modules instance. - * argument callback function - Function called when done. + * @param {object} module Information about the module we want to load. + * @param {Module} mObj Modules instance. + * @param {Function} callback Function called when done. */ var bootstrapModule = function (module, mObj, callback) { Log.info("Bootstrapping module: " + module.name); @@ -161,11 +161,11 @@ var Loader = (function () { }); }; - /* loadFile(fileName) + /** * Load a script or stylesheet by adding it to the dom. * - * argument fileName string - Path of the file we want to load. - * argument callback function - Function called when done. + * @param {string} fileName Path of the file we want to load. + * @param {Function} callback Function called when done. */ var loadFile = function (fileName, callback) { var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1); @@ -215,20 +215,20 @@ var Loader = (function () { /* Public Methods */ return { - /* loadModules() + /** * Load all modules as defined in the config. */ loadModules: function () { loadModules(); }, - /* loadFile() + /** * Load a file (script or stylesheet). * Prevent double loading and search for files in the vendor folder. * - * argument fileName string - Path of the file we want to load. - * argument module Module Object - the module that calls the loadFile function. - * argument callback function - Function called when done. + * @param {string} fileName Path of the file we want to load. + * @param {Module} module The module that calls the loadFile function. + * @param {Function} callback Function called when done. */ loadFile: function (fileName, module, callback) { if (loadedFiles.indexOf(fileName.toLowerCase()) !== -1) { From 02779ef7252fdbce7eebf9b769aaf871c2550c36 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 17:06:46 +0200 Subject: [PATCH 18/41] Cleanup main jsdoc --- js/main.js | 167 +++++++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 82 deletions(-) diff --git a/js/main.js b/js/main.js index cbf2566f..a02e6496 100644 --- a/js/main.js +++ b/js/main.js @@ -11,9 +11,8 @@ var MM = (function () { /* Private Methods */ - /* createDomObjects() - * Create dom objects for all modules that - * are configured for a specific position. + /** + * Create dom objects for all modules that are configured for a specific position. */ var createDomObjects = function () { var domCreationPromises = []; @@ -65,10 +64,12 @@ var MM = (function () { }); }; - /* selectWrapper(position) + /** * Select the wrapper dom object for a specific position. * - * argument position string - The name of the position. + * @param {string} position The name of the position. + * + * @returns {HTMLElement} the wrapper element */ var selectWrapper = function (position) { var classes = position.replace("_", " "); @@ -81,13 +82,13 @@ var MM = (function () { } }; - /* sendNotification(notification, payload, sender) + /** * Send a notification to all modules. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. - * argument sender Module - The module that sent the notification. - * argument sendTo Module - The module to send the notification to. (optional) + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. + * @param {Module} sender The module that sent the notification. + * @param {Module} [sendTo] The (optional) module to send the notification to. */ var sendNotification = function (notification, payload, sender, sendTo) { for (var m in modules) { @@ -98,13 +99,13 @@ var MM = (function () { } }; - /* updateDom(module, speed) + /** * Update the dom for a specific module. * - * argument module Module - The module that needs an update. - * argument speed Number - The number of microseconds for the animation. (optional) + * @param {Module} module The module that needs an update. + * @param {number} [speed] The (optional) number of microseconds for the animation. * - * return Promise - Resolved when the dom is fully updated. + * @returns {Promise} Resolved when the dom is fully updated. */ var updateDom = function (module, speed) { return new Promise(function (resolve) { @@ -126,15 +127,15 @@ var MM = (function () { }); }; - /* updateDomWithContent(module, speed, newHeader, newContent) + /** * Update the dom with the specified content * - * argument module Module - The module that needs an update. - * argument speed Number - The number of microseconds for the animation. (optional) - * argument newHeader String - The new header that is generated. - * argument newContent Domobject - The new content that is generated. + * @param {Module} module The module that needs an update. + * @param {number} [speed] The (optional) number of microseconds for the animation. + * @param {string} newHeader The new header that is generated. + * @param {HTMLElement} newContent The new content that is generated. * - * return Promise - Resolved when the module dom has been updated. + * @returns {Promise} Resolved when the module dom has been updated. */ var updateDomWithContent = function (module, speed, newHeader, newContent) { return new Promise(function (resolve) { @@ -165,14 +166,14 @@ var MM = (function () { }); }; - /* moduleNeedsUpdate(module, newContent) + /** * Check if the content has changed. * - * argument module Module - The module to check. - * argument newHeader String - The new header that is generated. - * argument newContent Domobject - The new content that is generated. + * @param {Module} module The module to check. + * @param {string} newHeader The new header that is generated. + * @param {HTMLElement} newContent The new content that is generated. * - * return bool - Does the module need an update? + * @returns {boolean} True if the module need an update, false otherwise */ var moduleNeedsUpdate = function (module, newHeader, newContent) { var moduleWrapper = document.getElementById(module.identifier); @@ -197,12 +198,12 @@ var MM = (function () { return headerNeedsUpdate || contentNeedsUpdate; }; - /* moduleNeedsUpdate(module, newContent) + /** * Update the content of a module on screen. * - * argument module Module - The module to check. - * argument newHeader String - The new header that is generated. - * argument newContent Domobject - The new content that is generated. + * @param {Module} module The module to check. + * @param {string} newHeader The new header that is generated. + * @param {HTMLElement} newContent The new content that is generated. */ var updateModuleContent = function (module, newHeader, newContent) { var moduleWrapper = document.getElementById(module.identifier); @@ -223,12 +224,13 @@ var MM = (function () { } }; - /* hideModule(module, speed, callback) + /** * Hide the module. * - * argument module Module - The module to hide. - * argument speed Number - The speed of the hide animation. - * argument callback function - Called when the animation is done. + * @param {Module} module The module to hide. + * @param {number} speed The speed of the hide animation. + * @param {Function} callback Called when the animation is done. + * @param {object} [options] Optional settings for the hide method. */ var hideModule = function (module, speed, callback, options) { options = options || {}; @@ -268,12 +270,13 @@ var MM = (function () { } }; - /* showModule(module, speed, callback) + /** * Show the module. * - * argument module Module - The module to show. - * argument speed Number - The speed of the show animation. - * argument callback function - Called when the animation is done. + * @param {Module} module The module to show. + * @param {number} speed The speed of the show animation. + * @param {Function} callback Called when the animation is done. + * @param {object} [options] Optional settings for the show method. */ var showModule = function (module, speed, callback, options) { options = options || {}; @@ -327,7 +330,7 @@ var MM = (function () { } }; - /* updateWrapperStates() + /** * Checks for all positions if it has visible content. * If not, if will hide the position to prevent unwanted margins. * This method should be called by the show and hide methods. @@ -356,8 +359,8 @@ var MM = (function () { }); }; - /* loadConfig() - * Loads the core config and combines it with de system defaults. + /** + * Loads the core config and combines it with the system defaults. */ var loadConfig = function () { // FIXME: Think about how to pass config around without breaking tests @@ -372,41 +375,41 @@ var MM = (function () { /* eslint-enable */ }; - /* setSelectionMethodsForModules() + /** * Adds special selectors on a collection of modules. * - * argument modules array - Array of modules. + * @param {Module[]} modules Array of modules. */ var setSelectionMethodsForModules = function (modules) { - /* withClass(className) - * calls modulesByClass to filter modules with the specified classes. + /** + * Filter modules with the specified classes. * - * argument className string/array - one or multiple classnames. (array or space divided) + * @param {string|string[]} className one or multiple classnames (array or space divided). * - * return array - Filtered collection of modules. + * @returns {Module[]} Filtered collection of modules. */ var withClass = function (className) { return modulesByClass(className, true); }; - /* exceptWithClass(className) - * calls modulesByClass to filter modules without the specified classes. + /** + * Filter modules without the specified classes. * - * argument className string/array - one or multiple classnames. (array or space divided) + * @param {string|string[]} className one or multiple classnames (array or space divided). * - * return array - Filtered collection of modules. + * @returns {Module[]} Filtered collection of modules. */ var exceptWithClass = function (className) { return modulesByClass(className, false); }; - /* modulesByClass(className, include) - * filters a collection of modules based on classname(s). + /** + * Filters a collection of modules based on classname(s). * - * argument className string/array - one or multiple classnames. (array or space divided) - * argument include boolean - if the filter should include or exclude the modules with the specific classes. + * @param {string|string[]} className one or multiple classnames (array or space divided). + * @param {boolean} include if the filter should include or exclude the modules with the specific classes. * - * return array - Filtered collection of modules. + * @returns {Module[]} Filtered collection of modules. */ var modulesByClass = function (className, include) { var searchClasses = className; @@ -431,12 +434,12 @@ var MM = (function () { return newModules; }; - /* exceptModule(module) + /** * Removes a module instance from the collection. * - * argument module Module object - The module instance to remove from the collection. + * @param {object} module The module instance to remove from the collection. * - * return array - Filtered collection of modules. + * @returns {Module[]} Filtered collection of modules. */ var exceptModule = function (module) { var newModules = modules.filter(function (mod) { @@ -447,10 +450,10 @@ var MM = (function () { return newModules; }; - /* enumerate(callback) + /** * Walks thru a collection of modules and executes the callback with the module as an argument. * - * argument callback function - The function to execute with the module as an argument. + * @param {Function} callback The function to execute with the module as an argument. */ var enumerate = function (callback) { modules.map(function (module) { @@ -475,7 +478,7 @@ var MM = (function () { return { /* Public Methods */ - /* init() + /** * Main init method. */ init: function () { @@ -488,10 +491,10 @@ var MM = (function () { Loader.loadModules(); }, - /* modulesStarted(moduleObjects) + /** * Gets called when all modules are started. * - * argument moduleObjects array - All module instances. + * @param {Module[]} moduleObjects All module instances. */ modulesStarted: function (moduleObjects) { modules = []; @@ -506,12 +509,12 @@ var MM = (function () { createDomObjects(); }, - /* sendNotification(notification, payload, sender) + /** * Send a notification to all modules. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. - * argument sender Module - The module that sent the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. + * @param {Module} sender The module that sent the notification. */ sendNotification: function (notification, payload, sender) { if (arguments.length < 3) { @@ -533,11 +536,11 @@ var MM = (function () { sendNotification(notification, payload, sender); }, - /* updateDom(module, speed) + /** * Update the dom for a specific module. * - * argument module Module - The module that needs an update. - * argument speed Number - The number of microseconds for the animation. (optional) + * @param {Module} module The module that needs an update. + * @param {number} [speed] The number of microseconds for the animation. */ updateDom: function (module, speed) { if (!(module instanceof Module)) { @@ -549,36 +552,36 @@ var MM = (function () { updateDom(module, speed); }, - /* getModules(module, speed) + /** * Returns a collection of all modules currently active. * - * return array - A collection of all modules currently active. + * @returns {Module[]} A collection of all modules currently active. */ getModules: function () { setSelectionMethodsForModules(modules); return modules; }, - /* hideModule(module, speed, callback) + /** * Hide the module. * - * argument module Module - The module hide. - * argument speed Number - The speed of the hide animation. - * argument callback function - Called when the animation is done. - * argument options object - Optional settings for the hide method. + * @param {Module} module The module to hide. + * @param {number} speed The speed of the hide animation. + * @param {Function} callback Called when the animation is done. + * @param {object} [options] Optional settings for the hide method. */ hideModule: function (module, speed, callback, options) { module.hidden = true; hideModule(module, speed, callback, options); }, - /* showModule(module, speed, callback) + /** * Show the module. * - * argument module Module - The module show. - * argument speed Number - The speed of the show animation. - * argument callback function - Called when the animation is done. - * argument options object - Optional settings for the hide method. + * @param {Module} module The module to show. + * @param {number} speed The speed of the show animation. + * @param {Function} callback Called when the animation is done. + * @param {object} [options] Optional settings for the show method. */ showModule: function (module, speed, callback, options) { // do not change module.hidden yet, only if we really show it later From 05659820d0de954d040387d9fc52dc32d2101e1c Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 17:06:56 +0200 Subject: [PATCH 19/41] Minor cleanups --- clientonly/index.js | 3 ++- js/module.js | 2 -- js/translator.js | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/clientonly/index.js b/clientonly/index.js index bfde722e..88454d93 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -35,7 +35,8 @@ /** * Gets the config from the specified server url * - * @param {string} url location where the server is running + * @param {string} url location where the server is running. + * * @returns {Promise} the config */ function getServerConfig(url) { diff --git a/js/module.js b/js/module.js index 0148a2d9..8bb5990e 100644 --- a/js/module.js +++ b/js/module.js @@ -345,7 +345,6 @@ var Module = Class.extend({ * @param {string} key The key of the string to translate * @param {string|object} [defaultValueOrVariables] The default value or variables for translating. * @param {string} [defaultValue] The default value with variables. - * * @returns {string} the translated key */ translate: function (key, defaultValueOrVariables, defaultValue) { @@ -477,7 +476,6 @@ Module.register = function (name, moduleDefinition) { * * @param {string} a Version number a. * @param {string} b Version number b. - * * @returns {number} A positive number if a is larger than b, a negative * number if a is smaller and 0 if they are the same */ diff --git a/js/translator.js b/js/translator.js index eb1482ae..0f4bc00a 100644 --- a/js/translator.js +++ b/js/translator.js @@ -37,7 +37,6 @@ var Translator = (function () { * @param {Module} module The module to load the translation for. * @param {string} key The key of the text to translate. * @param {object} variables The variables to use within the translation template (optional) - * * @returns {string} the translated key */ translate: function (module, key, variables) { @@ -51,7 +50,6 @@ var Translator = (function () { * * @param {string} template Text with placeholder * @param {object} variables Variables for the placeholder - * * @returns {string} the template filled with the variables */ function createStringFromTemplate(template, variables) { From 1d4d5cc4e7d84cc785eca1bc3aaa8f56c3d91fb5 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 3 Aug 2020 11:19:54 +0200 Subject: [PATCH 20/41] Cleanup calendar jsdoc --- modules/default/calendar/calendar.js | 7 +-- modules/default/calendar/calendarfetcher.js | 69 +++++++++++++-------- modules/default/calendar/node_helper.js | 13 ++-- 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index c513a6f0..af804139 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -452,7 +452,7 @@ Module.register("calendar", { /** * Creates the sorted list of all events. * - * @returns {*[]} Array with events. + * @returns {object[]} Array with events. */ createEventList: function () { var events = []; @@ -533,11 +533,6 @@ Module.register("calendar", { return false; }, - /* createEventList(url) - * - * argument url string - Url to add. - */ - /** * Requests node helper to add calendar url. * diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 888830ba..033f73cb 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -6,9 +6,27 @@ */ const Log = require("../../../js/logger.js"); const ical = require("ical"); -const moment = require("moment"); const request = require("request"); +/** + * Moment date + * + * @external Moment + * @see {@link http://momentjs.com} + */ +const moment = require("moment"); + +/** + * + * @param {string} url The url of the calendar to fetch + * @param {number} reloadInterval Time in ms the calendar is fetched again + * @param {string[]} excludedEvents An array of words / phrases from event titles that will be excluded from being shown. + * @param {number} maximumEntries The maximum number of events fetched. + * @param {number} maximumNumberOfDays The maximum number of days an event should be in the future. + * @param {object} auth The object containing options for authentication against the calendar. + * @param {boolean} includePastEvents If true events from the past maximumNumberOfDays will be fetched too + * @class + */ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents) { const self = this; @@ -18,7 +36,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn let fetchFailedCallback = function () {}; let eventsReceivedCallback = function () {}; - /* fetchCalendar() + /** * Initiates calendar fetch. */ const fetchCalendar = function () { @@ -325,7 +343,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn }); }; - /* scheduleTimer() + /** * Schedule the timer for the next update. */ const scheduleTimer = function () { @@ -335,12 +353,11 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn }, reloadInterval); }; - /* isFullDayEvent(event) + /** * Checks if an event is a fullday event. * - * argument event object - The event object to check. - * - * return bool - The event is a fullday event. + * @param {object} event The event object to check. + * @returns {boolean} True if the event is a fullday event, false otherwise */ const isFullDayEvent = function (event) { if (event.start.length === 8 || event.start.dateOnly) { @@ -358,14 +375,13 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn return false; }; - /* timeFilterApplies() + /** * Determines if the user defined time filter should apply * - * argument now Date - Date object using previously created object for consistency - * argument endDate Moment - Moment object representing the event end date - * argument filter string - The time to subtract from the end date to determine if an event should be shown - * - * return bool - The event should be filtered out + * @param {Date} now Date object using previously created object for consistency + * @param {Moment} endDate Moment object representing the event end date + * @param {string} filter The time to subtract from the end date to determine if an event should be shown + * @returns {boolean} True if the event should be filtered out, false otherwise */ const timeFilterApplies = function (now, endDate, filter) { if (filter) { @@ -380,12 +396,11 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn return false; }; - /* getTitleFromEvent(event) + /** * Gets the title from the event. * - * argument event object - The event object to check. - * - * return string - The title of the event, or "Event" if no title is found. + * @param {object} event The event object to check. + * @returns {string} The title of the event, or "Event" if no title is found. */ const getTitleFromEvent = function (event) { let title = "Event"; @@ -416,14 +431,14 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn /* public methods */ - /* startFetch() + /** * Initiate fetchCalendar(); */ this.startFetch = function () { fetchCalendar(); }; - /* broadcastItems() + /** * Broadcast the existing events. */ this.broadcastEvents = function () { @@ -431,37 +446,37 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn eventsReceivedCallback(self); }; - /* onReceive(callback) + /** * Sets the on success callback * - * argument callback function - The on success callback. + * @param {Function} callback The on success callback. */ this.onReceive = function (callback) { eventsReceivedCallback = callback; }; - /* onError(callback) + /** * Sets the on error callback * - * argument callback function - The on error callback. + * @param {Function} callback The on error callback. */ this.onError = function (callback) { fetchFailedCallback = callback; }; - /* url() + /** * Returns the url of this fetcher. * - * return string - The url of this fetcher. + * @returns {string} The url of this fetcher. */ this.url = function () { return url; }; - /* events() + /** * Returns current available events for this fetcher. * - * return array - The current available events for this fetcher. + * @returns {object[]} The current available events for this fetcher. */ this.events = function () { return events; diff --git a/modules/default/calendar/node_helper.js b/modules/default/calendar/node_helper.js index e731ca6c..862755a0 100644 --- a/modules/default/calendar/node_helper.js +++ b/modules/default/calendar/node_helper.js @@ -4,7 +4,6 @@ * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. */ - const NodeHelper = require("node_helper"); const validUrl = require("valid-url"); const CalendarFetcher = require("./calendarfetcher.js"); @@ -24,12 +23,18 @@ module.exports = NodeHelper.create({ } }, - /* createFetcher(url, reloadInterval) + /** * Creates a fetcher for a new url if it doesn't exist yet. * Otherwise it reuses the existing one. * - * attribute url string - URL of the news feed. - * attribute reloadInterval number - Reload interval in milliseconds. + * @param {string} url The url of the calendar + * @param {number} fetchInterval How often does the calendar needs to be fetched in ms + * @param {string[]} excludedEvents An array of words / phrases from event titles that will be excluded from being shown. + * @param {number} maximumEntries The maximum number of events fetched. + * @param {number} maximumNumberOfDays The maximum number of days an event should be in the future. + * @param {object} auth The object containing options for authentication against the calendar. + * @param {boolean} broadcastPastEvents If true events from the past maximumNumberOfDays will be included in event broadcasts + * @param {string} identifier ID of the module */ createFetcher: function (url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents, identifier) { var self = this; From 9f3806dabf468347193eb54d8fd80141e90a3107 Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 3 Aug 2020 11:20:11 +0200 Subject: [PATCH 21/41] Update eslint jsdoc plugin --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index ebb2fb56..a3214e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2592,9 +2592,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "30.0.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.0.3.tgz", - "integrity": "sha512-EviSu0Hgc9Bhz00WhA6829KYC9BaP6JWoycOTA1xFxjQ/2XguRlB3r6nGNA/jkmMDQp5dTQ22s1kAJIaC+dE8Q==", + "version": "30.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.1.0.tgz", + "integrity": "sha512-eMsX+TMW6ycgXwxqU9xqfts2/e7cWCSGzk+gHgDvqaITyMJr8AcHTdd4pAMjpnOh0cd16lPZv+/R5LbQ4uVHQA==", "dev": true, "requires": { "comment-parser": "^0.7.5", diff --git a/package.json b/package.json index f021abce..f2e95b7c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "current-week-number": "^1.0.7", "danger": "^3.1.3", "eslint-config-prettier": "^6.11.0", - "eslint-plugin-jsdoc": "^30.0.3", + "eslint-plugin-jsdoc": "^30.1.0", "eslint-plugin-prettier": "^3.1.4", "http-auth": "^3.2.3", "husky": "^4.2.5", From 3438a5a37421b96af5ac8031ca86c394029357db Mon Sep 17 00:00:00 2001 From: rejas Date: Mon, 3 Aug 2020 11:36:29 +0200 Subject: [PATCH 22/41] Cleanup newsfeed jsdoc --- modules/default/newsfeed/newsfeed.js | 26 ++++++++++----------- modules/default/newsfeed/newsfeedfetcher.js | 22 +++++++++-------- modules/default/newsfeed/node_helper.js | 8 +++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 3e26da4f..2ff02888 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -205,8 +205,8 @@ Module.register("newsfeed", { return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href; }, - /* registerFeeds() - * registers the feeds to be used by the backend. + /** + * Registers the feeds to be used by the backend. */ registerFeeds: function () { for (var f in this.config.feeds) { @@ -218,10 +218,10 @@ Module.register("newsfeed", { } }, - /* generateFeed() + /** * Generate an ordered list of items for this configured module. * - * attribute feeds object - An object with feeds returned by the node helper. + * @param {object} feeds An object with feeds returned by the node helper. */ generateFeed: function (feeds) { var newsItems = []; @@ -274,12 +274,11 @@ Module.register("newsfeed", { this.newsItems = newsItems; }, - /* subscribedToFeed(feedUrl) + /** * Check if this module is configured to show this feed. * - * attribute feedUrl string - Url of the feed to check. - * - * returns bool + * @param {string} feedUrl Url of the feed to check. + * @returns {boolean} True if it is subscribed, false otherwise */ subscribedToFeed: function (feedUrl) { for (var f in this.config.feeds) { @@ -291,12 +290,11 @@ Module.register("newsfeed", { return false; }, - /* titleForFeed(feedUrl) - * Returns title for a specific feed Url. + /** + * Returns title for the specific feed url. * - * attribute feedUrl string - Url of the feed to check. - * - * returns string + * @param {string} feedUrl Url of the feed + * @returns {string} The title of the feed */ titleForFeed: function (feedUrl) { for (var f in this.config.feeds) { @@ -308,7 +306,7 @@ Module.register("newsfeed", { return ""; }, - /* scheduleUpdateInterval() + /** * Schedule visual update. */ scheduleUpdateInterval: function () { diff --git a/modules/default/newsfeed/newsfeedfetcher.js b/modules/default/newsfeed/newsfeedfetcher.js index ba32d1ad..20e45258 100644 --- a/modules/default/newsfeed/newsfeedfetcher.js +++ b/modules/default/newsfeed/newsfeedfetcher.js @@ -9,12 +9,14 @@ const FeedMe = require("feedme"); const request = require("request"); const iconv = require("iconv-lite"); -/* Fetcher +/** * Responsible for requesting an update on the set interval and broadcasting the data. * - * attribute url string - URL of the news feed. - * attribute reloadInterval number - Reload interval in milliseconds. - * attribute logFeedWarnings boolean - Log warnings when there is an error parsing a news article. + * @param {string} url URL of the news feed. + * @param {number} reloadInterval Reload interval in milliseconds. + * @param {string} encoding Encoding of the feed. + * @param {boolean} logFeedWarnings If true log warnings when there is an error parsing a news article. + * @class */ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings) { const self = this; @@ -31,7 +33,7 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings /* private methods */ - /* fetchNews() + /** * Request the new items. */ const fetchNews = function () { @@ -95,7 +97,7 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings .pipe(parser); }; - /* scheduleTimer() + /** * Schedule the timer for the next update. */ const scheduleTimer = function () { @@ -107,10 +109,10 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings /* public methods */ - /* setReloadInterval() + /** * Update the reload interval, but only if we need to increase the speed. * - * attribute interval number - Interval for the update in milliseconds. + * @param {number} interval Interval for the update in milliseconds. */ this.setReloadInterval = function (interval) { if (interval > 1000 && interval < reloadInterval) { @@ -118,14 +120,14 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings } }; - /* startFetch() + /** * Initiate fetchNews(); */ this.startFetch = function () { fetchNews(); }; - /* broadcastItems() + /** * Broadcast the existing items. */ this.broadcastItems = function () { diff --git a/modules/default/newsfeed/node_helper.js b/modules/default/newsfeed/node_helper.js index 6aca2519..bdfcbfcc 100644 --- a/modules/default/newsfeed/node_helper.js +++ b/modules/default/newsfeed/node_helper.js @@ -24,12 +24,12 @@ module.exports = NodeHelper.create({ } }, - /* createFetcher(feed, config) + /** * Creates a fetcher for a new feed if it doesn't exist yet. * Otherwise it reuses the existing one. * - * attribute feed object - A feed object. - * attribute config object - A configuration object containing reload interval in milliseconds. + * @param {object} feed The feed object. + * @param {object} config The configuration object. */ createFetcher: function (feed, config) { const url = feed.url || ""; @@ -68,7 +68,7 @@ module.exports = NodeHelper.create({ fetcher.startFetch(); }, - /* broadcastFeeds() + /** * Creates an object with all feed items of the different registered feeds, * and broadcasts these using sendSocketNotification. */ From 056b66a7641bf114c6a90400ba640a83b6917372 Mon Sep 17 00:00:00 2001 From: rejas Date: Fri, 7 Aug 2020 09:57:06 +0200 Subject: [PATCH 23/41] Dont use the prettier based config for verifying the syntax --- js/check_config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/check_config.js b/js/check_config.js index cfd56824..058a6d6f 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -12,7 +12,6 @@ const path = require("path"); const fs = require("fs"); const rootPath = path.resolve(__dirname + "/../"); -const config = require(rootPath + "/.eslintrc.json"); const Log = require(rootPath + "/js/logger.js"); const Utils = require(rootPath + "/js/utils.js"); @@ -54,7 +53,7 @@ function checkConfigFile() { if (err) { throw err; } - const messages = linter.verify(data, config); + const messages = linter.verify(data); if (messages.length === 0) { Log.log("Your configuration file doesn't contain syntax errors :)"); return true; From 0056e0bc6d2f3615da3b9b43d68c58bc414fa165 Mon Sep 17 00:00:00 2001 From: rejas Date: Fri, 7 Aug 2020 09:58:55 +0200 Subject: [PATCH 24/41] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f75d5e1..dee9804c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ Special thanks to the following contributors: @AndreKoepke, @andrezibaia, @bryan - Throw error when check_config fails. [#1928](https://github.com/MichMich/MagicMirror/issues/1928) - Bug fix related to 'maxEntries' not displaying Calendar events. [#2050](https://github.com/MichMich/MagicMirror/issues/2050) - Updated ical library to latest version. [#1926](https://github.com/MichMich/MagicMirror/issues/1926) +- Fix config check after merge of prettier [#2109](https://github.com/MichMich/MagicMirror/issues/2109) ## [2.11.0] - 2020-04-01 From 66609428a2398bf6af538b2d0ece7dbe4fdd83fe Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 8 Aug 2020 22:16:27 +0200 Subject: [PATCH 25/41] Remove thrown Errors and add some color to the ouput --- js/check_config.js | 7 +++---- js/utils.js | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/check_config.js b/js/check_config.js index 058a6d6f..15b1ae3d 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -55,14 +55,13 @@ function checkConfigFile() { } const messages = linter.verify(data); if (messages.length === 0) { - Log.log("Your configuration file doesn't contain syntax errors :)"); - return true; + Log.info(Utils.colors.pass("Your configuration file doesn't contain syntax errors :)")); } else { + Log.error(Utils.colors.error("Your configuration file contains syntax errors :(")); // In case the there errors show messages and return messages.forEach((error) => { - Log.log("Line", error.line, "col", error.column, error.message); + Log.error("Line", error.line, "col", error.column, error.message); }); - throw new Error("Wrong syntax in config file!"); } }); } diff --git a/js/utils.js b/js/utils.js index 74553f06..5044447d 100644 --- a/js/utils.js +++ b/js/utils.js @@ -10,7 +10,8 @@ var Utils = { colors: { warn: colors.yellow, error: colors.red, - info: colors.blue + info: colors.blue, + pass: colors.green } }; From 49ff92892fbe72fb392713dd213f3be8ac08a5d3 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 08:52:49 +0200 Subject: [PATCH 26/41] Warn user if he uses the sample value in the config for the apiid --- modules/default/weatherforecast/weatherforecast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 3ff239ef..511d226f 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -103,7 +103,7 @@ Module.register("weatherforecast", { getDom: function () { var wrapper = document.createElement("div"); - if (this.config.appid === "") { + if (this.config.appid === "" || this.config.appid === "YOUR_OPENWEATHER_API_KEY") { wrapper.innerHTML = "Please set the correct openweather appid in the config for module: " + this.name + "."; wrapper.className = "dimmed light small"; return wrapper; From fd3f520e95fedba6b5feaf637e3c4af375d8a18c Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 10:43:58 +0200 Subject: [PATCH 27/41] Fix typos --- modules/default/weather/README.md | 2 +- tests/configs/modules/positions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default/weather/README.md b/modules/default/weather/README.md index 93f1595d..aebf0863 100755 --- a/modules/default/weather/README.md +++ b/modules/default/weather/README.md @@ -1,5 +1,5 @@ # Weather Module -This module aims to be the replacement for the current `currentweather` and `weatherforcast` modules. The module will be configurable to be used as a current weather view, or to show the forecast. This way the module can be used twice to fullfil both purposes. +This module aims to be the replacement for the current `currentweather` and `weatherforcast` modules. The module will be configurable to be used as a current weather view, or to show the forecast. This way the module can be used twice to fulfill both purposes. For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/weather.html). diff --git a/tests/configs/modules/positions.js b/tests/configs/modules/positions.js index bbb07da8..92a2201a 100644 --- a/tests/configs/modules/positions.js +++ b/tests/configs/modules/positions.js @@ -20,7 +20,7 @@ var config = { }, modules: - // Using exotic content. This is why dont accept go to JSON configuration file + // Using exotic content. This is why don't accept go to JSON configuration file (function () { var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"]; var modules = Array(); From 5aa7097a6ecea0d325bd557229894e2a4649c039 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 12:20:16 +0200 Subject: [PATCH 28/41] Add test for displaying the header --- tests/configs/modules/display.js | 42 +++++++++++++++++++++++++++++++ tests/e2e/modules_display_spec.js | 41 ++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 tests/configs/modules/display.js create mode 100644 tests/e2e/modules_display_spec.js diff --git a/tests/configs/modules/display.js b/tests/configs/modules/display.js new file mode 100644 index 00000000..6550becc --- /dev/null +++ b/tests/configs/modules/display.js @@ -0,0 +1,42 @@ +/* Magic Mirror Test config for display setters module using the helloworld module + * + * MIT Licensed. + */ +var config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 24, + units: "metric", + electronOptions: { + fullscreen: false, + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true + } + }, + + modules: [ + { + module: "helloworld", + position: "top_bar", + header: "test_header", + config: { + text: "Test Display Header" + } + }, + { + module: "helloworld", + position: "bottom_bar", + config: { + text: "Test Hide Header" + } + } + ] +}; +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules_display_spec.js b/tests/e2e/modules_display_spec.js new file mode 100644 index 00000000..9497c60b --- /dev/null +++ b/tests/e2e/modules_display_spec.js @@ -0,0 +1,41 @@ +const helpers = require("./global-setup"); + +const describe = global.describe; +const it = global.it; + +describe("Display of modules", function () { + helpers.setupTimeout(this); + + var app = null; + + beforeEach(function () { + return helpers + .startApplication({ + args: ["js/electron.js"] + }) + .then(function (startedApp) { + app = startedApp; + }); + }); + + afterEach(function () { + return helpers.stopApplication(app); + }); + + describe("Using helloworld", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/display.js"; + }); + + it("should show the test header", async () => { + await app.client.waitForExist("#module_0_helloworld", 10000); + return app.client.element("#module_0_helloworld .module-header").isVisible().should.eventually.equal(true).getText("#module_0_helloworld .module-header").should.eventually.equal("TEST_HEADER"); + }); + + it("should show no header if no header text is specified", async () => { + await app.client.waitForExist("#module_1_helloworld", 10000); + return app.client.element("#module_1_helloworld .module-header").isVisible().should.eventually.equal(false); + }); + }); +}); From 86fb1b938baac8ac0efa7c89d06d9bdfac7f8afa Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 12:30:59 +0200 Subject: [PATCH 29/41] Check for undefined header data in weather modules --- modules/default/currentweather/currentweather.js | 13 ++++++++----- modules/default/weather/weather.js | 7 ++++--- modules/default/weatherforecast/weatherforecast.js | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index d9d06ccb..0a43b23e 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -37,6 +37,8 @@ Module.register("currentweather", { weatherEndpoint: "weather", appendLocationNameToHeader: true, + useLocationAsHeader: false, + calendarClass: "calendar", tableClass: "large", @@ -267,15 +269,16 @@ Module.register("currentweather", { // Override getHeader method. getHeader: function () { - if (this.config.appendLocationNameToHeader && this.data.header !== undefined) { - return this.data.header + " " + this.fetchedLocationName; - } - if (this.config.useLocationAsHeader && this.config.location !== false) { return this.config.location; } - return this.data.header; + if (this.config.appendLocationNameToHeader) { + if (this.data.header) return this.data.header + " " + this.fetchedLocationName; + else return this.fetchedLocationName; + } + + return this.data.header ? this.data.header : ""; }, // Override notification handler. diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 73c493e0..b1346a48 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -73,11 +73,12 @@ Module.register("weather", { // Override getHeader method. getHeader: function () { - if (this.config.appendLocationNameToHeader && this.data.header !== undefined && this.weatherProvider) { - return this.data.header + " " + this.weatherProvider.fetchedLocation(); + if (this.config.appendLocationNameToHeader && this.weatherProvider) { + if (this.data.header) return this.data.header + " " + this.weatherProvider.fetchedLocation(); + else return this.weatherProvider.fetchedLocation(); } - return this.data.header; + return this.data.header ? this.data.header : ""; }, // Start the weather module. diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 511d226f..4ecc18aa 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -206,10 +206,11 @@ Module.register("weatherforecast", { // Override getHeader method. getHeader: function () { if (this.config.appendLocationNameToHeader) { - return this.data.header + " " + this.fetchedLocationName; + if (this.data.header) return this.data.header + " " + this.fetchedLocationName; + else return this.fetchedLocationName; } - return this.data.header; + return this.data.header ? this.data.header : ""; }, // Override notification handler. From ec08cb32aa880f09d772c8cd869e7e0d2faf194f Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 12:31:48 +0200 Subject: [PATCH 30/41] Set visibility of header more explicitly --- js/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index a02e6496..9d241a07 100644 --- a/js/main.js +++ b/js/main.js @@ -42,6 +42,8 @@ var MM = (function () { if (typeof module.getHeader() === "undefined" || module.getHeader() !== "") { moduleHeader.style.display = "none;"; + } else { + moduleHeader.style.display = "block;"; } var moduleContent = document.createElement("div"); @@ -218,7 +220,7 @@ var MM = (function () { headerWrapper[0].innerHTML = newHeader; if (headerWrapper.length > 0 && newHeader) { - delete headerWrapper[0].style; + headerWrapper[0].style.display = "block"; } else { headerWrapper[0].style.display = "none"; } From 16c5eba2be7c378ca06278b197942d9ba6381393 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 12:42:31 +0200 Subject: [PATCH 31/41] Update Changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fad75bd0..469c8074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,12 +30,13 @@ _This release is scheduled to be released on 2020-10-01._ ### Fixed -- Fix backward compatibility issues for Safari < 11. [#1985](https://github.com/MichMich/MagicMirror/issues/1985) +- Fix backward compatibility issues for Safari < 11. - Fix the use of "maxNumberOfDays" in the module "weatherforecast depending on the endpoint (forecast/daily or forecast)". [#2018](https://github.com/MichMich/MagicMirror/issues/2018) - Fix calendar display. Account for current timezone. [#2068](https://github.com/MichMich/MagicMirror/issues/2068) - Fix logLevel being set before loading config. - Fix incorrect namespace links in svg clockfaces. [#2072](https://github.com/MichMich/MagicMirror/issues/2072) -- Fix weather/providers/weathergov for API guidelines [#2045] +- Fix weather/providers/weathergov for API guidelines. [#2045](https://github.com/MichMich/MagicMirror/issues/2045) +- Fix "undefined" in weather modules header. [#1985](https://github.com/MichMich/MagicMirror/issues/1985) ## [2.12.0] - 2020-07-01 From 8ce37d53cd8a452c3098b58be7126861b6d8d180 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:04:35 +0100 Subject: [PATCH 32/41] fix recurring full date events --- modules/default/calendar/calendarfetcher.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 4a6fb0e6..f320fbcd 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -184,8 +184,17 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu // For recurring events, get the set of start dates that fall within the range // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time - const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); - const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); + let pastLocal = 0 + let futureLocal = 0 + if(isFullDayEvent(event)){ + // if full day event, only use the date part of the ranges + pastLocal = pastMoment.toDate(); + futureLocal = futureMoment.toDate() + } + else { + pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); + futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); + } const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); const dates = datesLocal.map(function (dateLocal) { return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate(); @@ -217,6 +226,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu const dateKey = date.toISOString().substring(0, 10); let curEvent = event; let showRecurrence = true; + let duration = 0; startDate = moment(date); From 11fbbd49f3a6178c255e38426d2ef14d2c25000f Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:10:25 +0100 Subject: [PATCH 33/41] add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4ee497..a6d1247a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² +### fixed + +- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day ## [2.12.0] - 2020-07-01 From c3382274a290b0fddebab59b92a99227f99c70f5 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 14:40:07 +0100 Subject: [PATCH 34/41] remove old master branch code --- modules/default/calendar/calendarfetcher.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index f320fbcd..e6e13916 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -195,10 +195,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); } - const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); - const dates = datesLocal.map(function (dateLocal) { - return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate(); - }); + const dates = rule.between(pastLocal, futureLocal, true, limitFunction); // The "dates" array contains the set of dates within our desired date range range that are valid // for the recurrence rule. *However*, it's possible for us to have a specific recurrence that From 7bec84f767df2c70c60ccb5953a122d78cf8646f Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Tue, 1 Sep 2020 21:00:14 +0100 Subject: [PATCH 35/41] fix formatting, prettier did not run --- modules/default/calendar/calendarfetcher.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 0f8cfb24..3c0c3cd2 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -202,13 +202,13 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn // For recurring events, get the set of start dates that fall within the range // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time - let pastLocal = 0 - let futureLocal = 0 - if(isFullDayEvent(event)){ + let pastLocal = 0; + let futureLocal = 0; + if( isFullDayEvent(event)) { // if full day event, only use the date part of the ranges pastLocal = pastMoment.toDate(); - futureLocal = futureMoment.toDate() - } + futureLocal = futureMoment.toDate(); + } else { pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); From f09b89f97527d538e4ef5eeb178ca7d7553ed6d0 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Tue, 1 Sep 2020 15:13:42 -0500 Subject: [PATCH 36/41] fix , prettier not run --- modules/default/calendar/calendarfetcher.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 3c0c3cd2..a67dc99b 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -203,13 +203,12 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn // of dates we're looking for. // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time let pastLocal = 0; - let futureLocal = 0; - if( isFullDayEvent(event)) { + let futureLocal = 0; + if (isFullDayEvent(event)) { // if full day event, only use the date part of the ranges pastLocal = pastMoment.toDate(); - futureLocal = futureMoment.toDate(); - } - else { + futureLocal = futureMoment.toDate(); + } else { pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); } From 1a210278509680ecf8df23b56894d17f9fdc6ef7 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 2 Sep 2020 09:03:46 +0200 Subject: [PATCH 37/41] Fix Prettier issues. --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b971805a..7756977a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² -### fixed -- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day +### fixed + +- 2110, 2111, 2118 recurring full day events should not use timezone adjustment. just compare month/day ## [2.13.0] - Unreleased (Develop Branch - Please add your contributions to this release.) From 45f09dcc8c78c3c2aaee9f9057aebcda56c0be95 Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 21 Jul 2020 11:27:45 +0200 Subject: [PATCH 38/41] Add test for analog clock face --- tests/configs/modules/clock/clock_analog.js | 33 +++++++++++++++++++++ tests/e2e/modules/clock_spec.js | 30 ++++++++++++++----- 2 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 tests/configs/modules/clock/clock_analog.js diff --git a/tests/configs/modules/clock/clock_analog.js b/tests/configs/modules/clock/clock_analog.js new file mode 100644 index 00000000..a353e0f4 --- /dev/null +++ b/tests/configs/modules/clock/clock_analog.js @@ -0,0 +1,33 @@ +/* Magic Mirror Test config for analog clock face + * + * MIT Licensed. + */ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 24, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true + } + }, + + modules: [ + { + module: "clock", + position: "middle_center", + config: { + displayType: "analog", + analogFace: "face-006" + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/clock_spec.js b/tests/e2e/modules/clock_spec.js index 372d61af..fb3cae37 100644 --- a/tests/e2e/modules/clock_spec.js +++ b/tests/e2e/modules/clock_spec.js @@ -1,4 +1,5 @@ const helpers = require("../global-setup"); +const expect = require("chai").expect; const describe = global.describe; const it = global.it; @@ -30,12 +31,12 @@ describe("Clock module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js"; }); - it("shows date with correct format", function () { + it("should show the date in the correct format", function () { const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/; return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex); }); - it("shows time in 24hr format", function () { + it("should show the time in 24hr format", function () { const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/; return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex); }); @@ -47,12 +48,12 @@ describe("Clock module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js"; }); - it("shows date with correct format", function () { + it("should show the date in the correct format", function () { const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/; return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex); }); - it("shows time in 12hr format", function () { + it("should show the time in 12hr format", function () { const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/; return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex); }); @@ -64,7 +65,7 @@ describe("Clock module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js"; }); - it("shows 12hr time with upper case AM/PM", function () { + it("should show 12hr time with upper case AM/PM", function () { const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/; return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex); }); @@ -76,7 +77,7 @@ describe("Clock module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js"; }); - it("shows 12hr time without seconds am/pm", function () { + it("should show 12hr time without seconds am/pm", function () { const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/; return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex); }); @@ -88,12 +89,12 @@ describe("Clock module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js"; }); - it("shows week with correct format", function () { + it("should show the week in the correct format", function () { const weekRegex = /^Week [0-9]{1,2}$/; return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex); }); - it("shows week with correct number of week of year", function () { + it("should show the week with the correct number of week of year", function () { it("FIXME: if the day is a sunday this not match"); // const currentWeekNumber = require("current-week-number")(); // const weekToShow = "Week " + currentWeekNumber; @@ -101,4 +102,17 @@ describe("Clock module", function () { // .getText(".clock .week").should.eventually.equal(weekToShow); }); }); + + describe("with analog clock face enabled", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_analog.js"; + }); + + it("should show the analog clock face", async () => { + await app.client.waitUntilWindowLoaded(10000); + const clock = await app.client.$$(".clockCircle"); + return expect(clock.length).equals(1); + }); + }); }); From a1a4192835a23116d3d7cf9b7e72313d458f8195 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 2 Aug 2020 15:19:36 +0200 Subject: [PATCH 39/41] Fix clock test, remove now unneeded dependency --- package-lock.json | 6 ------ package.json | 1 - tests/e2e/modules/clock_spec.js | 9 ++++----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3214e7a..5283bf04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1745,12 +1745,6 @@ "cssom": "0.3.x" } }, - "current-week-number": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/current-week-number/-/current-week-number-1.0.7.tgz", - "integrity": "sha1-VnJ4rrX+WN7LFQuayGT5Pc5O2XI=", - "dev": true - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", diff --git a/package.json b/package.json index f2e95b7c..bc47eb01 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "@prantlf/jsonlint": "^10.2.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "current-week-number": "^1.0.7", "danger": "^3.1.3", "eslint-config-prettier": "^6.11.0", "eslint-plugin-jsdoc": "^30.1.0", diff --git a/tests/e2e/modules/clock_spec.js b/tests/e2e/modules/clock_spec.js index fb3cae37..2bf148c6 100644 --- a/tests/e2e/modules/clock_spec.js +++ b/tests/e2e/modules/clock_spec.js @@ -1,5 +1,6 @@ const helpers = require("../global-setup"); const expect = require("chai").expect; +const moment = require("moment"); const describe = global.describe; const it = global.it; @@ -95,11 +96,9 @@ describe("Clock module", function () { }); it("should show the week with the correct number of week of year", function () { - it("FIXME: if the day is a sunday this not match"); - // const currentWeekNumber = require("current-week-number")(); - // const weekToShow = "Week " + currentWeekNumber; - // return app.client.waitUntilWindowLoaded() - // .getText(".clock .week").should.eventually.equal(weekToShow); + const currentWeekNumber = moment().week(); + const weekToShow = "Week " + currentWeekNumber; + return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.equal(weekToShow); }); }); From 259068b8604f745794841a4097fa1e07d1e73efb Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 2 Aug 2020 15:23:22 +0200 Subject: [PATCH 40/41] Remove unused dependency, update eslint --- package-lock.json | 24 +++--------------------- package.json | 3 +-- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5283bf04..28eb8197 100644 --- a/package-lock.json +++ b/package-lock.json @@ -601,24 +601,6 @@ "url-template": "^2.0.8" } }, - "@prantlf/jsonlint": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@prantlf/jsonlint/-/jsonlint-10.2.0.tgz", - "integrity": "sha512-KMFfds0peWLLfCu3bhClTiEN0tdj/Z86QJvn1awKHws6r+Sx6T3a44Eadz6OvqN6ZpsRkqaRpZxqddvvDAdDZQ==", - "dev": true, - "requires": { - "ajv": "6.10.2", - "commander": "4.0.1" - }, - "dependencies": { - "commander": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.0.1.tgz", - "integrity": "sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==", - "dev": true - } - } - }, "@stylelint/postcss-css-in-js": { "version": "0.37.1", "resolved": "https://registry.npmjs.org/@stylelint/postcss-css-in-js/-/postcss-css-in-js-0.37.1.tgz", @@ -2378,9 +2360,9 @@ } }, "eslint": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.5.0.tgz", - "integrity": "sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.6.0.tgz", + "integrity": "sha512-QlAManNtqr7sozWm5TF4wIH9gmUm2hE3vNRUvyoYAa4y1l5/jxD/PQStEjBMQtCqZmSep8UxrcecI60hOpe61w==", "requires": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", diff --git a/package.json b/package.json index bc47eb01..5eb4d6b4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ }, "homepage": "https://magicmirror.builders", "devDependencies": { - "@prantlf/jsonlint": "^10.2.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "danger": "^3.1.3", @@ -70,7 +69,7 @@ "dependencies": { "colors": "^1.1.2", "console-stamp": "^0.2.9", - "eslint": "^7.5.0", + "eslint": "^7.6.0", "express": "^4.16.2", "express-ipfilter": "^1.0.1", "feedme": "latest", From 14e8cdd9b2abdd55c63e869a35eaca4651e2e79e Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 2 Aug 2020 15:39:10 +0200 Subject: [PATCH 41/41] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b30f02fc..69291828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ _This release is scheduled to be released on 2020-10-01._ - Change incorrect weather.js default properties. - Cleaned up newsfeed module. - Cleaned up jsdoc comments. +- Cleaned up clock tests. ### Deleted