Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit hook ignores index #1114

Closed
noscript opened this issue Apr 11, 2018 · 3 comments
Closed

pre-commit hook ignores index #1114

noscript opened this issue Apr 11, 2018 · 3 comments
Labels

Comments

@noscript
Copy link

noscript commented Apr 11, 2018

Version

3.0.0-beta.6

Reproduction link

https://github.com/noscript/vue-cli-pre-commit-bug

Steps to reproduce

  • Create a project with Lint and fix on commit enabled
  • Make some changes to src/App.vue and src/views/Home.vue
  • Using git add -p select changes only from src/App.vue
  • Commit with git commit

What is expected?

Only changes from src/App.vue committed.

What is actually happening?

Changes from src/views/Home.vue get committed too.

@dhensche
Copy link
Contributor

dhensche commented Apr 11, 2018

see https://github.com/okonet/lint-staged#reformatting-the-code. I think support could be added to only commit the files already staged, but the file matcher for which files to lint is simply a file glob so all matched files will be linted. Also it looks like lint-staged still does not fully support partially staged files -- lint-staged/lint-staged#62

@yyx990803
Copy link
Member

Closing as this is something that needs to be fixed in the upstream dependency.

@bodograumann
Copy link
Contributor

Just stumbled upon this issue. I really think vue-cli should warn the user when selection “Lint and fix on commit”, that this will break the git workflow. Especially since all partially staged files will silently be commited as a whole!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants