src/cli/format.js/formatStdin
async function formatStdin(context) {
  const filepath = context.argv.filepath
    ? path.resolve(process.cwd(), context.argv.filepath)
    : process.cwd();

  const ignorer = await createIgnorerFromContextOrDie(context);
  // If there's an ignore-path set, the filename must be relative to the
  // ignore path, not the current working directory.
  const relativeFilepath = context.argv.ignorePath
    ? path.relative(path.dirname(context.argv.ignorePath), filepath)
    : path.relative(process.cwd(), filepath);

  try {
    const input = await getStdin();

    if (
      relativeFilepath &&
      ignorer.ignores(fixWindowsSlashes(relativeFilepath))
    ) {
      writeOutput(context, { formatted: input });
      return;
    }

    const options = await getOptionsForFile(context, filepath);

    if (listDifferent(context, input, options, "(stdin)")) {
      return;
    }

    const formatted = format(context, input, options);

    const { performanceTestFlag } = context;
    if (performanceTestFlag) {
      context.logger.log(
        `'${performanceTestFlag.name}' option found, skipped print code to screen.`
      );
      return;
    }

    writeOutput(context, formatted, options);
  } catch (error) {
    handleError(context, relativeFilepath || "stdin", error);
  }
}