import type { ChoiceSupportOption } from 'prettier' ; import { CATEGORY_PUG } from '.' ; /** Pug attribute separator option. */ export const PUG_ATTRIBUTE_SEPARATOR_OPTION = { since : '1.6.0' , category : CATEGORY_PUG , type : 'choice' , default : 'always' , description : 'Change when attributes are separated by commas in tags.' , choices : [ { value : 'always' , description : 'Always separate attributes with commas. Example: `button(type="submit", (click)="play()", disabled)`' , } , { value : 'as-needed' , description : 'Only add commas between attributes where required. Example: `button(type="submit", (click)="play()" disabled)`' , } , { value : 'none' , description : 'Never add commas between attributes. Example: `button(type="submit" @click="play()" :style="style" disabled)`' , } , ] , } ; /** Pug Attribute separator. */ export type PugAttributeSeparator = 'always' | 'as-needed' | 'none' ; param pugAttributeSeparator returns throws export function resolvePugAttributeSeparatorOption ( pugAttributeSeparator ) { switch ( pugAttributeSeparator ) { case 'always' : case 'as-needed' : case 'none' : return pugAttributeSeparator ; } throw new Error ( `Invalid option for pugAttributeSeparator. Found '${ pugAttributeSeparator }'. Possible options: 'always', 'as-needed' or 'none'` ) ; }