File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ for (const parser of supportedParsers) {
125125 test ( `${ parser } : throws if jsonRecursiveSort is not a boolean` , async ( t ) => {
126126 await t . throwsAsync (
127127 async ( ) =>
128+ // @ts -expect-error Testing invalid option type
128129 format ( '{}' , {
129130 filepath : `foo.${ fileExtensions [ parser ] } ` ,
130131 parser,
@@ -143,6 +144,7 @@ for (const parser of supportedParsers) {
143144 test ( `${ parser } : throws if custom sort is not a string` , async ( t ) => {
144145 await t . throwsAsync (
145146 async ( ) =>
147+ // @ts -expect-error Testing invalid option type
146148 format ( '{}' , {
147149 filepath : `foo.${ fileExtensions [ parser ] } ` ,
148150 parser,
Original file line number Diff line number Diff line change @@ -480,3 +480,23 @@ export const options = {
480480 type : 'string' as const ,
481481 } ,
482482} ;
483+
484+ /*
485+ * Augument Prettier’s `Options` interface with JSON sorting options.
486+ */
487+ declare module 'prettier' {
488+ /* eslint-disable-next-line @typescript-eslint/consistent-type-definitions */
489+ interface Options {
490+ /**
491+ * Sort JSON objects recursively, including all nested objects. This also sorts objects within JSON arrays.
492+ *
493+ * @default false
494+ */
495+ jsonRecursiveSort ?: boolean | undefined ;
496+
497+ /**
498+ * Use a custom sort order. This is specified as a JSON string containing a set of sorting rules.
499+ */
500+ jsonSortOrder ?: string | undefined ;
501+ }
502+ }
You can’t perform that action at this time.
0 commit comments