Prettier 1.19 发布,前端代码格式化工具

2019-11-11 12:05

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
> => {};

请见发布说明


路过

雷人

握手

鲜花

鸡蛋

周一至周日9:00-18:00

反馈建议

service#bjjem.com 在线QQ咨询

扫描二维码关注我们

Powered by Discuz! © 2001-2019