fejn-eslint-vue
Version:
eslint-vue
79 lines (76 loc) • 1.69 kB
JavaScript
import antfu from '@antfu/eslint-config';
const index = (options, ...userConfigs) => {
const ignores = options?.ignores || [];
if (options?.ignores) {
delete options?.ignores;
}
return antfu(
{
typescript: true,
vue: true,
stylistic: {
indent: 4
},
formatters: {
css: true,
html: true,
markdown: "prettier"
},
...options,
ignores: [
".vscode/**",
...ignores
]
},
{
rules: {
"style/indent": ["error", 4],
// 缩进空格
"style/semi": ["error", "always"],
// 结尾分号
"curly": ["error", "all"],
// 条件语句强制大括号
"style/brace-style": ["error", "1tbs"],
"style/indent-binary-ops": ["error", 4],
// 'antfu/top-level-function': 'off',
// 每行最大长度
"max-len": ["error", {
code: 150
}],
// vue相关
"vue/html-indent": ["error", 4],
// 属性数量
"vue/max-attributes-per-line": ["error", {
singleline: {
max: 2
},
multiline: {
max: 1
}
}],
// ts 相关
"ts/ban-ts-comment": "off",
// 注释长度限制
// 声明类型优先 type
"ts/consistent-type-definitions": [
"error",
"type"
]
}
},
{
files: ["**/*.md", "**/*.json"],
rules: {
"max-len": ["off"]
}
},
{
files: ["**/*.yaml"],
rules: {
"yaml/indent": ["error", 2]
}
},
...userConfigs
);
};
export { index as default };