Can't turn off autoformat upon git commit

I noticed Rider applies some sort of formatting rules (e.g. remove blank line at the end of files) upon committing git changes. None of the following seems to affect this behavior:

  • I unchecked all "Before Commit" actions.
  • I disabled "Reformat and Cleanup Code" under "Actions on Save"

How do I turn off this behavior? Or is there a log I can check to debug it?

0
3 comments

Hi Zheng Li

Please check that you disabled `On save` settings in `File | Settings | Editor | General`:

 

I hope this helps! 

Should you have any questions, let us know. Have a great day! 

0

Hello, I have similar problem, Can't turn off autoformat:
- I unchecked all "Before Commit" actions.

- I disabled "Reformat and Cleanup Code" under "Actions on Save"

- Unchecked On Save → Remove trailing spaces.

I format code im my way, but on commit it changes :(

I have such info in console:

22:46:45.943: [my-project] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F C:\Users\my-user\AppData\Local\Temp\git-commit-msg-.txt --
> my-project@1.1.0 precommit
> lint-staged
[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 1 file
[STARTED] **/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml} — 1 file
[STARTED] **/{aura,lwc}/** — 0 files
[SKIPPED] **/{aura,lwc}/** — no files
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] **/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml} — 1 file
[SUCCESS] package.json — 1 file
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[FAILED] Prevented an empty git commit!
[STARTED] Reverting to original state because of errors...
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...
 ⚠ lint-staged prevented an empty git commit.
 Use the --allow-empty option to continue, or check your task configuration
husky - pre-commit hook exited with code 1 (error)
 

Any ideas?

0

Michael Mike, it's a different problem. The primary issue in this thread is point to the auto format on file editing in Rider.

The npm packages installed in your project triggers your auto-format, not in Rider. Please follow the instruction in the repo to disable the lint-staged auto format on Git commit.

0

Please sign in to leave a comment.