Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable eslint and clean #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KatherineWinter
Copy link
Contributor

No description provided.

@askvortsov1
Copy link

One quick suggestion: perhaps a github action could be setup to lint code style on pull requests / push to prevent entropy from doing it's thing?

@KatherineWinter
Copy link
Contributor Author

KatherineWinter commented May 24, 2020

One quick suggestion: perhaps a github action could be setup to lint code style on pull requests / push to prevent entropy from doing it's thing?

That is what lefthook does. It runs the lint on pre-submit

Copy link
Owner

@octachrome octachrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, it must have been quite tedious. Did you have any thoughts about also linting client/*.js?

@@ -28,22 +29,21 @@ var allPlayers = {};

function statsInitialized() {
return new Promise(function (resolve) {
(function waitForInitialStatsToBeGenerated(){
setTimeout(() => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original function ran repeatedly until stats != null, now it only runs once.

@@ -185,8 +191,7 @@ function init(dbname, options) {
debug('Database is ready');
}).catch(function(error) {
console.error('Failed to initialise database(s)');
console.error(error);
process.exit(1);
throw new Error(error);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing within a promise.catch() block does not exit the process. I think process.exit is the only option here.

function updateResults(gameData) {
debug('Updating results for finished game');

for (let player of gameData.playerRank) {
for (const player of gameData.playerRank) {
if (player === 'ai') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never knew you could use const in a for of block. I learned something :)

else if (action === 'income') {
return (8+5) << 4;
}
else if (action == 'change-team') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad merge here - you lost some code.

action = 'income';
break;
case 6:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More code lost.

"line-comment-position": "off",
"linebreak-style": [
"error",
"windows"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I develop on Linux, so this rule needs to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants