diff --git a/.eslintrc.json b/.eslintrc.json index eee62330..e5aca766 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "curly": "error", "camelcase": ["error", {"properties": "never"}], "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }], + "no-multi-spaces": "error", "no-trailing-spaces": ["error", {"ignoreComments": false }], "no-irregular-whitespace": ["error"] }, diff --git a/config/config.js.sample b/config/config.js.sample index 67656392..414054da 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -67,7 +67,7 @@ var config = { position: "top_right", config: { location: "New York", - locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city + locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city appid: "YOUR_OPENWEATHER_API_KEY" } }, @@ -77,7 +77,7 @@ var config = { header: "Weather Forecast", config: { location: "New York", - locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city + locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city appid: "YOUR_OPENWEATHER_API_KEY" } }, diff --git a/js/app.js b/js/app.js index ef66a44c..b7c55ffa 100644 --- a/js/app.js +++ b/js/app.js @@ -111,10 +111,10 @@ var App = function() { var elements = module.split("/"); var moduleName = elements[elements.length - 1]; - var moduleFolder = __dirname + "/../modules/" + module; + var moduleFolder = __dirname + "/../modules/" + module; if (defaultModules.indexOf(moduleName) !== -1) { - moduleFolder = __dirname + "/../modules/default/" + module; + moduleFolder = __dirname + "/../modules/default/" + module; } var helperPath = moduleFolder + "/node_helper.js"; @@ -262,7 +262,7 @@ var App = function() { */ process.on("SIGINT", () => { console.log("[SIGINT] Received. Shutting down server..."); - setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds + setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds this.stop(); process.exit(0); }); @@ -271,7 +271,7 @@ var App = function() { */ process.on("SIGTERM", () => { console.log("[SIGTERM] Received. Shutting down server..."); - setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds + setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds this.stop(); process.exit(0); }); diff --git a/js/loader.js b/js/loader.js index 3a4e05c3..6db46ad5 100644 --- a/js/loader.js +++ b/js/loader.js @@ -83,10 +83,10 @@ var Loader = (function() { var elements = module.split("/"); var moduleName = elements[elements.length - 1]; - var moduleFolder = config.paths.modules + "/" + module; + var moduleFolder = config.paths.modules + "/" + module; if (defaultModules.indexOf(moduleName) !== -1) { - moduleFolder = config.paths.modules + "/default/" + module; + moduleFolder = config.paths.modules + "/default/" + module; } if (moduleData.disabled === true) { @@ -172,7 +172,7 @@ var Loader = (function() { */ var loadFile = function(fileName, callback) { - var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1); + var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1); switch (extension.toLowerCase()) { case "js": diff --git a/js/main.js b/js/main.js index de44ccce..f7d1f773 100644 --- a/js/main.js +++ b/js/main.js @@ -377,7 +377,7 @@ var MM = (function() { * * return array - Filtered collection of modules. */ - var exceptWithClass = function(className) { + var exceptWithClass = function(className) { return modulesByClass(className, false); }; @@ -439,10 +439,10 @@ var MM = (function() { }); }; - if (typeof modules.withClass === "undefined") { Object.defineProperty(modules, "withClass", {value: withClass, enumerable: false}); } - if (typeof modules.exceptWithClass === "undefined") { Object.defineProperty(modules, "exceptWithClass", {value: exceptWithClass, enumerable: false}); } - if (typeof modules.exceptModule === "undefined") { Object.defineProperty(modules, "exceptModule", {value: exceptModule, enumerable: false}); } - if (typeof modules.enumerate === "undefined") { Object.defineProperty(modules, "enumerate", {value: enumerate, enumerable: false}); } + if (typeof modules.withClass === "undefined") { Object.defineProperty(modules, "withClass", {value: withClass, enumerable: false}); } + if (typeof modules.exceptWithClass === "undefined") { Object.defineProperty(modules, "exceptWithClass", {value: exceptWithClass, enumerable: false}); } + if (typeof modules.exceptModule === "undefined") { Object.defineProperty(modules, "exceptModule", {value: exceptModule, enumerable: false}); } + if (typeof modules.enumerate === "undefined") { Object.defineProperty(modules, "enumerate", {value: enumerate, enumerable: false}); } }; return { diff --git a/js/node_helper.js b/js/node_helper.js index a083d332..326a8cce 100644 --- a/js/node_helper.js +++ b/js/node_helper.js @@ -101,9 +101,9 @@ NodeHelper = Class.extend({ var onevent = socket.onevent; socket.onevent = function(packet) { var args = packet.data || []; - onevent.call(this, packet); // original call + onevent.call(this, packet); // original call packet.data = ["*"].concat(args); - onevent.call(this, packet); // additional call to catch-all + onevent.call(this, packet); // additional call to catch-all }; // register catch all. diff --git a/js/socketclient.js b/js/socketclient.js index baead68e..10c26ad3 100644 --- a/js/socketclient.js +++ b/js/socketclient.js @@ -14,9 +14,9 @@ var MMSocket = function(moduleName) { var onevent = self.socket.onevent; self.socket.onevent = function(packet) { var args = packet.data || []; - onevent.call(this, packet); // original call + onevent.call(this, packet); // original call packet.data = ["*"].concat(args); - onevent.call(this, packet); // additional call to catch-all + onevent.call(this, packet); // additional call to catch-all }; // register catch all. diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 9c91afe5..98ae5636 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -320,7 +320,7 @@ Module.register("calendar", { } if(this.config.showEnd){ timeWrapper.innerHTML += "-" ; - timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat)); + timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat)); } } else { if (event.startDate >= new Date()) { diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index a9bf37ee..c393d5d6 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -28,7 +28,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); var opts = { headers: { - "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)" + "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)" }, gzip: true }; @@ -249,7 +249,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri showRecurrence = false; } - endDate = moment(parseInt(startDate.format("x")) + duration, "x"); + endDate = moment(parseInt(startDate.format("x")) + duration, "x"); if (startDate.format("x") == endDate.format("x")) { endDate = endDate.endOf("day"); } diff --git a/modules/default/calendar/debug.js b/modules/default/calendar/debug.js index bf65a279..84fc2f86 100644 --- a/modules/default/calendar/debug.js +++ b/modules/default/calendar/debug.js @@ -8,7 +8,7 @@ var CalendarFetcher = require("./calendarfetcher.js"); -var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL +var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL // var url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/"; // URL for Bearer auth (must be configured in Google OAuth2 first) var fetchInterval = 60 * 60 * 1000; var maximumEntries = 10; diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index d358110c..53cb3065 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -213,7 +213,7 @@ Module.register("newsfeed",{ }, getActiveItemURL: function() { - return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href; + return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href; }, /* registerFeeds() diff --git a/modules/default/updatenotification/node_helper.js b/modules/default/updatenotification/node_helper.js index 4386b146..2d41626c 100644 --- a/modules/default/updatenotification/node_helper.js +++ b/modules/default/updatenotification/node_helper.js @@ -27,7 +27,7 @@ module.exports = NodeHelper.create({ for (moduleName in modules) { if (!this.ignoreUpdateChecking(moduleName)) { // Default modules are included in the main MagicMirror repo - var moduleFolder = path.normalize(__dirname + "/../../" + moduleName); + var moduleFolder = path.normalize(__dirname + "/../../" + moduleName); try { //console.log("checking git for module="+moduleName) diff --git a/tests/unit/functions/currentweather_spec.js b/tests/unit/functions/currentweather_spec.js index 0afbbd7b..d630cb9f 100644 --- a/tests/unit/functions/currentweather_spec.js +++ b/tests/unit/functions/currentweather_spec.js @@ -1,3 +1,4 @@ +/* eslint no-multi-spaces: 0 */ var expect = require("chai").expect; describe("Functions module currentweather", function() { diff --git a/tests/unit/functions/weatherforecast_spec.js b/tests/unit/functions/weatherforecast_spec.js index 6c40531e..ea078bc7 100644 --- a/tests/unit/functions/weatherforecast_spec.js +++ b/tests/unit/functions/weatherforecast_spec.js @@ -1,3 +1,4 @@ +/* eslint no-multi-spaces: 0 */ var expect = require("chai").expect; describe("Functions module weatherforecast", function() {