mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +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,
|
"config": true,
|
||||||
"Log": true,
|
"Log": true,
|
||||||
"MM": true,
|
"MM": true,
|
||||||
|
"Module": true,
|
||||||
"moment": true
|
"moment": true
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global defaultModules, Module, vendor */
|
/* global defaultModules, vendor */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module and File loaders.
|
* Module and File loaders.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global Loader, Module, defaults, Translator */
|
/* global Loader, defaults, Translator */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Main System
|
* Main System
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global Module, NotificationFx */
|
/* global NotificationFx */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: alert
|
* Module: alert
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global cloneObject, Module */
|
/* global cloneObject */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Calendar
|
* Module: Calendar
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global Module, SunCalc */
|
/* global SunCalc */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Clock
|
* Module: Clock
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Compliments
|
* Module: Compliments
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: CurrentWeather
|
* Module: CurrentWeather
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: HelloWorld
|
* Module: HelloWorld
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: NewsFeed
|
* Module: NewsFeed
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: UpdateNotification
|
* Module: UpdateNotification
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global WeatherProvider */
|
/* global WeatherProvider, WeatherObject */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Weather
|
* Module: Weather
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global WeatherProvider, WeatherObject */
|
/* global WeatherProvider, WeatherObject, SunCalc */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Weather
|
* Module: Weather
|
||||||
@ -82,7 +82,7 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
let timeInMins = nowUtc.diff(midnightUtc, "minutes");
|
let timeInMins = nowUtc.diff(midnightUtc, "minutes");
|
||||||
|
|
||||||
// loop round each of the (5) periods, look for today (the first period may be yesterday)
|
// 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");
|
let periodDate = moment.utc(currentWeatherData.SiteRep.DV.Location.Period[i].value.substr(0,10), "YYYY-MM-DD");
|
||||||
|
|
||||||
// ignore if period is before today
|
// ignore if period is before today
|
||||||
@ -92,7 +92,7 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
if (moment().diff(periodDate, "minutes") > 0) {
|
if (moment().diff(periodDate, "minutes") > 0) {
|
||||||
// loop round the reports looking for the one we are in
|
// loop round the reports looking for the one we are in
|
||||||
// $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260
|
// $ 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].$;
|
let p = currentWeatherData.SiteRep.DV.Location.Period[i].Rep[j].$;
|
||||||
if (timeInMins >= p && timeInMins-180 < p) {
|
if (timeInMins >= p && timeInMins-180 < p) {
|
||||||
// finally got the one we want, so populate weather object
|
// 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
|
// loop round the (5) periods getting the data
|
||||||
// for each period array, Day is [0], Night is [1]
|
// 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);
|
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
|
||||||
|
|
||||||
// data times are always UTC
|
// 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");
|
let periodDate = moment.utc(dateStr.substr(0,10), "YYYY-MM-DD");
|
||||||
|
|
||||||
// ignore if period is before today
|
// ignore if period is before today
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global WeatherProvider, WeatherObject */
|
/* global WeatherProvider, WeatherObject, SunCalc */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Weather
|
* Module: Weather
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global Module, WeatherProvider */
|
/* global WeatherProvider */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Weather
|
* Module: Weather
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global Module */
|
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: WeatherForecast
|
* Module: WeatherForecast
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@ var config = {
|
|||||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||||
var modules = Array();
|
var modules = Array();
|
||||||
for (idx in positions) {
|
for (var idx in positions) {
|
||||||
modules.push({
|
modules.push({
|
||||||
module: "helloworld",
|
module: "helloworld",
|
||||||
position: positions[idx],
|
position: positions[idx],
|
||||||
|
@ -17,7 +17,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("capFirst", function() {
|
describe("capFirst", function() {
|
||||||
words = {
|
const words = {
|
||||||
"rodrigo": "Rodrigo",
|
"rodrigo": "Rodrigo",
|
||||||
"123m": "123m",
|
"123m": "123m",
|
||||||
"magic mirror": "Magic mirror",
|
"magic mirror": "Magic mirror",
|
||||||
@ -89,7 +89,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("shorten", function() {
|
describe("shorten", function() {
|
||||||
strings = {
|
const strings = {
|
||||||
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" },
|
" 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…" },
|
"long string that needs shortening": { length: 16, return: "long string that…" },
|
||||||
"short string": { length: 16, return: "short string" },
|
"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");
|
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||||
|
|
||||||
describe("capitalizeFirstLetter", function() {
|
describe("capitalizeFirstLetter", function() {
|
||||||
words = {
|
const words = {
|
||||||
"rodrigo": "Rodrigo",
|
"rodrigo": "Rodrigo",
|
||||||
"123m": "123m",
|
"123m": "123m",
|
||||||
"magic mirror": "Magic mirror",
|
"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() {
|
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);
|
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user