-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Formattted everything with prettier #1879
Conversation
My 2cents. Add a gulp task and do it manually once in awhile. As we talked about on Slack, 15seconds is a looong time to wait. |
@jpoon What we can do is just do only prettier on the changed files. That'd reduce the time down to <1s total. |
@jpoon For example, on the most recent commit, prettier only took 300 ms to run. |
The only thing left to do is to fail the CI if not all the code is prettified. |
8520b30
to
7b4b8ef
Compare
Cool! I think everything should work. @jpoon I dunno if I did something horrendous to the gulp or travis files, so I'd appreciate a quick review on that. |
.pipe(tslint({ formatter: 'verbose' })) | ||
.pipe(tslint.report(tslintOptions)); | ||
return merge(srcs, tests); | ||
}); | ||
|
||
gulp.task('default', ['tslint', 'compile']); | ||
gulp.task( |
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.
Why not use https://www.npmjs.com/package/gulp-prettier?
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.
Mainly because that package isn't maintained, and it's missing the "es5" trailing commas option.
@@ -28,6 +28,8 @@ install: | |||
- npm install; | |||
|
|||
script: | |||
- git ls-tree -r master --name-only | grep ".*.[t|j]s$" | xargs ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5 |
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.
You could have called the gulp
task here?
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 thinking that we should be checking all the files to see if any of them haven't been prettified.
I think I set up gulp prettier
to only prettify files that have changed since the last commit.
Come to think of it, I think this workflow can be improved...
Before we merge this, I think it'd be a good idea to put some kind of commit hook so new contributors wouldn't have to use prettier.
However, it wouldn't be the end of the world to run prettier manually once in a while.
The settings I ran it with were
Opinions on these settings?