diff --git a/.eslintrc.json b/.eslintrc.json index a63980e7..00fae289 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,6 +10,7 @@ "config": true, "Log": true, "MM": true, + "Module": true, "moment": true }, "parserOptions": { diff --git a/js/loader.js b/js/loader.js index 7199fe88..c69f92ae 100644 --- a/js/loader.js +++ b/js/loader.js @@ -1,4 +1,4 @@ -/* global defaultModules, Module, vendor */ +/* global defaultModules, vendor */ /* Magic Mirror * Module and File loaders. diff --git a/js/main.js b/js/main.js index 271a3be7..117aed10 100644 --- a/js/main.js +++ b/js/main.js @@ -1,4 +1,4 @@ -/* global Loader, Module, defaults, Translator */ +/* global Loader, defaults, Translator */ /* Magic Mirror * Main System diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index 3ec8c8f7..66b88601 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -1,4 +1,4 @@ -/* global Module, NotificationFx */ +/* global NotificationFx */ /* Magic Mirror * Module: alert diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 0f042051..24a2c45d 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -1,4 +1,4 @@ -/* global cloneObject, Module */ +/* global cloneObject */ /* Magic Mirror * Module: Calendar diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 6c4e2ff6..1b9a2a12 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -1,4 +1,4 @@ -/* global Module, SunCalc */ +/* global SunCalc */ /* Magic Mirror * Module: Clock diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 5b79c09a..ff245eef 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: Compliments * diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index b49b8e8b..d24a92b4 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: CurrentWeather * diff --git a/modules/default/helloworld/helloworld.js b/modules/default/helloworld/helloworld.js index 3d1c17e7..72474577 100644 --- a/modules/default/helloworld/helloworld.js +++ b/modules/default/helloworld/helloworld.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: HelloWorld * diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 5926c712..edbac68d 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: NewsFeed * diff --git a/modules/default/updatenotification/updatenotification.js b/modules/default/updatenotification/updatenotification.js index c720ae3d..0c4e2ad9 100644 --- a/modules/default/updatenotification/updatenotification.js +++ b/modules/default/updatenotification/updatenotification.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: UpdateNotification * diff --git a/modules/default/weather/providers/darksky.js b/modules/default/weather/providers/darksky.js index 9dbe49b4..ea36da28 100755 --- a/modules/default/weather/providers/darksky.js +++ b/modules/default/weather/providers/darksky.js @@ -1,4 +1,4 @@ -/* global WeatherProvider */ +/* global WeatherProvider, WeatherObject */ /* Magic Mirror * Module: Weather diff --git a/modules/default/weather/providers/ukmetoffice.js b/modules/default/weather/providers/ukmetoffice.js index 54ebed16..17cc463e 100755 --- a/modules/default/weather/providers/ukmetoffice.js +++ b/modules/default/weather/providers/ukmetoffice.js @@ -1,4 +1,4 @@ -/* global WeatherProvider, WeatherObject */ +/* global WeatherProvider, WeatherObject, SunCalc */ /* Magic Mirror * Module: Weather @@ -82,7 +82,7 @@ WeatherProvider.register("ukmetoffice", { let timeInMins = nowUtc.diff(midnightUtc, "minutes"); // loop round each of the (5) periods, look for today (the first period may be yesterday) - for (i in currentWeatherData.SiteRep.DV.Location.Period) { + for (var i in currentWeatherData.SiteRep.DV.Location.Period) { let periodDate = moment.utc(currentWeatherData.SiteRep.DV.Location.Period[i].value.substr(0,10), "YYYY-MM-DD"); // ignore if period is before today @@ -92,7 +92,7 @@ WeatherProvider.register("ukmetoffice", { if (moment().diff(periodDate, "minutes") > 0) { // loop round the reports looking for the one we are in // $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260 - for (j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){ + for (var j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){ let p = currentWeatherData.SiteRep.DV.Location.Period[i].Rep[j].$; if (timeInMins >= p && timeInMins-180 < p) { // finally got the one we want, so populate weather object @@ -126,11 +126,11 @@ WeatherProvider.register("ukmetoffice", { // loop round the (5) periods getting the data // for each period array, Day is [0], Night is [1] - for (j in forecasts.SiteRep.DV.Location.Period) { + for (var j in forecasts.SiteRep.DV.Location.Period) { const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits); // data times are always UTC - dateStr = forecasts.SiteRep.DV.Location.Period[j].value; + const dateStr = forecasts.SiteRep.DV.Location.Period[j].value; let periodDate = moment.utc(dateStr.substr(0,10), "YYYY-MM-DD"); // ignore if period is before today diff --git a/modules/default/weather/providers/weathergov.js b/modules/default/weather/providers/weathergov.js index 568e2f47..68211b56 100755 --- a/modules/default/weather/providers/weathergov.js +++ b/modules/default/weather/providers/weathergov.js @@ -1,4 +1,4 @@ -/* global WeatherProvider, WeatherObject */ +/* global WeatherProvider, WeatherObject, SunCalc */ /* Magic Mirror * Module: Weather diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index a28b7ab5..6e277447 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -1,4 +1,4 @@ -/* global Module, WeatherProvider */ +/* global WeatherProvider */ /* Magic Mirror * Module: Weather diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 7624e671..8df266a0 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -1,5 +1,3 @@ -/* global Module */ - /* Magic Mirror * Module: WeatherForecast * diff --git a/tests/configs/modules/positions.js b/tests/configs/modules/positions.js index d2bf5ee9..1d36a0c0 100644 --- a/tests/configs/modules/positions.js +++ b/tests/configs/modules/positions.js @@ -26,7 +26,7 @@ var config = { "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"]; var modules = Array(); - for (idx in positions) { + for (var idx in positions) { modules.push({ module: "helloworld", position: positions[idx], diff --git a/tests/unit/functions/calendar_spec.js b/tests/unit/functions/calendar_spec.js index 6e4fe988..8c8df684 100644 --- a/tests/unit/functions/calendar_spec.js +++ b/tests/unit/functions/calendar_spec.js @@ -17,7 +17,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() { }); describe("capFirst", function() { - words = { + const words = { "rodrigo": "Rodrigo", "123m": "123m", "magic mirror": "Magic mirror", @@ -89,7 +89,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() { }); describe("shorten", function() { - strings = { + const strings = { " String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" }, "long string that needs shortening": { length: 16, return: "long string that…" }, "short string": { length: 16, return: "short string" }, diff --git a/tests/unit/functions/newsfeed_spec.js b/tests/unit/functions/newsfeed_spec.js index c6bb34f2..937f57ee 100644 --- a/tests/unit/functions/newsfeed_spec.js +++ b/tests/unit/functions/newsfeed_spec.js @@ -12,7 +12,7 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function() { require("../../../modules/default/newsfeed/newsfeed.js"); describe("capitalizeFirstLetter", function() { - words = { + const words = { "rodrigo": "Rodrigo", "123m": "123m", "magic mirror": "Magic mirror", diff --git a/tests/unit/global_vars/root_path_spec.js b/tests/unit/global_vars/root_path_spec.js index f5469e80..3f162dfe 100644 --- a/tests/unit/global_vars/root_path_spec.js +++ b/tests/unit/global_vars/root_path_spec.js @@ -62,7 +62,7 @@ describe("'global.root_path' set in js/app.js", function() { }); it("should expect the global.version equals package.json file", function() { - versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version; + const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version; expect(this.sandbox.global.version).to.equal(versionPackage); }); });