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
In TS we have enums with comments aligned like so:
exportconstenumTypeFacts{None=0,TypeofEQString=1<<0,// typeof x === "string"TypeofEQNumber=1<<1,// typeof x === "number"TypeofEQBigInt=1<<2,// typeof x === "bigint"TypeofEQBoolean=1<<3,// typeof x === "boolean"TypeofEQSymbol=1<<4,// typeof x === "symbol"TypeofEQObject=1<<5,// typeof x === "object"TypeofEQFunction=1<<6,// typeof x === "function"TypeofEQHostObject=1<<7,// typeof x === "xxx"TypeofNEString=1<<8,// typeof x !== "string"TypeofNENumber=1<<9,// typeof x !== "number"TypeofNEBigInt=1<<10,// typeof x !== "bigint"TypeofNEBoolean=1<<11,// typeof x !== "boolean"TypeofNESymbol=1<<12,// typeof x !== "symbol"TypeofNEObject=1<<13,// typeof x !== "object"TypeofNEFunction=1<<14,// typeof x !== "function"TypeofNEHostObject=1<<15,// typeof x !== "xxx"EQUndefined=1<<16,// x === undefinedEQNull=1<<17,// x === nullEQUndefinedOrNull=1<<18,// x === undefined / x === null}
But, dprint reformats this like:
exportconstenumTypeFacts{None=0,TypeofEQString=1<<0,// typeof x === "string"TypeofEQNumber=1<<1,// typeof x === "number"TypeofEQBigInt=1<<2,// typeof x === "bigint"TypeofEQBoolean=1<<3,// typeof x === "boolean"TypeofEQSymbol=1<<4,// typeof x === "symbol"TypeofEQObject=1<<5,// typeof x === "object"TypeofEQFunction=1<<6,// typeof x === "function"TypeofEQHostObject=1<<7,// typeof x === "xxx"TypeofNEString=1<<8,// typeof x !== "string"TypeofNENumber=1<<9,// typeof x !== "number"TypeofNEBigInt=1<<10,// typeof x !== "bigint"TypeofNEBoolean=1<<11,// typeof x !== "boolean"TypeofNESymbol=1<<12,// typeof x !== "symbol"TypeofNEObject=1<<13,// typeof x !== "object"TypeofNEFunction=1<<14,// typeof x !== "function"TypeofNEHostObject=1<<15,// typeof x !== "xxx"EQUndefined=1<<16,// x === undefinedEQNull=1<<17,// x === nullEQUndefinedOrNull=1<<18,// x === undefined / x === null}
Maybe it makes more sense for these comments to be JSDoc or something, but I think a lot of these comments are intended to be internal and not visible in d.ts files. I'd have to find more examples where it matters, though.
Likely, an ignore comment could be used when it matters to keep formatting (we have some cases where it matters), but this is visually pleasing. As a comparison, go fmt will format aligned comments in situations similar to the above, so it's not unprecedented overall, but prettier does format things like dprint currently does.
The text was updated successfully, but these errors were encountered:
In TS we have enums with comments aligned like so:
But, dprint reformats this like:
Maybe it makes more sense for these comments to be JSDoc or something, but I think a lot of these comments are intended to be internal and not visible in d.ts files. I'd have to find more examples where it matters, though.
Likely, an ignore comment could be used when it matters to keep formatting (we have some cases where it matters), but this is visually pleasing. As a comparison,
go fmt
will format aligned comments in situations similar to the above, so it's not unprecedented overall, but prettier does format things like dprint currently does.The text was updated successfully, but these errors were encountered: