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

prettier traverses .git files and tries to format them #4895

Closed
gillchristian opened this issue Jul 26, 2018 · 2 comments
Closed

prettier traverses .git files and tries to format them #4895

gillchristian opened this issue Jul 26, 2018 · 2 comments
Assignees
Labels
area:cli Issues with Prettier's Command Line Interface locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Milestone

Comments

@gillchristian
Copy link
Contributor

Environments:

  • Prettier Version: 1.13.7
  • Running Prettier via: CLI
  • Runtime: node v8.9.4, npm v5.6.0, yarn v1.5.1
  • Operating System: Linux

Steps to reproduce:

  • In a git repository with prettier installed
  • Create a git branch that ends in .js
  • Run prettier --write '**/*.js'

I created a repository with everything ready to reproduce (link).

Expected behavior:
.git/ directory should be ignored, prettier should run without errors.

Actual behavior:
.git/ directory is traversed in files and prettier throws syntax error (obviously because .git/ files aren't JS files).


I'm aware of #2882 but .git/* files are still parsed.

Also, I'm up to work on opening a PR solving this issue. But I believe it's better to ask first.

@j-f1 j-f1 added area:cli Issues with Prettier's Command Line Interface priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! type:bug Issues identifying ugly output, or a defect in the program labels Jul 26, 2018
@suchipi
Copy link
Member

suchipi commented Jul 27, 2018

Thanks for the repro repo, it's much appreciated

@azz
Copy link
Member

azz commented Jul 29, 2018

Maybe we should add .git, .hg, .svn to exclude when expanding globs?

@azz azz self-assigned this Jul 29, 2018
@azz azz added the status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! label Jul 29, 2018
@azz azz closed this as completed in #4906 Jul 29, 2018
azz added a commit that referenced this issue Jul 29, 2018
@ikatyang ikatyang added this to the 1.14.1 milestone Aug 2, 2018
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Oct 31, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:cli Issues with Prettier's Command Line Interface locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

5 participants