Skip to content

@antfu/eslint-config

sh
pnpm i -D  @antfu/eslint-config

antfu/if-newline

用于if 语句后强制或禁止换行。默认行为是要求在 if 语句后添加一个空行,以提高代码可读性

ts
if (condition) {
  doSomething()
}
doAnotherThing()
ts
if (condition) {
  doSomething()
}

doAnotherThing()

antfu/vue/rules

vue内建风格

规则级别注释
vue/padding-line-between-blockserror要求块之间存在空行
vue/define-macros-ordererror要求编译宏顺序(如 definePropsdefineEmits
vue/custom-event-name-casingerror组件自定义事件统一用camelCase命名
vue/v-on-event-hyphenationerror控制 v-on中事件名的命名风格为kebab-case。
vue/component-tags-order["template", "script", "style"]
vue/component-options-name-casing确保组件命名统一为 PascalCase
vue/component-name-in-template-casingerror在模板里使用组件时命名风格为PascalCase
vue/block-ordererror块顺序:["script", "template", "style"]
vue/attributes-order根据antfu指定的顺序排序
vue/html-self-closing强制自闭合组件和普通元素
vue/component-definition-name-casing强制组件定义的 name 属性使用 PascalCase