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

Prevent errors when pattern doesn't match any files #8233

Closed
rienheuver opened this issue May 6, 2020 · 5 comments · Fixed by #10058
Closed

Prevent errors when pattern doesn't match any files #8233

rienheuver opened this issue May 6, 2020 · 5 comments · Fixed by #10058
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. status:needs discussion Issues needing discussion and a decision to be made before action can be taken

Comments

@rienheuver
Copy link

Environments:

  • Prettier Version: 1.19.1
  • Running Prettier via: CLI
  • Runtime: node 14.1.0
  • Operating System: Ubuntu 20.04

Steps to reproduce:

prettier ".unknown"

Expected behavior:
Have a flag in the prettier CLI just like --no-error-on-unmatched-pattern like ESLint. So that if we run the CLI on a bunch of projects in our monorepo, it will skip those that have no relevant files (such as assets with only image files). Instead of breaking on those projects and killing the CI.

Actual behavior:
No such flag is currently present in the Prettier CLI, meaning we have to build a hack to circumvent this error.

@thorn0 thorn0 added area:cli Issues with Prettier's Command Line Interface status:needs discussion Issues needing discussion and a decision to be made before action can be taken labels May 6, 2020
@alexander-akait
Copy link
Member

Duplicate of #8136

@alexander-akait alexander-akait marked this as a duplicate of #8136 Jul 14, 2020
@AlicanC
Copy link

AlicanC commented Jul 14, 2020

@evilebottnawi I don't think this is a #8136 duplicate. This is about having a pattern like src/*.js and Prettier not throwing an error if there are no files that end with ".js" in "src".

@thorn0 thorn0 reopened this Jul 15, 2020
@thorn0 thorn0 marked this as not a duplicate of #8136 Jul 15, 2020
@alexander-akait
Copy link
Member

Oh yes, sorry, my mistake

@NickdeK
Copy link

NickdeK commented Sep 25, 2020

Just a quick workaround for some who run into this issue when running something like
npx prettier --write '**/*.{js,ts,jsx,tsx,md}' and get a No files matching the pattern were found for one of the file types. I'm using the following to work around this issue: npx prettier --write '**/(*.js|.ts|.jsx|.tsx|.md)'

@alvis
Copy link

alvis commented Oct 9, 2020

@NickdeK Thx. The workaround is kind of working, as long as you have at least one file matching the expression. 👍

thorn0 added a commit that referenced this issue Jan 27, 2021
@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 Apr 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2021
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. status:needs discussion Issues needing discussion and a decision to be made before action can be taken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants