diff --git a/.eslintrc.js b/.eslintrc.js index ec73234..defab5b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { "no-console":"off", "import/extensions":"off", "no-underscore-dangle":"off", - "no-param-reassign": ["error", { "props": false }] + "no-param-reassign": ["error", { "props": false }], + "no-restricted-syntax": "off", } } diff --git a/package.json b/package.json index 6b3df1b..a488031 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "start": "node bin/server.js start --grafanaPort=3000", "start:test": "node bin/server.js start --grafanaPort=3000 --force", "lint": "eslint src/**/*.js && eslint dashboards/**/*.js", - "lint:fix": "eslint src/**/* --fix && eslint dashboards/**/*.js --fix", + "lint:fix": "eslint src/**/*.js --fix && eslint dashboards/**/*.js --fix", "update-stats-getter": "docker-compose up --detach --build" }, "dependencies": { diff --git a/src/pushStats/apiFunctions.js b/src/pushStats/apiFunctions.js index f9ff011..c7356d8 100644 --- a/src/pushStats/apiFunctions.js +++ b/src/pushStats/apiFunctions.js @@ -203,7 +203,7 @@ export default class { if (res) { console.log(`Got memory from ${info.username} in ${shard} `); } else { - return undefined + return undefined; } const data = await gz(res.data); diff --git a/src/pushStats/index.js b/src/pushStats/index.js index e615443..06d20b8 100644 --- a/src/pushStats/index.js +++ b/src/pushStats/index.js @@ -86,7 +86,7 @@ class ManageStats { } }); - console.log(`[${type}] Getting ${getStatsFunctions.length} statistics`) + console.log(`[${type}] Getting ${getStatsFunctions.length} statistics`); await Promise.all(getStatsFunctions); @@ -96,7 +96,7 @@ class ManageStats { if (Object.keys(groupedStats).length > 0) { if (!await ManageStats.reportStats({ stats: groupedStats })) return console.log('Error while pushing stats'); - console.log(`[${type}] Pushed stats to graphite`) + console.log(`[${type}] Pushed stats to graphite`); return console.log(this.message); } @@ -106,13 +106,11 @@ class ManageStats { } if (type === 'season') { if (Object.keys(groupedStats).length > 0) { - if (!await ManageStats.reportStats({ stats: groupedStats })) return console.log('Error while pushing stats'); - console.log(`[${type}] Pushed stats to graphite`) + console.log(`[${type}] Pushed stats to graphite`); return console.log(this.message); - } if (beginningOfMinute) return console.log('No stats to push'); return undefined; @@ -126,7 +124,7 @@ class ManageStats { try { const groupedAdminStatsUsers = {}; for (const [username, user] of Object.entries(adminUtilsServerStats)) { - groupedAdminStatsUsers[username] = user; + groupedAdminStatsUsers[username] = user; } adminUtilsServerStats.users = groupedAdminStatsUsers; @@ -195,7 +193,7 @@ class ManageStats { static async reportStats(stats) { return new Promise((resolve) => { - console.log("Writing stats " + JSON.stringify(stats) + " to graphite"); + console.log(`Writing stats ${JSON.stringify(stats)} to graphite`); client.write({ [`${process.env.PREFIX ? `${process.env.PREFIX}.` : ''}screeps`]: stats }, (err) => { if (err) { console.log(err); @@ -205,13 +203,13 @@ class ManageStats { lastUpload = new Date().getTime(); resolve(true); }); - //resolve(true); + // resolve(true); }); } pushStats(userinfo, stats, shard) { if (Object.keys(stats).length === 0) return; - let username = userinfo.replaceName !== undefined ? userinfo.replaceName : userinfo.username; + const username = userinfo.replaceName !== undefined ? userinfo.replaceName : userinfo.username; this.groupedStats[(userinfo.prefix ? `${userinfo.prefix}.` : '') + username] = { [shard]: stats }; console.log(`Pushing stats for ${(userinfo.prefix ? `${userinfo.prefix}.` : '') + username} in ${shard}`);