fix: eslint pre-commit hook now supports partially staged files #16137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR tweaks the pre-commit hook to enable working with both staged and unstaged files.
In case you have staged changes on the file that you want to commit and then some other unstaged changes on the very same file, this fix will preserve the unstaged changes without committing them.
❗ 👉 The Git version at least
2.35
is required for this to work. For older Ubuntu the git can be updated from this repository: https://launchpad.net/%7Egit-core/+archive/ubuntu/ppaThe unsolved issue is, that if you have staged and unstaged changes next to each other, it will produce conflict
Staged:
Unstaged:
Conflict: