src/cli/util.js/formatStdin
function formatStdin(context) {
  const filepath = context.argv["stdin-filepath"]
    ? path.resolve(process.cwd(), context.argv["stdin-filepath"])
    : process.cwd();

  const ignorer = 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["ignore-path"]
    ? path.relative(path.dirname(context.argv["ignore-path"]), filepath)
    : path.relative(process.cwd(), filepath);

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

      const options = getOptionsForFile(context, filepath);

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

      writeOutput(context, format(context, input, options), options);
    })
    .catch((error) => {
      handleError(context, relativeFilepath || "stdin", error);
    });
}