Prettier 1.19 發布,前端代碼格式化工具

←手機掃碼閱讀     admin @ 2019-11-11 , reply:0

Prettier 1.19 已經發布,主要更新內容如下:

CLI

  • 修復 1.19.0 版本中 --stdin 回歸

// Prettier stable
$ echo "test" | prettier --stdin --parser babel
[error] regeneratorRuntime is not defined

// Prettier master
$ echo "test" | prettier --stdin --parser babel
test;

 TypeScript

  • 修復聯合類型格式化為箭頭函數返回類型

// Input
export const getVehicleDescriptor = async (
  vehicleId: string,
): Promise<Collections.Parts.PrintedCircuitBoardAssembly['attributes'] | undefined> => {}

// Prettier stable
export const getVehicleDescriptor = async (
  vehicleId: string
): Promise<| Collections.Parts.PrintedCircuitBoardAssembly["attributes"]
| undefined> => {};

// Prettier master
export const getVehicleDescriptor = async (
  vehicleId: string
): Promise<
  Collections.Parts.PrintedCircuitBoardAssembly["attributes"] | undefined
> => {};

請見發布說明





[admin ]

來源:OsChina
連結:https://www.oschina.net/news/111216/prettier-1-19-released
Prettier 1.19 發布,前端代碼格式化工具已經有20次圍觀

http://coctec.com/news/all/show-post-219177.html