前端开发用的比较多的语法格式化无非ESLint和Prettier,但是Prettier在vue中适配只能说一般吧,就比如vue中的>括号一直有bug,记录下修复
Prettier 修复尖括号换行
添加这个属性就行
{
"htmlWhitespaceSensitivity": "ignore"
}
例子
module.exports = {
bracketSpacing: true,
singleQuote: true,
jsxSingleQuote: true,
tabWidth: 2,
semi: true,
// 标签闭合位置 默认false
bracketSameLine: true,
jsxBracketSameLine: true,
//指定换行长度
printWidth: 120,
// avoid 能省略括号的时候就省略 例如x => x
arrowParens: 'avoid',
vueIndentScriptAndStyle: true,
trailingComma: 'all',
proseWrap: 'never',
htmlWhitespaceSensitivity: 'ignore',
endOfLine: 'auto',
}
版权声明:本文为「诚哥博客」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://www.chengzz.com/426.html