mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Add no-multi-spaces rule to eslint and run it
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
"curly": "error",
|
"curly": "error",
|
||||||
"camelcase": ["error", {"properties": "never"}],
|
"camelcase": ["error", {"properties": "never"}],
|
||||||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
|
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
|
||||||
|
"no-multi-spaces": "error",
|
||||||
"no-trailing-spaces": ["error", {"ignoreComments": false }],
|
"no-trailing-spaces": ["error", {"ignoreComments": false }],
|
||||||
"no-irregular-whitespace": ["error"]
|
"no-irregular-whitespace": ["error"]
|
||||||
},
|
},
|
||||||
|
@@ -67,7 +67,7 @@ var config = {
|
|||||||
position: "top_right",
|
position: "top_right",
|
||||||
config: {
|
config: {
|
||||||
location: "New York",
|
location: "New York",
|
||||||
locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
|
locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
|
||||||
appid: "YOUR_OPENWEATHER_API_KEY"
|
appid: "YOUR_OPENWEATHER_API_KEY"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -77,7 +77,7 @@ var config = {
|
|||||||
header: "Weather Forecast",
|
header: "Weather Forecast",
|
||||||
config: {
|
config: {
|
||||||
location: "New York",
|
location: "New York",
|
||||||
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
|
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
|
||||||
appid: "YOUR_OPENWEATHER_API_KEY"
|
appid: "YOUR_OPENWEATHER_API_KEY"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -111,10 +111,10 @@ var App = function() {
|
|||||||
|
|
||||||
var elements = module.split("/");
|
var elements = module.split("/");
|
||||||
var moduleName = elements[elements.length - 1];
|
var moduleName = elements[elements.length - 1];
|
||||||
var moduleFolder = __dirname + "/../modules/" + module;
|
var moduleFolder = __dirname + "/../modules/" + module;
|
||||||
|
|
||||||
if (defaultModules.indexOf(moduleName) !== -1) {
|
if (defaultModules.indexOf(moduleName) !== -1) {
|
||||||
moduleFolder = __dirname + "/../modules/default/" + module;
|
moduleFolder = __dirname + "/../modules/default/" + module;
|
||||||
}
|
}
|
||||||
|
|
||||||
var helperPath = moduleFolder + "/node_helper.js";
|
var helperPath = moduleFolder + "/node_helper.js";
|
||||||
@@ -262,7 +262,7 @@ var App = function() {
|
|||||||
*/
|
*/
|
||||||
process.on("SIGINT", () => {
|
process.on("SIGINT", () => {
|
||||||
console.log("[SIGINT] Received. Shutting down server...");
|
console.log("[SIGINT] Received. Shutting down server...");
|
||||||
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
|
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
|
||||||
this.stop();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
@@ -271,7 +271,7 @@ var App = function() {
|
|||||||
*/
|
*/
|
||||||
process.on("SIGTERM", () => {
|
process.on("SIGTERM", () => {
|
||||||
console.log("[SIGTERM] Received. Shutting down server...");
|
console.log("[SIGTERM] Received. Shutting down server...");
|
||||||
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
|
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
|
||||||
this.stop();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
@@ -83,10 +83,10 @@ var Loader = (function() {
|
|||||||
|
|
||||||
var elements = module.split("/");
|
var elements = module.split("/");
|
||||||
var moduleName = elements[elements.length - 1];
|
var moduleName = elements[elements.length - 1];
|
||||||
var moduleFolder = config.paths.modules + "/" + module;
|
var moduleFolder = config.paths.modules + "/" + module;
|
||||||
|
|
||||||
if (defaultModules.indexOf(moduleName) !== -1) {
|
if (defaultModules.indexOf(moduleName) !== -1) {
|
||||||
moduleFolder = config.paths.modules + "/default/" + module;
|
moduleFolder = config.paths.modules + "/default/" + module;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moduleData.disabled === true) {
|
if (moduleData.disabled === true) {
|
||||||
@@ -172,7 +172,7 @@ var Loader = (function() {
|
|||||||
*/
|
*/
|
||||||
var loadFile = function(fileName, callback) {
|
var loadFile = function(fileName, callback) {
|
||||||
|
|
||||||
var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
|
var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
|
||||||
|
|
||||||
switch (extension.toLowerCase()) {
|
switch (extension.toLowerCase()) {
|
||||||
case "js":
|
case "js":
|
||||||
|
10
js/main.js
10
js/main.js
@@ -377,7 +377,7 @@ var MM = (function() {
|
|||||||
*
|
*
|
||||||
* return array - Filtered collection of modules.
|
* return array - Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
var exceptWithClass = function(className) {
|
var exceptWithClass = function(className) {
|
||||||
return modulesByClass(className, false);
|
return modulesByClass(className, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -439,10 +439,10 @@ var MM = (function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof modules.withClass === "undefined") { Object.defineProperty(modules, "withClass", {value: withClass, enumerable: false}); }
|
if (typeof modules.withClass === "undefined") { Object.defineProperty(modules, "withClass", {value: withClass, enumerable: false}); }
|
||||||
if (typeof modules.exceptWithClass === "undefined") { Object.defineProperty(modules, "exceptWithClass", {value: exceptWithClass, enumerable: false}); }
|
if (typeof modules.exceptWithClass === "undefined") { Object.defineProperty(modules, "exceptWithClass", {value: exceptWithClass, enumerable: false}); }
|
||||||
if (typeof modules.exceptModule === "undefined") { Object.defineProperty(modules, "exceptModule", {value: exceptModule, enumerable: false}); }
|
if (typeof modules.exceptModule === "undefined") { Object.defineProperty(modules, "exceptModule", {value: exceptModule, enumerable: false}); }
|
||||||
if (typeof modules.enumerate === "undefined") { Object.defineProperty(modules, "enumerate", {value: enumerate, enumerable: false}); }
|
if (typeof modules.enumerate === "undefined") { Object.defineProperty(modules, "enumerate", {value: enumerate, enumerable: false}); }
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@@ -101,9 +101,9 @@ NodeHelper = Class.extend({
|
|||||||
var onevent = socket.onevent;
|
var onevent = socket.onevent;
|
||||||
socket.onevent = function(packet) {
|
socket.onevent = function(packet) {
|
||||||
var args = packet.data || [];
|
var args = packet.data || [];
|
||||||
onevent.call(this, packet); // original call
|
onevent.call(this, packet); // original call
|
||||||
packet.data = ["*"].concat(args);
|
packet.data = ["*"].concat(args);
|
||||||
onevent.call(this, packet); // additional call to catch-all
|
onevent.call(this, packet); // additional call to catch-all
|
||||||
};
|
};
|
||||||
|
|
||||||
// register catch all.
|
// register catch all.
|
||||||
|
@@ -14,9 +14,9 @@ var MMSocket = function(moduleName) {
|
|||||||
var onevent = self.socket.onevent;
|
var onevent = self.socket.onevent;
|
||||||
self.socket.onevent = function(packet) {
|
self.socket.onevent = function(packet) {
|
||||||
var args = packet.data || [];
|
var args = packet.data || [];
|
||||||
onevent.call(this, packet); // original call
|
onevent.call(this, packet); // original call
|
||||||
packet.data = ["*"].concat(args);
|
packet.data = ["*"].concat(args);
|
||||||
onevent.call(this, packet); // additional call to catch-all
|
onevent.call(this, packet); // additional call to catch-all
|
||||||
};
|
};
|
||||||
|
|
||||||
// register catch all.
|
// register catch all.
|
||||||
|
@@ -320,7 +320,7 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
if(this.config.showEnd){
|
if(this.config.showEnd){
|
||||||
timeWrapper.innerHTML += "-" ;
|
timeWrapper.innerHTML += "-" ;
|
||||||
timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat));
|
timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.startDate >= new Date()) {
|
if (event.startDate >= new Date()) {
|
||||||
|
@@ -28,7 +28,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
||||||
var opts = {
|
var opts = {
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
|
"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
|
||||||
},
|
},
|
||||||
gzip: true
|
gzip: true
|
||||||
};
|
};
|
||||||
@@ -249,7 +249,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
showRecurrence = false;
|
showRecurrence = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
endDate = moment(parseInt(startDate.format("x")) + duration, "x");
|
endDate = moment(parseInt(startDate.format("x")) + duration, "x");
|
||||||
if (startDate.format("x") == endDate.format("x")) {
|
if (startDate.format("x") == endDate.format("x")) {
|
||||||
endDate = endDate.endOf("day");
|
endDate = endDate.endOf("day");
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
var CalendarFetcher = require("./calendarfetcher.js");
|
var CalendarFetcher = require("./calendarfetcher.js");
|
||||||
|
|
||||||
var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL
|
var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL
|
||||||
// var url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/"; // URL for Bearer auth (must be configured in Google OAuth2 first)
|
// var url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/"; // URL for Bearer auth (must be configured in Google OAuth2 first)
|
||||||
var fetchInterval = 60 * 60 * 1000;
|
var fetchInterval = 60 * 60 * 1000;
|
||||||
var maximumEntries = 10;
|
var maximumEntries = 10;
|
||||||
|
@@ -213,7 +213,7 @@ Module.register("newsfeed",{
|
|||||||
},
|
},
|
||||||
|
|
||||||
getActiveItemURL: function() {
|
getActiveItemURL: function() {
|
||||||
return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href;
|
return typeof this.newsItems[this.activeItem].url === "string" ? this.newsItems[this.activeItem].url : this.newsItems[this.activeItem].url.href;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* registerFeeds()
|
/* registerFeeds()
|
||||||
|
@@ -27,7 +27,7 @@ module.exports = NodeHelper.create({
|
|||||||
for (moduleName in modules) {
|
for (moduleName in modules) {
|
||||||
if (!this.ignoreUpdateChecking(moduleName)) {
|
if (!this.ignoreUpdateChecking(moduleName)) {
|
||||||
// Default modules are included in the main MagicMirror repo
|
// Default modules are included in the main MagicMirror repo
|
||||||
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);
|
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//console.log("checking git for module="+moduleName)
|
//console.log("checking git for module="+moduleName)
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint no-multi-spaces: 0 */
|
||||||
var expect = require("chai").expect;
|
var expect = require("chai").expect;
|
||||||
|
|
||||||
describe("Functions module currentweather", function() {
|
describe("Functions module currentweather", function() {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint no-multi-spaces: 0 */
|
||||||
var expect = require("chai").expect;
|
var expect = require("chai").expect;
|
||||||
|
|
||||||
describe("Functions module weatherforecast", function() {
|
describe("Functions module weatherforecast", function() {
|
||||||
|
Reference in New Issue
Block a user