Run prettier over ALL files once

No other changes done in this commit
This commit is contained in:
Veeck
2020-05-11 22:22:32 +02:00
parent 3a5a29efc0
commit abb5dc5739
160 changed files with 2369 additions and 2210 deletions

View File

@@ -6,21 +6,18 @@ var defaultModules = require(__dirname + "/../defaultmodules.js");
var NodeHelper = require("node_helper");
module.exports = NodeHelper.create({
config: {},
updateTimer: null,
updateProcessStarted: false,
start: function () {
},
configureModules: function(modules) {
start: function () {},
configureModules: function (modules) {
// Push MagicMirror itself , biggest chance it'll show up last in UI and isn't overwritten
// others will be added in front
// this method returns promises so we can't wait for every one to resolve before continuing
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
simpleGits.push({ module: "default", git: SimpleGit(path.normalize(__dirname + "/../../../")) });
var promises = [];
@@ -33,7 +30,7 @@ module.exports = NodeHelper.create({
//console.log("checking git for module="+moduleName)
let stat = fs.statSync(path.join(moduleFolder, ".git"));
promises.push(this.resolveRemote(moduleName, moduleFolder));
} catch(err) {
} catch (err) {
// Error when directory .git doesn't exist
// This module is not managed with git, skip
continue;
@@ -47,7 +44,7 @@ module.exports = NodeHelper.create({
socketNotificationReceived: function (notification, payload) {
if (notification === "CONFIG") {
this.config = payload;
} else if(notification === "MODULES") {
} else if (notification === "MODULES") {
// if this is the 1st time thru the update check process
if (!this.updateProcessStarted) {
this.updateProcessStarted = true;
@@ -56,7 +53,7 @@ module.exports = NodeHelper.create({
}
},
resolveRemote: function(moduleName, moduleFolder) {
resolveRemote: function (moduleName, moduleFolder) {
return new Promise((resolve, reject) => {
var git = SimpleGit(moduleFolder);
git.getRemotes(true, (err, remotes) => {
@@ -65,19 +62,19 @@ module.exports = NodeHelper.create({
return resolve();
}
// Folder has .git and has at least one git remote, watch this folder
simpleGits.unshift({"module": moduleName, "git": git});
simpleGits.unshift({ module: moduleName, git: git });
resolve();
});
});
},
performFetch: function() {
performFetch: function () {
var self = this;
simpleGits.forEach((sg) => {
sg.git.fetch().status((err, data) => {
data.module = sg.module;
if (!err) {
sg.git.log({"-1": null}, (err, data2) => {
sg.git.log({ "-1": null }, (err, data2) => {
if (!err && data2.latest && "hash" in data2.latest) {
data.hash = data2.latest.hash;
self.sendSocketNotification("STATUS", data);
@@ -90,19 +87,19 @@ module.exports = NodeHelper.create({
this.scheduleNextFetch(this.config.updateInterval);
},
scheduleNextFetch: function(delay) {
scheduleNextFetch: function (delay) {
if (delay < 60 * 1000) {
delay = 60 * 1000;
}
var self = this;
clearTimeout(this.updateTimer);
this.updateTimer = setTimeout(function() {
this.updateTimer = setTimeout(function () {
self.performFetch();
}, delay);
},
ignoreUpdateChecking: function(moduleName) {
ignoreUpdateChecking: function (moduleName) {
// Should not check for updates for default modules
if (defaultModules.indexOf(moduleName) >= 0) {
return true;
@@ -116,5 +113,4 @@ module.exports = NodeHelper.create({
// The rest of the modules that passes should check for updates
return false;
}
});