mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Run eslint over files, see what gets fixed automatically and clean up
This commit is contained in:
parent
f4eae72c48
commit
43bcf4ab98
@ -4,10 +4,17 @@
|
||||
(function () {
|
||||
var config = {};
|
||||
|
||||
// Helper function to get server address/hostname from either the commandline or env
|
||||
/**
|
||||
* Helper function to get server address/hostname from either the commandline or env
|
||||
*/
|
||||
function getServerAddress() {
|
||||
// Helper function to get command line parameters
|
||||
// Assumes that a cmdline parameter is defined with `--key [value]`
|
||||
/**
|
||||
* Helper function to get command line parameters
|
||||
* Assumes that a cmdline parameter is defined with `--key [value]`
|
||||
*
|
||||
* @param key
|
||||
* @param defaultValue
|
||||
*/
|
||||
function getCommandLineParameter(key, defaultValue = undefined) {
|
||||
var index = process.argv.indexOf(`--${key}`);
|
||||
var value = index > -1 ? process.argv[index + 1] : undefined;
|
||||
@ -23,6 +30,9 @@
|
||||
config["tls"] = process.argv.indexOf("--use-tls") > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url
|
||||
*/
|
||||
function getServerConfig(url) {
|
||||
// Return new pending promise
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -47,6 +57,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param code
|
||||
*/
|
||||
function fail(message, code = 1) {
|
||||
if (message !== undefined && typeof message === "string") {
|
||||
console.log(message);
|
||||
|
@ -169,11 +169,11 @@ var App = function () {
|
||||
loadNextModule();
|
||||
};
|
||||
|
||||
/* cmpVersions(a,b)
|
||||
/**
|
||||
* Compare two semantic version numbers and return the difference.
|
||||
*
|
||||
* argument a string - Version number a.
|
||||
* argument a string - Version number b.
|
||||
* @param {string} a Version number a.
|
||||
* @param {string} b Version number b.
|
||||
*/
|
||||
function cmpVersions(a, b) {
|
||||
var i, diff;
|
||||
|
@ -16,7 +16,7 @@ const config = require(rootPath + "/.eslintrc.json");
|
||||
const Log = require(rootPath + "/js/logger.js");
|
||||
const Utils = require(rootPath + "/js/utils.js");
|
||||
|
||||
/* getConfigFile()
|
||||
/**
|
||||
* Return string with path of configuration file
|
||||
* Check if set by environment variable MM_CONFIG_FILE
|
||||
*/
|
||||
@ -29,6 +29,9 @@ function getConfigFile() {
|
||||
return configFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function checkConfigFile() {
|
||||
const configFileName = getConfigFile();
|
||||
|
||||
|
11
js/class.js
11
js/class.js
@ -57,7 +57,9 @@
|
||||
: prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
/**
|
||||
* The dummy class constructor
|
||||
*/
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if (!initializing && this.init) {
|
||||
@ -78,8 +80,11 @@
|
||||
};
|
||||
})();
|
||||
|
||||
//Define the clone method for later use.
|
||||
//Helper Method
|
||||
/**
|
||||
* Define the clone method for later use. Helper Method.
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
function cloneObject(obj) {
|
||||
if (obj === null || typeof obj !== "object") {
|
||||
return obj;
|
||||
|
@ -15,6 +15,9 @@ const BrowserWindow = electron.BrowserWindow;
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function createWindow() {
|
||||
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
|
||||
var electronOptionsDefaults = {
|
||||
|
@ -451,11 +451,13 @@ Module.create = function (name) {
|
||||
return new ModuleClass();
|
||||
};
|
||||
|
||||
/* cmpVersions(a,b)
|
||||
/**
|
||||
* Compare two semantic version numbers and return the difference.
|
||||
*
|
||||
* argument a string - Version number a.
|
||||
* argument a string - Version number b.
|
||||
* @param {string} a Version number a.
|
||||
* @param {string} b Version number b.
|
||||
*
|
||||
* @returns {number}
|
||||
*/
|
||||
function cmpVersions(a, b) {
|
||||
var i, diff;
|
||||
|
@ -7,11 +7,11 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
var Translator = (function () {
|
||||
/* loadJSON(file, callback)
|
||||
/**
|
||||
* Load a JSON file via XHR.
|
||||
*
|
||||
* argument file string - Path of the file we want to load.
|
||||
* argument callback function - Function called when done.
|
||||
* @param {string} file Path of the file we want to load.
|
||||
* @param {Function} callback Function called when done.
|
||||
*/
|
||||
function loadJSON(file, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
@ -41,10 +41,17 @@ var Translator = (function () {
|
||||
translate: function (module, key, variables) {
|
||||
variables = variables || {}; //Empty object by default
|
||||
|
||||
// Combines template and variables like:
|
||||
// template: "Please wait for {timeToWait} before continuing with {work}."
|
||||
// variables: {timeToWait: "2 hours", work: "painting"}
|
||||
// to: "Please wait for 2 hours before continuing with painting."
|
||||
/**
|
||||
* Combines template and variables like:
|
||||
* template: "Please wait for {timeToWait} before continuing with {work}."
|
||||
* variables: {timeToWait: "2 hours", work: "painting"}
|
||||
* to: "Please wait for 2 hours before continuing with painting."
|
||||
*
|
||||
* @param template
|
||||
* @param variables
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
function createStringFromTemplate(template, variables) {
|
||||
if (Object.prototype.toString.call(template) !== "[object String]") {
|
||||
return template;
|
||||
|
@ -13,6 +13,9 @@
|
||||
(function (window) {
|
||||
/**
|
||||
* extend obj function
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
*/
|
||||
function extend(a, b) {
|
||||
for (let key in b) {
|
||||
@ -25,6 +28,8 @@
|
||||
|
||||
/**
|
||||
* NotificationFx function
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
function NotificationFx(options) {
|
||||
this.options = extend({}, this.options);
|
||||
|
@ -556,12 +556,11 @@ Module.register("calendar", {
|
||||
},
|
||||
|
||||
/**
|
||||
* symbolsForEvent(event)
|
||||
* Retrieves the symbols for a specific event.
|
||||
*
|
||||
* argument event object - Event to look for.
|
||||
* @param {object} event Event to look for.
|
||||
*
|
||||
* return array - The Symbols
|
||||
* @returns {*} array The Symbols
|
||||
*/
|
||||
symbolsForEvent: function (event) {
|
||||
let symbols = this.getCalendarPropertyAsArray(event.url, "symbol", this.config.defaultSymbol);
|
||||
|
@ -152,6 +152,10 @@ Module.register("clock", {
|
||||
timeWrapper.appendChild(periodWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param config
|
||||
* @param time
|
||||
*/
|
||||
function formatTime(config, time) {
|
||||
var formatString = hourSymbol + ":mm";
|
||||
if (config.showPeriod && config.timeFormat !== 24) {
|
||||
|
@ -119,6 +119,9 @@ WeatherProvider.providers = [];
|
||||
|
||||
/**
|
||||
* Static method to register a new weather provider.
|
||||
*
|
||||
* @param providerIdentifier
|
||||
* @param providerDetails
|
||||
*/
|
||||
WeatherProvider.register = function (providerIdentifier, providerDetails) {
|
||||
WeatherProvider.providers[providerIdentifier.toLowerCase()] = WeatherProvider.extend(providerDetails);
|
||||
@ -126,6 +129,9 @@ WeatherProvider.register = function (providerIdentifier, providerDetails) {
|
||||
|
||||
/**
|
||||
* Static method to initialize a new weather provider.
|
||||
*
|
||||
* @param providerIdentifier
|
||||
* @param delegate
|
||||
*/
|
||||
WeatherProvider.initialize = function (providerIdentifier, delegate) {
|
||||
providerIdentifier = providerIdentifier.toLowerCase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user