docs(plugins): add parser.preprocess (#4365)
* docs(plugins): add parser.preprocess * docs: fix lintingmaster
parent
6a17474e37
commit
6b2be99b53
|
@ -87,7 +87,8 @@ export const parsers = {
|
||||||
astFormat: "dance-ast",
|
astFormat: "dance-ast",
|
||||||
hasPragma,
|
hasPragma,
|
||||||
locStart,
|
locStart,
|
||||||
locEnd
|
locEnd,
|
||||||
|
preprocess
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -104,12 +105,18 @@ The location extraction functions (`locStart` and `locEnd`) return the starting
|
||||||
function locStart(node: object): number;
|
function locStart(node: object): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
The pragma detection function (`hasPragma`) should return if the text contains the pragma comment.
|
_(Optional)_ The pragma detection function (`hasPragma`) should return if the text contains the pragma comment.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
function hasPragma(text: string): boolean;
|
function hasPragma(text: string): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
_(Optional)_ The preprocess function can process the input text before passing into `parse` function.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
function preprocess(text: string, options: object): string;
|
||||||
|
```
|
||||||
|
|
||||||
### `printers`
|
### `printers`
|
||||||
|
|
||||||
Printers convert ASTs into a Prettier intermediate representation, also known as a Doc.
|
Printers convert ASTs into a Prettier intermediate representation, also known as a Doc.
|
||||||
|
|
Loading…
Reference in New Issue