Run eslint over files, see what gets fixed automatically and clean up

This commit is contained in:
rejas
2020-07-27 14:24:30 +02:00
parent f4eae72c48
commit 43bcf4ab98
11 changed files with 72 additions and 24 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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 = {

View File

@@ -157,7 +157,7 @@ var Module = Class.extend({
/** nunjucksEnvironment()
* Returns the nunjucks environment for the current module.
* The environment is checked in the _nunjucksEnvironment instance variable.
* @returns Nunjucks Environment
*/
nunjucksEnvironment: function () {
@@ -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;

View File

@@ -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;