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

.prettierignore from CLI #5757

Closed
lamyergeier opened this issue Jan 15, 2019 · 6 comments
Closed

.prettierignore from CLI #5757

lamyergeier opened this issue Jan 15, 2019 · 6 comments
Labels
area:ignore .prettierignore file, --ignore-path CLI option, /* prettier-ignore */ comments and so on locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@lamyergeier
Copy link

lamyergeier commented Jan 15, 2019

My .prettierignore :

Templates/Submodule/pandoc-letter/example/letter.md
  • I read that prettier searches at ./.prettierignore. So, prettier --write Templates/Submodule/pandoc-letter/example/letter.md is ignored, here the path is relative to the location of .prettierignore.

  • But when I execute prettier --write example/letter.md from a path relative to ${PWD} but not relative to .prettierignore, it isn't ignored.

  • But logically it should be ignored. Prettier should find the ignore file recursively up and then ignore accordingly.

@ikatyang
Copy link
Member

  • But when I execute prettier --write example/letter.md from a path relative to ${PWD} but not relative to .prettierignore, it isn't ignored.

--ignore-path defaults to .prettierignore, which means you need to manually specify it in this case, for example: prettier --write example/letter.md --ignore-path ../../../.prettierignore.

  • But logically it should be ignored. Prettier should find the ignore file recursively up and then ignore accordingly.

I have never seen up-traversing for .ignore files. Did .gitignore work that way?

@ikatyang ikatyang added the status:awaiting response Issues that require answers to questions from maintainers before action can be taken label Jan 16, 2019
@j-f1
Copy link
Member

j-f1 commented Jan 16, 2019

.gitignore traverses down from the repository root.

@lamyergeier
Copy link
Author

Did .gitignore work that way?

I think it works precisely like that. Suppose only the repository root folder has .gitignore file, in the entire repository. You can go to any subfolder and list out ignored files git check-ignore -v *.

@no-response no-response bot removed the status:awaiting response Issues that require answers to questions from maintainers before action can be taken label Jan 16, 2019
@ikatyang
Copy link
Member

git commands are applied from the repo root (where .git/ lives), but there's no concept for repo in Prettier.

@ikatyang ikatyang added type:enhancement A potential new feature to be added, or an improvement to how we print something status:needs discussion Issues needing discussion and a decision to be made before action can be taken labels Jan 17, 2019
@lamyergeier
Copy link
Author

May be prettier could check if its a git repository and if so could behave like git. Or else do you recommend to put prettierignore in each folder? But in that case Vscode extension doesn't work as it looks at project root.

@thorn0 thorn0 added the area:ignore .prettierignore file, --ignore-path CLI option, /* prettier-ignore */ comments and so on label Apr 30, 2020
@thorn0
Copy link
Member

thorn0 commented Jun 6, 2020

Duplicate of #4081

@thorn0 thorn0 marked this as a duplicate of #4081 Jun 6, 2020
@thorn0 thorn0 closed this as completed Jun 6, 2020
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Sep 5, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:ignore .prettierignore file, --ignore-path CLI option, /* prettier-ignore */ comments and so on locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

No branches or pull requests

4 participants