gpt4 book ai didi

javascript - 更漂亮没有正确格式化空行

转载 作者:行者123 更新时间:2023-12-05 00:36:45 25 4
gpt4 key购买 nike

在下面的 React Native 代码中,我期待 更漂亮删除空行,但没有。

screenOptions={{
headerTitleStyle: {
color: "#a41034",

fontWeight: "bold",
},

为什么呢?

最佳答案

因为 Prettier 不会删除单个空行(通常)。

来自 "empty lines" docs :

[Prettier preserves] empty lines the way they were in the original source code. There are two additional rules:

  • Prettier collapses multiple blank lines into a single blank line.
  • Empty lines at the start and end of blocks (and whole files) are removed. (Files always end with a single newline, though.)


此外,如果左大括号后有换行符,多行对象不会折叠成单行。

关于javascript - 更漂亮没有正确格式化空行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61193625/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com