Skip to content

Commit

Permalink
Ensuring some CLI-level warnings are written to stderr rather than st…
Browse files Browse the repository at this point in the history
…dout
  • Loading branch information
fabiospampinato committed Sep 15, 2024
1 parent 99f06de commit 41dc791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async function runGlobs(options: Options, pluginsDefaultOptions: PluginsOptions,
const filePath = filesPathsTargets[i];
const fileRelativePath = fastRelativePath(rootPath, filePath);
if (options.check) {
stdout.prefixed.warn(fileRelativePath);
stderr.prefixed.warn(fileRelativePath);
} else if (options.list || options.write) {
stdout.warn(fileRelativePath);
}
Expand Down Expand Up @@ -205,7 +205,7 @@ async function runGlobs(options: Options, pluginsDefaultOptions: PluginsOptions,

if (totalUnformatted) {
if (options.check) {
stdout.prefixed.warn(`Code style issues found in ${totalUnformatted} ${pluralize("file", totalUnformatted)}. Run Prettier to fix.`);
stderr.prefixed.warn(`Code style issues found in ${totalUnformatted} ${pluralize("file", totalUnformatted)}. Run Prettier with --write to fix.`);
}
}

Expand Down

0 comments on commit 41dc791

Please sign in to comment.