我已经安装了漂亮的文件,并且在我运行prettier --write .
我正在尝试使用vscode插件将其设置为“保存时格式化” ...但这似乎无法正确格式化。我可以弄清楚是什么原因造成的。
给出以下代码(当我运行prettier --write .
时,它不变):
import React from "react";
const TestComponent = ({ someVal = "hello world" }) => (
<div>
<span>{someVal}</span>
</div>
);
如果我启用“保存时格式化”并保存文件,它将代码更改为:
import React from "react";
const TestComponent = ({
someVal = "hello world"
}) => ( <
div >
<
span > {
someVal
} < /span> <
/div>
);
我的.prettierrc.json
为空,如以下内容所述:https://prettier.io/docs/en/install.html:
{}
其他人有没有经历过或知道如何解决?