Removing the "." in your eslint command should fix this.
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./**/*.js": [
"eslint --fix --quiet"
]
},
The command eslint . --fix --quiet
runs eslint on all files in the current directory.
So, when the pre-commit hook is triggered for a staged file, since your eslint command is running on all files in your current directory, it affects your unstaged files too.
Whenever lint-staged runs on a file, it automatically passes the file's name to all the specified commands.
For example, if the staged index.js file is being processed,
eslint --fix --quiet
is transformed into
eslint --fix --quiet index.js