17681880207
V2EX  ›  问与答

各位大佬,求问一个 Prettier 配置问题。

  •  
  •   17681880207 · Oct 23, 2023 · 1052 views
    This topic created in 943 days ago, the information mentioned may be changed or developed.

    vscode 使用 prettier 进行格式化。
    有一个 eslint-plugin-vue 的配置 “vue/singleline-html-element-content-newline”:

    <template>
      <div>
        aaa
      </div>
    </template>
    

    格式化之后:

    <template>
      <div>aaa</div>
    </template>
    

    有没有 prettier 配置,有办法让 aaa 保留在新的一行?

    相关文档: https://eslint.vuejs.org/rules/singleline-html-element-content-newline.html

    2 replies    2023-11-06 11:06:25 +08:00
    stardewValley
        1
    stardewValley  
       Oct 23, 2023
    "htmlWhitespaceSensitivity": "ignore"
    17681880207
        2
    17681880207  
    OP
       Nov 6, 2023
    @stardewValley
    额,老哥这个方法试过了,并没有什么效果,依旧是会换行。😗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2205 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 44ms · UTC 00:35 · PVG 08:35 · LAX 17:35 · JFK 20:35
    ♥ Do have faith in what you're doing.