在.eslintrc.cjs中配置
{
rules: {
'prettier/prettier': [
'warn',
{
singleQuote: true,
semi: false,
printWidth: 80,
trailingComma: 'none',
endOfLine: 'auto'
}
],
'vue/multi-word-component-names': [
'warn',
{
ignores: ['index']
}
],
'vue/no-setup-props-destructure': ['off']
}
}
- 格式:单引号,没有分号,行宽度 80 字符,省略最后一个逗号,换行字符串自动(系统不一样换行符号不一样)。
- Vue 组件需要大驼峰命名,除去 index 之外,App 是默认支持的。
- 允许对 props 进行解构,因为我们会开启解构保持响应式的语法糖。
VSCode 开启 ESLint 自动修复, .vscode/settings.json
。
{
// 省略其他
"editor.codeActionsOnSave": {
"source.fixAll": true,
}
}