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 exits with error code 2 when no files match glob pattern #88

Closed
atagulalan opened this issue Dec 18, 2024 · 1 comment
Closed
Assignees

Comments

@atagulalan
Copy link

When running pnpm run lint on macOS Sequoia 15.2, Prettier exits with error code 2 if no files match the specified glob pattern. This causes the entire lint script to fail.

Error Example:

[error] No files matching the pattern were found: "**/*.md".

Cause:
Prettier throws an error when it doesn't find any files matching the provided glob pattern. This behavior interrupts the script execution.

Solution:
Wrap the glob pattern in quotes to prevent the shell from interpreting it incorrectly and avoid Prettier failing due to no matches.

For example:

prettier "**/*.js"  --check

Further Details: Refer to this StackOverflow discussion for additional context and solutions.

Steps to Reproduce:

  • Run pnpm run lint with Prettier.
  • Ensure the glob pattern does not match any files.
  • Expected Behavior: Prettier should handle an empty match gracefully and not fail the entire script.

Environment:
OS: macOS Sequoia 15.2
Package Manager: pnpm
Script: pnpm run lint (or any other lint sequence uses prettier)

@ymehmetcan
Copy link
Member

Thanks for the feedback! The issue occurred because the README.md file, which is the only Markdown file in the generation part of Commencis-CLI, was removed. This is an active issue that will be addressed in the next version to provide a project-specific README during generation. Additionally, it would be best to update the Prettier script to include the glob pattern you proposed.

@ymehmetcan ymehmetcan self-assigned this Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants