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 = createIgnorer(context);
  const relativeFilepath = path.relative(process.cwd(), filepath);

  thirdParty.getStream(process.stdin).then(input => {
    if (relativeFilepath && ignorer.filter([relativeFilepath]).length === 0) {
      writeOutput({ formatted: input }, {});
      return;
    }

    const options = getOptionsForFile(context, filepath);

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

    try {
      writeOutput(format(context, input, options), options);
    } catch (error) {
      handleError(context, "stdin", error);
    }
  });
}