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

Can't override prettier config when linting on commit is configured #872

Closed
cesalberca opened this issue Feb 23, 2018 · 3 comments
Closed
Labels

Comments

@cesalberca
Copy link

Version

3.0.0-alpha.13

Reproduction link

https://github.com/cesalberca/curiosity-client/tree/prettier-bug

Steps to reproduce

Try committing any change.

What is expected?

Prettier user configuration should be applied correctly when using lint-staged and not fail.

What is actually happening?

When running yarn lint everything works as expected and no linting errors are found. However when I make a commit the following error happens:

 > running pre-commit hook: lint-staged
 ❯ Running tasks for *.js
   ✖ vue-cli-service lint
     → 1 warning found.
     git add
 ↓ Running tasks for *.vue [skipped]
   → No staged files match *.vue
✖ vue-cli-service lint found some errors. Please fix them and try committing again.
warning: File ignored because of a matching ignore pattern. Use "--no-ignore" to override (undefined) at vue.config.js


1 warning found.

pre-commit hook failed (add --no-verify to bypass)

I've tried deleting .eslintignore and vue.config.js and the error persists.

When there is no prettierrc.js everything works as expected, but I would like to be able to change the Prettier configuration.

@yyx990803
Copy link
Member

This looks like an upstream bug in prettier itself. Turns out it works properly if you use .prettierrc instead of .prettierrc.js.

@cesalberca
Copy link
Author

Which Prettier issue is related to this? Thank you!

@yyx990803
Copy link
Member

Nevermind - this is actually because lint-staged is invoking eslint with explicit files list and causes staged AND ignored files to throw warnings.

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

2 participants