33import { toKebabCase } from "kasi" ;
44import { bin , color , exit , parseArgv } from "specialist" ;
55import { PRETTIER_VERSION , DEFAULT_PARSERS } from "./constants.js" ;
6- import { getPlugin , isBoolean , isNumber , isIntegerInRange , isString } from "./utils.js" ;
6+ import { getPluginOrExit , isBoolean , isNumber , isIntegerInRange , isString } from "./utils.js" ;
77import { normalizeOptions , normalizeFormatOptions , normalizePluginOptions } from "./utils.js" ;
8- import type { Bin , PluginsOptions } from "./types.js" ;
8+ import type { Bin , PluginsOptions , PrettierPlugin } from "./types.js" ;
99
1010const makeBin = ( ) : Bin => {
1111 return (
@@ -53,6 +53,10 @@ const makeBin = (): Bin => {
5353 section : "Format" ,
5454 enum : [ "lf" , "crlf" , "cr" , "auto" ] ,
5555 } )
56+ . option ( "--experimental-operator-position <start|end>" , 'Where to print operators when binary expressions wrap lines\nDefaults to "end"' , {
57+ section : "Format" ,
58+ enum : [ "start" , "end" ] ,
59+ } )
5660 . option ( "--experimental-ternaries" , 'Use curious ternaries, with the question mark after the condition\nDefaults to "false"' , {
5761 section : "Format" ,
5862 } )
@@ -63,6 +67,10 @@ const makeBin = (): Bin => {
6367 . option ( "--jsx-single-quote" , 'Use single quotes in JSX\nDefaults to "false"' , {
6468 section : "Format" ,
6569 } )
70+ . option ( "--object-wrap <preserve|collapse>" , 'How to wrap object literals\nDefaults to "preserve"' , {
71+ section : "Format" ,
72+ enum : [ "preserve" , "collapse" ] ,
73+ } )
6674 . option ( `--parser <${ DEFAULT_PARSERS . join ( '|' ) } >` , "Which parser to use" , {
6775 section : "Format" ,
6876 enum : DEFAULT_PARSERS ,
@@ -208,7 +216,7 @@ const makePluggableBin = async (): Promise<Bin> => {
208216
209217 for ( let i = 0 , l = pluginsNames . length ; i < l ; i ++ ) {
210218 const pluginName = pluginsNames [ i ] ;
211- const plugin = await getPlugin ( pluginName ) ;
219+ const plugin = await getPluginOrExit ( pluginName ) ;
212220
213221 for ( const option in plugin . options ) {
214222 optionsNames . push ( option ) ;
0 commit comments