mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #2010 from rejas/no_undef_and_more
Cleanup eslints no-undef warnings Part 2
This commit is contained in:
commit
b38b879ee3
@ -10,6 +10,7 @@
|
||||
"config": true,
|
||||
"Log": true,
|
||||
"MM": true,
|
||||
"Module": true,
|
||||
"moment": true
|
||||
},
|
||||
"parserOptions": {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global defaultModules, Module, vendor */
|
||||
/* global defaultModules, vendor */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module and File loaders.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global Loader, Module, defaults, Translator */
|
||||
/* global Loader, defaults, Translator */
|
||||
|
||||
/* Magic Mirror
|
||||
* Main System
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global Module, NotificationFx */
|
||||
/* global NotificationFx */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: alert
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global cloneObject, Module */
|
||||
/* global cloneObject */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Calendar
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global Module, SunCalc */
|
||||
/* global SunCalc */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Clock
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Compliments
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: CurrentWeather
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: HelloWorld
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: NewsFeed
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: UpdateNotification
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global WeatherProvider */
|
||||
/* global WeatherProvider, WeatherObject */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Weather
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global WeatherProvider, WeatherObject */
|
||||
/* global WeatherProvider, WeatherObject, SunCalc */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Weather
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global Module, WeatherProvider */
|
||||
/* global WeatherProvider */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: Weather
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Module */
|
||||
|
||||
/* Magic Mirror
|
||||
* Module: WeatherForecast
|
||||
*
|
||||
|
@ -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],
|
||||
|
@ -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" },
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user