-
Notifications
You must be signed in to change notification settings - Fork 80
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
base: master
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this 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(() => { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
No description provided.