prettier: Breaking change of 2.0.1 - if files not found it gives an error.

Environments:

  • Prettier Version: 2.0.1
  • Running Prettier via: CLI
  • Runtime: Node.js
  • Operating System: Linux

Steps to reproduce: With 1.19.1 run

"npx prettier app/**/*.js test/dummy/spec/javascripts/**/*_spec.js vendor/assets/javascripts/gcc/externs/*.externs.js --write -c --config prettier_conf.json" 

it runs

With 2.0.1 run

"npx prettier app/**/*.js test/dummy/spec/javascripts/**/*_spec.js vendor/assets/javascripts/gcc/externs/*.externs.js --write -c --config prettier_conf.json" 
[error] No files matching the pattern were found: "test/dummy/spec/javascripts/**/*_spec.js".
[error] No files matching the pattern were found: "vendor/assets/javascripts/gcc/externs/*.externs.js".

Expected behavior: I would expect that something that has worked with 1.19.1 would continue working with 2.0.1. Yes, there are no such files in the specific folder. But we were depending on this. It was a common procedure for us. We have hundreds of places and projects that got broken today.

Thank you for the terrific job with Prettier, but I would expect that things continue working on an upgrade. Should it give an error? I don’t know. But were were depending on it not given an error. It’s not a bug, it is a feature on which we’ve based our building infrastructure.

And yes, we could fix it. But that is not the point.

Actual behavior:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

The new behavior matches the behavior of the ESLint CLI. ESLint has --no-error-on-unmatched-pattern though. We might want to add it too.

1.19.1 printed an error if it couldn’t match any file at all—for all the patterns together, not for an individual pattern. 2.0.1 now also prints errors for individual patterns.

@thebravoman Not yet. I think @thorn0 was saying that’s a thing that works in ESLint, and Prettier should consider adding it.