Merge pull request #2010 from rejas/no_undef_and_more

Cleanup eslints no-undef warnings Part 2
This commit is contained in:
Michael Teeuw 2020-05-05 15:16:27 +02:00 committed by GitHub
commit b38b879ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 19 additions and 30 deletions

View File

@ -10,6 +10,7 @@
"config": true,
"Log": true,
"MM": true,
"Module": true,
"moment": true
},
"parserOptions": {

View File

@ -1,4 +1,4 @@
/* global defaultModules, Module, vendor */
/* global defaultModules, vendor */
/* Magic Mirror
* Module and File loaders.

View File

@ -1,4 +1,4 @@
/* global Loader, Module, defaults, Translator */
/* global Loader, defaults, Translator */
/* Magic Mirror
* Main System

View File

@ -1,4 +1,4 @@
/* global Module, NotificationFx */
/* global NotificationFx */
/* Magic Mirror
* Module: alert

View File

@ -1,4 +1,4 @@
/* global cloneObject, Module */
/* global cloneObject */
/* Magic Mirror
* Module: Calendar

View File

@ -1,4 +1,4 @@
/* global Module, SunCalc */
/* global SunCalc */
/* Magic Mirror
* Module: Clock

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: Compliments
*

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: CurrentWeather
*

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: HelloWorld
*

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: NewsFeed
*

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: UpdateNotification
*

View File

@ -1,4 +1,4 @@
/* global WeatherProvider */
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
* Module: Weather

View File

@ -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

View File

@ -1,4 +1,4 @@
/* global WeatherProvider, WeatherObject */
/* global WeatherProvider, WeatherObject, SunCalc */
/* Magic Mirror
* Module: Weather

View File

@ -1,4 +1,4 @@
/* global Module, WeatherProvider */
/* global WeatherProvider */
/* Magic Mirror
* Module: Weather

View File

@ -1,5 +1,3 @@
/* global Module */
/* Magic Mirror
* Module: WeatherForecast
*

View File

@ -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],

View File

@ -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&hellip;" },
"long string that needs shortening": { length: 16, return: "long string that&hellip;" },
"short string": { length: 16, return: "short string" },

View File

@ -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",

View File

@ -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);
});
});