prettier#resolveConfig TypeScript Examples

The following examples show how to use prettier#resolveConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: code-utils.ts    From plasmic with MIT License 7 votes vote down vote up
formatAsLocal = (
  content: string,
  filePath: string,
  baseDir: string,
  defaultOpts: Options = {}
) => {
  const opts = resolveConfig.sync(baseDir) || defaultOpts;
  opts.filepath = filePath;

  // Running Prettier multiple times may actually yield different results!
  // Here we run it twice, just to be safe... :-/
  const res = Prettier.format(content, opts);
  const res2 = Prettier.format(res, opts);
  return res2;
}
Example #2
Source File: generate-configs.ts    From graphql-eslint with MIT License 5 votes vote down vote up
prettierOptions = resolveConfig.sync(__dirname)