要禁止 Prettier 自动在单独的标签上添加封闭符号,可以在 Prettier 配置文件中添加以下选项:

{
  "printWidth": 80,
  "singleQuote": true,
  "jsxBracketSameLine": true,
  "jsxSingleQuote": true,
  "proseWrap": "never",
  "htmlWhitespaceSensitivity": "ignore",
  "insertPragma": false,
  "requirePragma": false,
  "endOfLine": "lf",
  "semi": true,
  "trailingComma": "all",
  "arrowParens": "always",
  "bracketSpacing": true,
  "useTabs": false,
  "tabWidth": 2,
  "quoteProps": "as-needed",
  "vueIndentScriptAndStyle": false,
  "jsxClosingBracketSameLine": false // 禁止自动添加封闭标签
}

jsxClosingBracketSameLine设置为false即可禁止自动添加封闭标签。

prettier 格式化是不要自动给标签添加封闭 如何配置

原文地址: https://www.cveoy.top/t/topic/bglo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录