@prettier/sync
Synchronous version of Prettier
Installation
yarn add prettier @prettier/sync
Usage
import synchronizedPrettier from "@prettier/sync";
synchronizedPrettier.format("foo( )", { parser: "babel" });
// => 'foo();\n'
createSynchronizedPrettier(options)
options
Type: object
prettierEntry
Type: string | URL
Path or URL to prettier entry.
import { createSynchronizedPrettier } from "@prettier/sync";
const synchronizedPrettier = createSynchronizedPrettier({
prettierEntry: "/path/to/prettier/index.js",
});
synchronizedPrettier.format("foo( )", { parser: "babel" });
// => 'foo();\n'