Skip to content

Commit

Permalink
Lint everything
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou committed Sep 27, 2024
1 parent e3d91de commit 69c7170
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/pushStats/apiFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 7 additions & 9 deletions src/pushStats/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ManageStats {
}
});

console.log(`[${type}] Getting ${getStatsFunctions.length} statistics`)
console.log(`[${type}] Getting ${getStatsFunctions.length} statistics`);

await Promise.all(getStatsFunctions);

Expand All @@ -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);
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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}`);
Expand Down

0 comments on commit 69c7170

Please sign in to comment.