Skip to content

Commit b38b879

Browse files
authored
Merge pull request MagicMirrorOrg#2010 from rejas/no_undef_and_more
Cleanup eslints no-undef warnings Part 2
2 parents c8aedc6 + 7fc7d62 commit b38b879

File tree

20 files changed

+19
-30
lines changed

20 files changed

+19
-30
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"config": true,
1111
"Log": true,
1212
"MM": true,
13+
"Module": true,
1314
"moment": true
1415
},
1516
"parserOptions": {

js/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global defaultModules, Module, vendor */
1+
/* global defaultModules, vendor */
22

33
/* Magic Mirror
44
* Module and File loaders.

js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Loader, Module, defaults, Translator */
1+
/* global Loader, defaults, Translator */
22

33
/* Magic Mirror
44
* Main System

modules/default/alert/alert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Module, NotificationFx */
1+
/* global NotificationFx */
22

33
/* Magic Mirror
44
* Module: alert

modules/default/calendar/calendar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cloneObject, Module */
1+
/* global cloneObject */
22

33
/* Magic Mirror
44
* Module: Calendar

modules/default/clock/clock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Module, SunCalc */
1+
/* global SunCalc */
22

33
/* Magic Mirror
44
* Module: Clock

modules/default/compliments/compliments.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: Compliments
53
*

modules/default/currentweather/currentweather.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: CurrentWeather
53
*

modules/default/helloworld/helloworld.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: HelloWorld
53
*

modules/default/newsfeed/newsfeed.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: NewsFeed
53
*

modules/default/updatenotification/updatenotification.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: UpdateNotification
53
*

modules/default/weather/providers/darksky.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global WeatherProvider */
1+
/* global WeatherProvider, WeatherObject */
22

33
/* Magic Mirror
44
* Module: Weather

modules/default/weather/providers/ukmetoffice.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global WeatherProvider, WeatherObject */
1+
/* global WeatherProvider, WeatherObject, SunCalc */
22

33
/* Magic Mirror
44
* Module: Weather
@@ -82,7 +82,7 @@ WeatherProvider.register("ukmetoffice", {
8282
let timeInMins = nowUtc.diff(midnightUtc, "minutes");
8383

8484
// loop round each of the (5) periods, look for today (the first period may be yesterday)
85-
for (i in currentWeatherData.SiteRep.DV.Location.Period) {
85+
for (var i in currentWeatherData.SiteRep.DV.Location.Period) {
8686
let periodDate = moment.utc(currentWeatherData.SiteRep.DV.Location.Period[i].value.substr(0,10), "YYYY-MM-DD");
8787

8888
// ignore if period is before today
@@ -92,7 +92,7 @@ WeatherProvider.register("ukmetoffice", {
9292
if (moment().diff(periodDate, "minutes") > 0) {
9393
// loop round the reports looking for the one we are in
9494
// $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260
95-
for (j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){
95+
for (var j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){
9696
let p = currentWeatherData.SiteRep.DV.Location.Period[i].Rep[j].$;
9797
if (timeInMins >= p && timeInMins-180 < p) {
9898
// finally got the one we want, so populate weather object
@@ -126,11 +126,11 @@ WeatherProvider.register("ukmetoffice", {
126126

127127
// loop round the (5) periods getting the data
128128
// for each period array, Day is [0], Night is [1]
129-
for (j in forecasts.SiteRep.DV.Location.Period) {
129+
for (var j in forecasts.SiteRep.DV.Location.Period) {
130130
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
131131

132132
// data times are always UTC
133-
dateStr = forecasts.SiteRep.DV.Location.Period[j].value;
133+
const dateStr = forecasts.SiteRep.DV.Location.Period[j].value;
134134
let periodDate = moment.utc(dateStr.substr(0,10), "YYYY-MM-DD");
135135

136136
// ignore if period is before today

modules/default/weather/providers/weathergov.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global WeatherProvider, WeatherObject */
1+
/* global WeatherProvider, WeatherObject, SunCalc */
22

33
/* Magic Mirror
44
* Module: Weather

modules/default/weather/weather.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Module, WeatherProvider */
1+
/* global WeatherProvider */
22

33
/* Magic Mirror
44
* Module: Weather

modules/default/weatherforecast/weatherforecast.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global Module */
2-
31
/* Magic Mirror
42
* Module: WeatherForecast
53
*

tests/configs/modules/positions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var config = {
2626
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
2727
"bottom_bar", "fullscreen_above", "fullscreen_below"];
2828
var modules = Array();
29-
for (idx in positions) {
29+
for (var idx in positions) {
3030
modules.push({
3131
module: "helloworld",
3232
position: positions[idx],

tests/unit/functions/calendar_spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
1717
});
1818

1919
describe("capFirst", function() {
20-
words = {
20+
const words = {
2121
"rodrigo": "Rodrigo",
2222
"123m": "123m",
2323
"magic mirror": "Magic mirror",
@@ -89,7 +89,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
8989
});
9090

9191
describe("shorten", function() {
92-
strings = {
92+
const strings = {
9393
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit&hellip;" },
9494
"long string that needs shortening": { length: 16, return: "long string that&hellip;" },
9595
"short string": { length: 16, return: "short string" },

tests/unit/functions/newsfeed_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
1212
require("../../../modules/default/newsfeed/newsfeed.js");
1313

1414
describe("capitalizeFirstLetter", function() {
15-
words = {
15+
const words = {
1616
"rodrigo": "Rodrigo",
1717
"123m": "123m",
1818
"magic mirror": "Magic mirror",

tests/unit/global_vars/root_path_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe("'global.root_path' set in js/app.js", function() {
6262
});
6363

6464
it("should expect the global.version equals package.json file", function() {
65-
versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
65+
const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
6666
expect(this.sandbox.global.version).to.equal(versionPackage);
6767
});
6868
});

0 commit comments

Comments
 (0)