Lint stuff

This commit is contained in:
Veeck 2020-05-25 18:57:15 +02:00 committed by rejas
parent 8c319903dd
commit 13073bc98d
8 changed files with 63 additions and 56 deletions

View File

@ -92,11 +92,7 @@ var App = function () {
} }
}); });
if (usedDeprecated.length > 0) { if (usedDeprecated.length > 0) {
Log.warn(Utils.colors.warn( Log.warn(Utils.colors.warn("WARNING! Your config is using deprecated options: " + usedDeprecated.join(", ") + ". Check README and CHANGELOG for more up-to-date ways of getting the same functionality."));
"WARNING! Your config is using deprecated options: " +
usedDeprecated.join(", ") +
". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.")
);
} }
}; };
@ -258,7 +254,9 @@ var App = function () {
*/ */
process.on("SIGINT", () => { process.on("SIGINT", () => {
Log.log("[SIGINT] Received. Shutting down server..."); Log.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);
}); });
@ -267,7 +265,9 @@ var App = function () {
*/ */
process.on("SIGTERM", () => { process.on("SIGTERM", () => {
Log.log("[SIGTERM] Received. Shutting down server..."); Log.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);
}); });

View File

@ -62,7 +62,7 @@ function checkConfigFile() {
return true; return true;
} else { } else {
// In case the there errors show messages and return // In case the there errors show messages and return
messages.forEach(error => { messages.forEach((error) => {
Logger.log("Line", error.line, "col", error.column, error.message); Logger.log("Line", error.line, "col", error.column, error.message);
}); });
} }

View File

@ -177,11 +177,15 @@ var Loader = (function () {
script.type = "text/javascript"; script.type = "text/javascript";
script.src = fileName; script.src = fileName;
script.onload = function () { script.onload = function () {
if (typeof callback === "function") {callback();} if (typeof callback === "function") {
callback();
}
}; };
script.onerror = function () { script.onerror = function () {
Log.error("Error on loading script:", fileName); Log.error("Error on loading script:", fileName);
if (typeof callback === "function") {callback();} if (typeof callback === "function") {
callback();
}
}; };
document.getElementsByTagName("body")[0].appendChild(script); document.getElementsByTagName("body")[0].appendChild(script);
@ -193,11 +197,15 @@ var Loader = (function () {
stylesheet.type = "text/css"; stylesheet.type = "text/css";
stylesheet.href = fileName; stylesheet.href = fileName;
stylesheet.onload = function () { stylesheet.onload = function () {
if (typeof callback === "function") {callback();} if (typeof callback === "function") {
callback();
}
}; };
stylesheet.onerror = function () { stylesheet.onerror = function () {
Log.error("Error on loading stylesheet:", fileName); Log.error("Error on loading stylesheet:", fileName);
if (typeof callback === "function") {callback();} if (typeof callback === "function") {
callback();
}
}; };
document.getElementsByTagName("head")[0].appendChild(stylesheet); document.getElementsByTagName("head")[0].appendChild(stylesheet);

View File

@ -7,7 +7,7 @@
* MIT Licensed. * MIT Licensed.
*/ */
(function (root, factory) { (function (root, factory) {
if (typeof exports === 'object') { if (typeof exports === "object") {
// add timestamps in front of log messages // add timestamps in front of log messages
require("console-stamp")(console, "yyyy-mm-dd HH:MM:ss.l"); require("console-stamp")(console, "yyyy-mm-dd HH:MM:ss.l");
@ -17,8 +17,7 @@
// Browser globals (root is window) // Browser globals (root is window)
root.Log = factory(root.config); root.Log = factory(root.config);
} }
}(this, function (config) { })(this, function (config) {
let logLevel = { let logLevel = {
info: Function.prototype.bind.call(console.info, console), info: Function.prototype.bind.call(console.info, console),
log: Function.prototype.bind.call(console.log, console), log: Function.prototype.bind.call(console.log, console),
@ -30,7 +29,7 @@
time: Function.prototype.bind.call(console.time, console), time: Function.prototype.bind.call(console.time, console),
timeEnd: Function.prototype.bind.call(console.timeEnd, console), timeEnd: Function.prototype.bind.call(console.timeEnd, console),
timeStamp: Function.prototype.bind.call(console.timeStamp, console) timeStamp: Function.prototype.bind.call(console.timeStamp, console)
} };
if (config && config.logLevel) { if (config && config.logLevel) {
Object.keys(logLevel).forEach(function (key, index) { Object.keys(logLevel).forEach(function (key, index) {
@ -41,4 +40,4 @@
} }
return logLevel; return logLevel;
})); });

View File

@ -436,7 +436,7 @@ var CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntr
* Broadcast the existing events. * Broadcast the existing events.
*/ */
this.broadcastEvents = function () { this.broadcastEvents = function () {
console.info('Broadcasting ' + events.length + ' events.'); console.info("Broadcasting " + events.length + " events.");
eventsReceivedCallback(self); eventsReceivedCallback(self);
}; };