lint-staged 17.0.6 → 17.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -772,6 +772,23 @@ module.exports = {
772
772
 
773
773
  ## Frequently Asked Questions
774
774
 
775
+ ### How does `lint-staged`'s stashing work?
776
+
777
+ <details>
778
+ <summary>Click to expand</summary>
779
+
780
+ When running `lint-staged` with the default configuration, the following happens:
781
+
782
+ 1. The entire original state is backed up in a git stash using `git stash create` and `git stash store`. This leaves all files in the worktree by default — the regular `git stash` command would also remove them. This most probably ignores any untracked files, which is the default behavior of `git stash`.
783
+ 1. If some file is "_partially staged_", meaning there's both staged and unstaged changes in the same file, lint-staged will additionally save all of these in a patch file, basically like `git diff --patch >> .git/lint-staged_unstaged.patch`. After this, the unstaged changes to these files are removed from the worktree so that tasks only see the staged changes
784
+ 1. After running tasks, any new modifications to the originally staged files are added to the index
785
+ 1. After this, any originally unstaged changes to "_partially staged_" files are restored by applying the patch file from step 2.
786
+ 1. In case of any errors, the state is reset with `git reset` and the original state restored from the git stash created in step 1.
787
+
788
+ If the process is interrupted at any point, it should be possible to restore changes from the git stash created in step 1. because it's only dropped in the last step, after successfully completing all previous steps in the process.
789
+
790
+ </details>
791
+
775
792
  ### The output of commit hook looks weird (no colors, duplicate lines, verbose output on Windows, …)
776
793
 
777
794
  <details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "17.0.6",
3
+ "version": "17.0.7",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,7 +55,7 @@
55
55
  "listr2": "^10.2.1",
56
56
  "picomatch": "^4.0.4",
57
57
  "string-argv": "^0.3.2",
58
- "tinyexec": "1.2.2"
58
+ "tinyexec": "^1.2.4"
59
59
  },
60
60
  "optionalDependencies": {
61
61
  "yaml": "^2.9.0"