ashleystringer/add-prettier-formatter pull request - #5
Conversation
✅ Deploy Preview for cherry-on-tech-website-2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Thanks for adding Prettier!
I confirmed that Husky works well locally.
I also tried testing the autofix workflow in this PR, but it didn't seem to run as expected?:
DO NOT MERGE: test prettier formatter by masuyama13 · Pull Request #9
Could you take a look when you have a chance? I may be missing something, but I wanted to confirm whether the autofix workflow is working as intended.
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci --frozen-lockfile |
There was a problem hiding this comment.
I don't think --frozen-lockfile is needed here.
npm ci is good enough.
There was a problem hiding this comment.
Okay I removed the --frozen-lockfile flag.
There was a problem hiding this comment.
Can you recover this file?
There was a problem hiding this comment.
I'll try to find out how to recover it
|
|
||
|
|
||
| npm run prettier | ||
| git update-index --again No newline at end of file |
There was a problem hiding this comment.
Can you add a newline here?
There was a problem hiding this comment.
I added the newline, but upon pushing it to the repo, it seems to have gotten rid of the newline for some reason. This isn't a product of Prettier or Husky, since these didn't remove the newline when I ran them.
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' |
There was a problem hiding this comment.
Can we use Node.js 24? We've got a warning.
https://github.com/cherryontech/website-v3.0/actions/runs/29125404337
There was a problem hiding this comment.
Changed it to Node version 24.
It looks like I'd forgotten to install autofix on this repo (since I was originally working on this ticket on a forked repo). I'm not entirely sure why the test was passing for me on this repo, though it may have just been skipping the actual use of autofix in the autofix job since the Prettier check was passing for me. Sorry about that. |
This PR fixes...
What I did...
How to test...
Here is the set of steps for testing, with check boxes for clarification:
ashleystringer/TEST-add-prettier-formatterand switch to this branch.npx husky init.husky/pre-commitfile in the branch and delete everything in the file add paste the following code:npm run prettiergit update-index --againexit 1git commit -m "test"because ofexit 1in the pre-commit file, this prevents a commit from actually being performed while still allowing the pre-commit hook in Husky to run.exit 1from the.husky/pre-commitfile"prepare": "husky"inpackage.jsonto"prepare": "husky || true"git commit -m "test"again. Becauseexit 1is now removed, this will be a real commit for the branch.ashleystringer/TEST-add-prettier-formatteron the repo. This will trigger theprettierjob in the workflow file.ashleystringer/TEST-add-prettier-formatterbranch. This will trigger theautofixjob in the workflow file. Please do not merge this pull request into any branch. This is for testing purposes only.Tests checklist
git commit -m "test"is run? [ ]ashleystringer/TEST-add-prettier-formatterpass theprettierjob in theprettier.ymlworkflow file upon apushevent? [ ]ashleystringer/TEST-add-prettier-formatterpass theautofixjob in theprettier.ymlworkflow file upon apull_requestevent? [ ]