-
Notifications
You must be signed in to change notification settings - Fork 317
integrate prettier for *.js code standardization #58
Conversation
package.json
Outdated
@@ -57,6 +60,14 @@ | |||
"url": "git://github.com/coinbase/gdax-node.git" | |||
}, | |||
"scripts": { | |||
"test": "mocha --ui qunit --bail --reporter list tests/*.js" | |||
"test": "mocha --ui qunit --bail --reporter list tests/*.js", | |||
"fmt": "node_modules/.bin/prettier --write 'index.js' 'lib/**/*.js' 'tests/**/*.js'", |
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.
Let's call it format
. Also, node_modules/.bin/
is unnecessary.
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.
Also, we're currently using four spaces in most places, so let's use that. Plus, we want es5 dangling commas and single quotes would be nice to have.
--single-quote --tab-width 4 --print-width 86 --trailing-comma es5
should do it (increasing the print width to account for three indentations).
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.
There also isn't a need for quotes around 'index.js'
.
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 the comments, hadn't officially set up prettier in a project before, only was using the vscode plugin on pre-existing setups.
package.json
Outdated
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"node_modules/.bin/prettier --write", |
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.
node_modules/.bin/
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 was not 100% that one could use prettier if not installed globally.
Thanks a lot for this PR! Not sure whether we shouldn't wait for #40 with this, as it will introduce a lot of merge conflicts. |
Fixed with #60. Thanks a lot @awitherow for getting this started! |
🙇 my pleasure! |
I saw there was desire in another thread to add prettier, figured I'd go ahead and do so since it is not too difficult 👍
We need to decide on rules though still.
They can be chosen here: https://github.com/prettier/prettier#options
Merge blocked by PR #40