Enforce Prettier (add CI and pre-commit hook)#1251
Conversation
a9784e7 to
cdbf311
Compare
cdbf311 to
bf0ca2e
Compare
jtreanor
left a comment
There was a problem hiding this comment.
The CI changes look fine to me!
JavonDavis
left a comment
There was a problem hiding this comment.
@mchowning This looks good! just a quick question, should this pre-check auto format? The message says something like success formatting 1 file with prettier-eslint so it made me think the file the should have been updated but it wasn't
Adding additional error messaging because with the `--list-different` flag (which is needed to force a non-zero exit code) and without the `--write` flag (which would cause a 0/successful exit code) the default error messaging confusingly says both success and error.
bf0ca2e to
adcc5dd
Compare
|
Thanks @JavonDavis !
Yes, that is confusing, I completely agree 😀! This sounds similar to what I was talking about with respect to the screenshot in the issue description. It seems like this is the behavior when using the Because of this issue, I did make the script on husky and circleci print an additional error message, so that it would be clear(er) that I'm betting that you didn't see that because you ran FWIW, I also added a bit more detail to the error message to (hopefully) make it clearer. WDYT? |
|
@mchowning thanks for clearing that up for me, yeah I saw the error message and it was definitely clear but was just checking if I misunderstood what was entirely suppose to happen because of that first message I mentioned. Now I'm wondering why we didn't go with the
I'm not sure but I think we could benefit more if we use the |
I chatted about this with some of the other gutenberg-mobile devs and I think the preference at this time is to not automatically make the changes. A couple of the reasons were (1) consistency with the I prefer to not automatically make any changes in the hook at this time. We can, of course, always update this if we decide we want that in the future. Let me know what you think @JavonDavis , and thanks for bringing this up! |
|
@mchowning Sounds good! I just caught up the conversation internally around it as well
I kinda feel the same I mainly raised the question here since we'll be failing on CI if the check doesn't pass, so just thinking why not, in any case don't have strong feelings about this vs the way you currently have it so I think we're good to go for the merge IMO! 👍 |
JavonDavis
left a comment
There was a problem hiding this comment.
LGTM! I also completely agree with the approach to stay as close to how it's done in gutenberg as possible.
|
🎉 |
Fixes #816 by adding a prettier check to our CI builds and as a pre-commit hook.
This was tested by verifying that the "Check Correctness" check on CI failed before updating the code in this repo to comply with prettier, and the commit adding those changes caused the check to then succeed.
It may be easier to review this PR by looking at the commits so you can see the changes that are not solely prettier formatting updates separately. The vast majority of the changes in this PR are just formatting changes.
One mildly annoying aspect of this is the running prettier with the
--list-differentflag (which is needed to get a usable exit code) is that the console output seems rather unclear to me about whether it failed or succeeded ("success!" -> "error!"):That is why I decided to also echo some error messages to the console and make it clear what was occurring. Certainly open to other thoughts though.
Update release notes
Not applicable because there are no user facing changes.