You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the given `fileUrlOrPath` is ignored, the `inferredParser` is always `null`.
101
101
102
-
Providing [plugin](plugins.md) paths in `options.plugins` (`string[]`) helps extract `inferredParser` for files that are not supported by Prettier core.
102
+
Providing [plugin](plugins.md) paths in `options.plugins` (`(string | URL | Plugin)[]`) helps extract `inferredParser` for files that are not supported by Prettier core.
103
103
104
104
When setting `options.resolveConfig` (`boolean`, default `true`) to `false`, Prettier will not search for configuration file. This can be useful if this function is only used to check if file is ignored.
105
105
@@ -124,10 +124,18 @@ The support information looks like this:
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/browser.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Required options:
21
21
22
22
-**[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.
23
23
24
-
-**`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.5.3/plugins](https://unpkg.com/browse/prettier@3.5.3/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
24
+
-**`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.6.0/plugins](https://unpkg.com/browse/prettier@3.6.0/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
25
25
26
26
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/options.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,6 +325,7 @@ Valid options:
325
325
-`"vue"` (same parser as `"html"`, but also formats vue-specific syntax) _First available in 1.10.0_
326
326
-`"angular"` (same parser as `"html"`, but also formats angular-specific syntax via [angular-estree-parser](https://github.com/ikatyang/angular-estree-parser)) _First available in 1.15.0_
327
327
-`"lwc"` (same parser as `"html"`, but also formats LWC-specific syntax for unquoted template attributes) _First available in 1.17.0_
328
+
-`"mjml"` (same parser as `"html"`, but also formats MJML-specific syntax) _First available in 3.6.0_
328
329
-`"yaml"` (via [yaml](https://github.com/eemeli/yaml) and [yaml-unist-parser](https://github.com/ikatyang/yaml-unist-parser)) _First available in 1.14.0_
329
330
330
331
| Default | CLI Override | API Override |
@@ -393,6 +394,34 @@ Note that “in tandem” doesn’t mean “at the same time”. When the two op
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/plugins.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ Strings provided to `plugins` are ultimately passed to [`import()` expression](h
70
70
-[`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst) by [**@nene**](https://github.com/nene)
71
71
-[`prettier-plugin-solidity`](https://github.com/prettier-solidity/prettier-plugin-solidity) by [**@mattiaerre**](https://github.com/mattiaerre)
72
72
-[`prettier-plugin-svelte`](https://github.com/sveltejs/prettier-plugin-svelte) by [**@sveltejs**](https://github.com/sveltejs)
73
-
-[`prettier-plugin-toml`](https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml) by [**@bd82**](https://github.com/bd82)
73
+
-[`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml) by [**@JounQin**](https://github.com/JounQin) and [**@so1ve**](https://github.com/so1ve)
74
74
75
75
## Developing Plugins
76
76
@@ -113,6 +113,7 @@ export const parsers = {
113
113
// The name of the AST that the parser produces.
114
114
astFormat:"dance-ast",
115
115
hasPragma,
116
+
hasIgnorePragma,
116
117
locStart,
117
118
locEnd,
118
119
preprocess,
@@ -138,6 +139,12 @@ _(Optional)_ The pragma detection function (`hasPragma`) should return if the te
138
139
function hasPragma(text:string):boolean;
139
140
```
140
141
142
+
_(Optional)_ The "ignore pragma" detection function (`hasIgnorePragma`) should return if the text contains a pragma indicating the text should not be formatted.
143
+
144
+
```ts
145
+
function hasIgnorePragma(text:string):boolean;
146
+
```
147
+
141
148
_(Optional)_ The preprocess function can process the input text before passing into `parse` function.
0 commit comments