prettier 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -13,11 +13,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
13
13
  ## Licenses of bundled dependencies
14
14
 
15
15
  The published Prettier artifact additionally contains code with the following licenses:
16
- MIT, ISC, BSD-2-Clause, BSD-3-Clause, 0BSD, Apache-2.0
16
+ MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0
17
17
 
18
18
  ## Bundled dependencies
19
19
 
20
- ### @angular/compiler@v16.1.3
20
+ ### @angular/compiler@v16.1.7
21
21
 
22
22
  > Angular - the compiler library
23
23
 
@@ -128,7 +128,7 @@ Author: The Babel Team (https://babel.dev/team)
128
128
 
129
129
  ----------------------------------------
130
130
 
131
- ### @babel/parser@v7.22.5
131
+ ### @babel/parser@v7.22.7
132
132
 
133
133
  > A JavaScript parser
134
134
 
@@ -366,7 +366,7 @@ License: MIT
366
366
 
367
367
  ----------------------------------------
368
368
 
369
- ### @prettier/is-es5-identifier-name@v0.1.0
369
+ ### @prettier/is-es5-identifier-name@v0.2.0
370
370
 
371
371
  > Check if provided string is an `IdentifierName` as specified in ECMA262 edition 5.1 section 7.6.
372
372
 
@@ -429,7 +429,7 @@ Author: Alex Bell <alex@bellandwhistle.net>
429
429
 
430
430
  ----------------------------------------
431
431
 
432
- ### @typescript-eslint/types@v5.60.1
432
+ ### @typescript-eslint/types@v6.2.0
433
433
 
434
434
  > Types for the TypeScript-ESTree AST spec
435
435
 
@@ -460,7 +460,7 @@ Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
460
460
 
461
461
  ----------------------------------------
462
462
 
463
- ### @typescript-eslint/typescript-estree@v5.60.1
463
+ ### @typescript-eslint/typescript-estree@v6.2.0
464
464
 
465
465
  > A parser that converts TypeScript source code into an ESTree compatible form
466
466
 
@@ -496,7 +496,7 @@ Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
496
496
 
497
497
  ----------------------------------------
498
498
 
499
- ### acorn@v8.9.0
499
+ ### acorn@v8.10.0
500
500
 
501
501
  > ECMAScript parser
502
502
 
@@ -869,7 +869,7 @@ License: MIT
869
869
 
870
870
  ----------------------------------------
871
871
 
872
- ### chalk@v5.2.0
872
+ ### chalk@v5.3.0
873
873
 
874
874
  > Terminal string styling done right
875
875
 
@@ -1519,7 +1519,7 @@ Author: Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1519
1519
 
1520
1520
  ----------------------------------------
1521
1521
 
1522
- ### espree@v9.6.0
1522
+ ### espree@v9.6.1
1523
1523
 
1524
1524
  > An Esprima-compatible JavaScript parser built on Acorn
1525
1525
 
@@ -1915,7 +1915,7 @@ Contributors:
1915
1915
 
1916
1916
  ----------------------------------------
1917
1917
 
1918
- ### flow-parser@v0.211.0
1918
+ ### flow-parser@v0.213.1
1919
1919
 
1920
1920
  > JavaScript parser written in OCaml. Produces ESTree AST
1921
1921
 
@@ -2892,37 +2892,6 @@ Contributors:
2892
2892
 
2893
2893
  ----------------------------------------
2894
2894
 
2895
- ### leven@v2.1.0
2896
-
2897
- > Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm
2898
-
2899
- License: MIT
2900
- Author: Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
2901
-
2902
- > The MIT License (MIT)
2903
- >
2904
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
2905
- >
2906
- > Permission is hereby granted, free of charge, to any person obtaining a copy
2907
- > of this software and associated documentation files (the "Software"), to deal
2908
- > in the Software without restriction, including without limitation the rights
2909
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2910
- > copies of the Software, and to permit persons to whom the Software is
2911
- > furnished to do so, subject to the following conditions:
2912
- >
2913
- > The above copyright notice and this permission notice shall be included in
2914
- > all copies or substantial portions of the Software.
2915
- >
2916
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2917
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2918
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2919
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2920
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2921
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2922
- > THE SOFTWARE.
2923
-
2924
- ----------------------------------------
2925
-
2926
2895
  ### leven@v4.0.0
2927
2896
 
2928
2897
  > Measure the difference between two strings using the Levenshtein distance algorithm
@@ -3687,7 +3656,7 @@ Author: typicode
3687
3656
 
3688
3657
  ----------------------------------------
3689
3658
 
3690
- ### postcss@v8.4.24
3659
+ ### postcss@v8.4.27
3691
3660
 
3692
3661
  > Tool for transforming styles with JS plugins
3693
3662
 
@@ -4144,7 +4113,7 @@ Author: Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4144
4113
 
4145
4114
  ----------------------------------------
4146
4115
 
4147
- ### semver@v7.5.3
4116
+ ### semver@v7.5.4
4148
4117
 
4149
4118
  > The semantic version parser used by npm.
4150
4119
 
@@ -4461,63 +4430,38 @@ Contributors:
4461
4430
 
4462
4431
  ----------------------------------------
4463
4432
 
4464
- ### tslib@v1.14.1
4465
-
4466
- > Runtime library for TypeScript helper functions
4467
-
4468
- License: 0BSD
4469
- Homepage: <https://www.typescriptlang.org/>
4470
- Repository: <https://github.com/Microsoft/tslib.git>
4471
- Author: Microsoft Corp.
4472
-
4473
- > Copyright (c) Microsoft Corporation.
4474
- >
4475
- > Permission to use, copy, modify, and/or distribute this software for any
4476
- > purpose with or without fee is hereby granted.
4477
- >
4478
- > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4479
- > REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4480
- > AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4481
- > INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4482
- > LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4483
- > OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4484
- > PERFORMANCE OF THIS SOFTWARE.
4485
-
4486
- ----------------------------------------
4487
-
4488
- ### tsutils@v3.21.0
4433
+ ### ts-api-utils@v1.0.1
4489
4434
 
4490
- > utilities for working with typescript's AST
4435
+ > Utility functions for working with TypeScript's API. Successor to the wonderful tsutils.
4491
4436
 
4492
4437
  License: MIT
4493
- Repository: <https://github.com/ajafff/tsutils>
4494
- Author: Klaus Meinhardt
4438
+ Repository: <https://github.com/JoshuaKGoldberg/ts-api-utils>
4439
+ Author: Josh Goldberg <npm@joshuakgoldberg.com>
4495
4440
 
4496
- > The MIT License (MIT)
4497
- >
4498
- > Copyright (c) 2017 Klaus Meinhardt
4499
- >
4500
- > Permission is hereby granted, free of charge, to any person obtaining a copy
4501
- > of this software and associated documentation files (the "Software"), to deal
4502
- > in the Software without restriction, including without limitation the rights
4503
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4504
- > copies of the Software, and to permit persons to whom the Software is
4505
- > furnished to do so, subject to the following conditions:
4506
- >
4507
- > The above copyright notice and this permission notice shall be included in all
4508
- > copies or substantial portions of the Software.
4509
- >
4510
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4511
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4512
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4513
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4514
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4515
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4516
- > SOFTWARE.
4441
+ > # MIT License
4442
+ >
4443
+ > Permission is hereby granted, free of charge, to any person obtaining
4444
+ > a copy of this software and associated documentation files (the
4445
+ > 'Software'), to deal in the Software without restriction, including
4446
+ > without limitation the rights to use, copy, modify, merge, publish,
4447
+ > distribute, sublicense, and/or sell copies of the Software, and to
4448
+ > permit persons to whom the Software is furnished to do so, subject to
4449
+ > the following conditions:
4450
+ >
4451
+ > The above copyright notice and this permission notice shall be
4452
+ > included in all copies or substantial portions of the Software.
4453
+ >
4454
+ > THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
4455
+ > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4456
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
4457
+ > IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
4458
+ > CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
4459
+ > TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
4460
+ > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4517
4461
 
4518
4462
  ----------------------------------------
4519
4463
 
4520
- ### typescript@v5.1.5
4464
+ ### typescript@v5.1.6
4521
4465
 
4522
4466
  > TypeScript is a language for application scale JavaScript development
4523
4467
 
@@ -4969,7 +4913,7 @@ Contributors:
4969
4913
 
4970
4914
  ----------------------------------------
4971
4915
 
4972
- ### vnopts@v1.0.2
4916
+ ### vnopts@v2.0.0
4973
4917
 
4974
4918
  > validate and normalize options
4975
4919
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)
1
+ [![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)](https://prettier.io)
2
2
 
3
3
  <h2 align="center">Opinionated Code Formatter</h2>
4
4
 
@@ -76,7 +76,7 @@ foo(
76
76
  reallyLongArg(),
77
77
  omgSoManyParameters(),
78
78
  IShouldRefactorThis(),
79
- isThereSeriouslyAnotherOne()
79
+ isThereSeriouslyAnotherOne(),
80
80
  );
81
81
  ```
82
82
 
package/doc.d.ts CHANGED
@@ -137,7 +137,7 @@ export namespace builders {
137
137
  function ifBreak(
138
138
  ifBreak: Doc,
139
139
  noBreak?: Doc,
140
- options?: { groupId?: symbol | undefined }
140
+ options?: { groupId?: symbol | undefined },
141
141
  ): IfBreak;
142
142
 
143
143
  /** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */
@@ -146,7 +146,7 @@ export namespace builders {
146
146
  /** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */
147
147
  function indentIfBreak(
148
148
  doc: Doc,
149
- opts: { groupId: symbol; negate?: boolean | undefined }
149
+ opts: { groupId: symbol; negate?: boolean | undefined },
150
150
  ): IndentIfBreak;
151
151
 
152
152
  /** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */
@@ -186,7 +186,7 @@ export namespace builders {
186
186
  export namespace printer {
187
187
  function printDocToString(
188
188
  doc: builders.Doc,
189
- options: Options
189
+ options: Options,
190
190
  ): {
191
191
  formatted: string;
192
192
  cursorNodeStart?: number | undefined;
@@ -219,22 +219,22 @@ export namespace utils {
219
219
  doc: builders.Doc,
220
220
  onEnter?: (doc: builders.Doc) => void | boolean,
221
221
  onExit?: (doc: builders.Doc) => void,
222
- shouldTraverseConditionalGroups?: boolean
222
+ shouldTraverseConditionalGroups?: boolean,
223
223
  ): void;
224
224
  function findInDoc<T = builders.Doc>(
225
225
  doc: builders.Doc,
226
226
  callback: (doc: builders.Doc) => T,
227
- defaultValue: T
227
+ defaultValue: T,
228
228
  ): T;
229
229
  function mapDoc<T = builders.Doc>(
230
230
  doc: builders.Doc,
231
- callback: (doc: builders.Doc) => T
231
+ callback: (doc: builders.Doc) => T,
232
232
  ): T;
233
233
  function removeLines(doc: builders.Doc): builders.Doc;
234
234
  function stripTrailingHardline(doc: builders.Doc): builders.Doc;
235
235
  function replaceEndOfLine(
236
236
  doc: builders.Doc,
237
- replacement?: builders.Doc
237
+ replacement?: builders.Doc,
238
238
  ): builders.Doc;
239
239
  function canBreak(doc: builders.Doc): boolean;
240
240
  }
package/index.cjs CHANGED
@@ -592,7 +592,7 @@ var init_public = __esm({
592
592
  // src/main/version.evaluate.cjs
593
593
  var require_version_evaluate = __commonJS({
594
594
  "src/main/version.evaluate.cjs"(exports2, module2) {
595
- module2.exports = "3.0.0";
595
+ module2.exports = "3.0.1";
596
596
  }
597
597
  });
598
598
 
package/index.d.ts CHANGED
@@ -33,7 +33,7 @@ type ArrayElement<T> = T extends Array<infer E> ? E : never;
33
33
 
34
34
  // A union of the properties of the given object that are arrays.
35
35
  type ArrayProperties<T> = {
36
- [K in keyof T]: NonNullable<T[K]> extends any[] ? K : never;
36
+ [K in keyof T]: NonNullable<T[K]> extends readonly any[] ? K : never;
37
37
  }[keyof T];
38
38
 
39
39
  // A union of the properties of the given array T that can be used to index it.
@@ -72,12 +72,12 @@ type CallCallback<T, U> = (path: AstPath<T>, index: number, value: any) => U;
72
72
  type EachCallback<T> = (
73
73
  path: AstPath<ArrayElement<T>>,
74
74
  index: number,
75
- value: any
75
+ value: any,
76
76
  ) => void;
77
77
  type MapCallback<T, U> = (
78
78
  path: AstPath<ArrayElement<T>>,
79
79
  index: number,
80
- value: any
80
+ value: any,
81
81
  ) => U;
82
82
 
83
83
  // https://github.com/prettier/prettier/blob/next/src/common/ast-path.js
@@ -136,18 +136,18 @@ export class AstPath<T = any> {
136
136
  call<U>(callback: CallCallback<T, U>): U;
137
137
  call<U, P1 extends CallProperties<T>>(
138
138
  callback: CallCallback<IndexValue<T, P1>, U>,
139
- prop1: P1
139
+ prop1: P1,
140
140
  ): U;
141
141
  call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>>(
142
142
  callback: CallCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
143
143
  prop1: P1,
144
- prop2: P2
144
+ prop2: P2,
145
145
  ): U;
146
146
  call<
147
147
  U,
148
148
  P1 extends keyof T,
149
149
  P2 extends CallProperties<T[P1]>,
150
- P3 extends CallProperties<IndexValue<T[P1], P2>>
150
+ P3 extends CallProperties<IndexValue<T[P1], P2>>,
151
151
  >(
152
152
  callback: CallCallback<
153
153
  IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>,
@@ -155,14 +155,14 @@ export class AstPath<T = any> {
155
155
  >,
156
156
  prop1: P1,
157
157
  prop2: P2,
158
- prop3: P3
158
+ prop3: P3,
159
159
  ): U;
160
160
  call<
161
161
  U,
162
162
  P1 extends keyof T,
163
163
  P2 extends CallProperties<T[P1]>,
164
164
  P3 extends CallProperties<IndexValue<T[P1], P2>>,
165
- P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>>
165
+ P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
166
166
  >(
167
167
  callback: CallCallback<
168
168
  IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
@@ -171,7 +171,7 @@ export class AstPath<T = any> {
171
171
  prop1: P1,
172
172
  prop2: P2,
173
173
  prop3: P3,
174
- prop4: P4
174
+ prop4: P4,
175
175
  ): U;
176
176
  call<U, P extends PropertyKey>(
177
177
  callback: CallCallback<any, U>,
@@ -185,28 +185,28 @@ export class AstPath<T = any> {
185
185
  each(callback: EachCallback<T>): void;
186
186
  each<P1 extends IterProperties<T>>(
187
187
  callback: EachCallback<IndexValue<T, P1>>,
188
- prop1: P1
188
+ prop1: P1,
189
189
  ): void;
190
190
  each<P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
191
191
  callback: EachCallback<IndexValue<IndexValue<T, P1>, P2>>,
192
192
  prop1: P1,
193
- prop2: P2
193
+ prop2: P2,
194
194
  ): void;
195
195
  each<
196
196
  P1 extends keyof T,
197
197
  P2 extends IterProperties<T[P1]>,
198
- P3 extends IterProperties<IndexValue<T[P1], P2>>
198
+ P3 extends IterProperties<IndexValue<T[P1], P2>>,
199
199
  >(
200
200
  callback: EachCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>>,
201
201
  prop1: P1,
202
202
  prop2: P2,
203
- prop3: P3
203
+ prop3: P3,
204
204
  ): void;
205
205
  each<
206
206
  P1 extends keyof T,
207
207
  P2 extends IterProperties<T[P1]>,
208
208
  P3 extends IterProperties<IndexValue<T[P1], P2>>,
209
- P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>
209
+ P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
210
210
  >(
211
211
  callback: EachCallback<
212
212
  IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>
@@ -214,7 +214,7 @@ export class AstPath<T = any> {
214
214
  prop1: P1,
215
215
  prop2: P2,
216
216
  prop3: P3,
217
- prop4: P4
217
+ prop4: P4,
218
218
  ): void;
219
219
  each(
220
220
  callback: EachCallback<any[]>,
@@ -228,30 +228,30 @@ export class AstPath<T = any> {
228
228
  map<U>(callback: MapCallback<T, U>): U[];
229
229
  map<U, P1 extends IterProperties<T>>(
230
230
  callback: MapCallback<IndexValue<T, P1>, U>,
231
- prop1: P1
231
+ prop1: P1,
232
232
  ): U[];
233
233
  map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
234
234
  callback: MapCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
235
235
  prop1: P1,
236
- prop2: P2
236
+ prop2: P2,
237
237
  ): U[];
238
238
  map<
239
239
  U,
240
240
  P1 extends keyof T,
241
241
  P2 extends IterProperties<T[P1]>,
242
- P3 extends IterProperties<IndexValue<T[P1], P2>>
242
+ P3 extends IterProperties<IndexValue<T[P1], P2>>,
243
243
  >(
244
244
  callback: MapCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>,
245
245
  prop1: P1,
246
246
  prop2: P2,
247
- prop3: P3
247
+ prop3: P3,
248
248
  ): U[];
249
249
  map<
250
250
  U,
251
251
  P1 extends keyof T,
252
252
  P2 extends IterProperties<T[P1]>,
253
253
  P3 extends IterProperties<IndexValue<T[P1], P2>>,
254
- P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>
254
+ P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
255
255
  >(
256
256
  callback: MapCallback<
257
257
  IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
@@ -260,7 +260,7 @@ export class AstPath<T = any> {
260
260
  prop1: P1,
261
261
  prop2: P2,
262
262
  prop3: P3,
263
- prop4: P4
263
+ prop4: P4,
264
264
  ): U[];
265
265
  map<U>(
266
266
  callback: MapCallback<any[], U>,
@@ -304,7 +304,7 @@ export type BuiltInParsers = Record<BuiltInParserName, BuiltInParser>;
304
304
 
305
305
  export type CustomParser = (
306
306
  text: string,
307
- options: Options
307
+ options: Options,
308
308
  ) => AST | Promise<AST>;
309
309
 
310
310
  /**
@@ -467,24 +467,27 @@ export interface Printer<T = any> {
467
467
  path: AstPath<T>,
468
468
  options: ParserOptions<T>,
469
469
  print: (path: AstPath<T>) => Doc,
470
- args?: unknown
470
+ args?: unknown,
471
471
  ): Doc;
472
472
  embed?:
473
473
  | ((
474
474
  path: AstPath,
475
- options: Options
475
+ options: Options,
476
476
  ) =>
477
477
  | ((
478
478
  textToDoc: (text: string, options: Options) => Promise<Doc>,
479
479
  print: (
480
- selector?: string | number | Array<string | number> | AstPath
480
+ selector?: string | number | Array<string | number> | AstPath,
481
481
  ) => Doc,
482
482
  path: AstPath,
483
- options: Options
483
+ options: Options,
484
484
  ) => Promise<Doc | undefined> | Doc | undefined)
485
485
  | Doc
486
486
  | null)
487
487
  | undefined;
488
+ preprocess?:
489
+ | ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
490
+ | undefined;
488
491
  insertPragma?: (text: string) => string;
489
492
  /**
490
493
  * @returns `null` if you want to remove this node
@@ -517,7 +520,7 @@ export interface Printer<T = any> {
517
520
  text: string,
518
521
  options: ParserOptions<T>,
519
522
  ast: T,
520
- isLastComment: boolean
523
+ isLastComment: boolean,
521
524
  ) => boolean)
522
525
  | undefined;
523
526
  endOfLine?:
@@ -526,7 +529,7 @@ export interface Printer<T = any> {
526
529
  text: string,
527
530
  options: ParserOptions<T>,
528
531
  ast: T,
529
- isLastComment: boolean
532
+ isLastComment: boolean,
530
533
  ) => boolean)
531
534
  | undefined;
532
535
  remaining?:
@@ -535,11 +538,14 @@ export interface Printer<T = any> {
535
538
  text: string,
536
539
  options: ParserOptions<T>,
537
540
  ast: T,
538
- isLastComment: boolean
541
+ isLastComment: boolean,
539
542
  ) => boolean)
540
543
  | undefined;
541
544
  }
542
545
  | undefined;
546
+ getVisitorKeys?:
547
+ | ((node: T, nonTraversableKeys: Set<string>) => string[])
548
+ | undefined;
543
549
  }
544
550
 
545
551
  export interface CursorOptions extends Options {
@@ -575,7 +581,7 @@ export function check(source: string, options?: Options): Promise<boolean>;
575
581
  */
576
582
  export function formatWithCursor(
577
583
  source: string,
578
- options: CursorOptions
584
+ options: CursorOptions,
579
585
  ): Promise<CursorResult>;
580
586
 
581
587
  export function formatAST(ast: any, options?: Options): Promise<string>;
@@ -616,7 +622,7 @@ export interface ResolveConfigOptions {
616
622
  */
617
623
  export function resolveConfig(
618
624
  filePath: string,
619
- options?: ResolveConfigOptions
625
+ options?: ResolveConfigOptions,
620
626
  ): Promise<Options | null>;
621
627
 
622
628
  /**
@@ -792,7 +798,7 @@ export interface FileInfoResult {
792
798
 
793
799
  export function getFileInfo(
794
800
  filePath: string,
795
- options?: FileInfoOptions
801
+ options?: FileInfoOptions,
796
802
  ): Promise<FileInfoResult>;
797
803
 
798
804
  /**
@@ -820,7 +826,7 @@ export namespace util {
820
826
  function getAlignmentSize(
821
827
  text: string,
822
828
  tabWidth: number,
823
- startIndex?: number | undefined
829
+ startIndex?: number | undefined,
824
830
  ): number;
825
831
 
826
832
  function getIndentSize(value: string, tabWidth: number): number;
@@ -828,83 +834,83 @@ export namespace util {
828
834
  function skipNewline(
829
835
  text: string,
830
836
  startIndex: number | false,
831
- options?: SkipOptions | undefined
837
+ options?: SkipOptions | undefined,
832
838
  ): number | false;
833
839
 
834
840
  function skipInlineComment(
835
841
  text: string,
836
- startIndex: number | false
842
+ startIndex: number | false,
837
843
  ): number | false;
838
844
 
839
845
  function skipTrailingComment(
840
846
  text: string,
841
- startIndex: number | false
847
+ startIndex: number | false,
842
848
  ): number | false;
843
849
 
844
850
  function skipTrailingComment(
845
851
  text: string,
846
- startIndex: number | false
852
+ startIndex: number | false,
847
853
  ): number | false;
848
854
 
849
855
  function hasNewline(
850
856
  text: string,
851
857
  startIndex: number,
852
- options?: SkipOptions | undefined
858
+ options?: SkipOptions | undefined,
853
859
  ): boolean;
854
860
 
855
861
  function hasNewlineInRange(
856
862
  text: string,
857
863
  startIndex: number,
858
- endIndex: number
864
+ endIndex: number,
859
865
  ): boolean;
860
866
 
861
867
  function hasSpaces(
862
868
  text: string,
863
869
  startIndex: number,
864
- options?: SkipOptions | undefined
870
+ options?: SkipOptions | undefined,
865
871
  ): boolean;
866
872
 
867
873
  function getNextNonSpaceNonCommentCharacter(
868
874
  text: string,
869
- startIndex: number
875
+ startIndex: number,
870
876
  ): string;
871
877
 
872
878
  function makeString(
873
879
  rawText: string,
874
880
  enclosingQuote: Quote,
875
- unescapeUnnecessaryEscapes?: boolean | undefined
881
+ unescapeUnnecessaryEscapes?: boolean | undefined,
876
882
  ): string;
877
883
 
878
884
  function skip(
879
- characters: string | RegExp
885
+ characters: string | RegExp,
880
886
  ): (
881
887
  text: string,
882
888
  startIndex: number | false,
883
- options?: SkipOptions
889
+ options?: SkipOptions,
884
890
  ) => number | false;
885
891
 
886
892
  const skipWhitespace: (
887
893
  text: string,
888
894
  startIndex: number | false,
889
- options?: SkipOptions
895
+ options?: SkipOptions,
890
896
  ) => number | false;
891
897
 
892
898
  const skipSpaces: (
893
899
  text: string,
894
900
  startIndex: number | false,
895
- options?: SkipOptions
901
+ options?: SkipOptions,
896
902
  ) => number | false;
897
903
 
898
904
  const skipToLineEnd: (
899
905
  text: string,
900
906
  startIndex: number | false,
901
- options?: SkipOptions
907
+ options?: SkipOptions,
902
908
  ) => number | false;
903
909
 
904
910
  const skipEverythingButNewLine: (
905
911
  text: string,
906
912
  startIndex: number | false,
907
- options?: SkipOptions
913
+ options?: SkipOptions,
908
914
  ) => number | false;
909
915
 
910
916
  function addLeadingComment(node: any, comment: any): void;