summaryrefslogtreecommitdiff
path: root/prettier/README.md
blob: 3a8d5a0c27dc3be6b31c7a2c53fb679f93512a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# prettier

Prettier APIs and tools for deno

## Use as a CLI

To formats the source files, run:

```console
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts
```

You can format only specific files by passing the arguments.

```console
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
```

You can format files on specific directory by passing the directory's path.

```console
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
```

## Use API

You can use APIs of prettier as the following:

```ts
import {
  prettier,
  prettierPlugins
} from "https://deno.land/std/prettier/prettier.ts";

prettier.format("const x = 1", {
  parser: "babel",
  plugins: prettierPlugins
}); // => "const x = 1;"
```