alioth/before/hoto-auth-vue3/.eslintrc.cjs
2025-05-30 09:18:01 +08:00

59 lines
2.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
},
rules:{
'indent': [
'error',
4,
{
SwitchCase: 1
}
],
'max-len': ['error', {
'code': 180, // 指定最大代码长度
'ignoreStrings': true, // 忽略字符串中的字符长度
'ignoreUrls': true, // 忽略URL的长度
'ignoreComments': false, // 注释中的字符会计入长度限制
'ignoreTemplateLiterals': true, // 忽略模板字符串的长度
'tabWidth': 4 // 设置制表符的宽度
}],
'quotes': ['error', 'single'], // 强制使用一致的引号风格
'no-unused-expressions': 'error', // 禁止使用未使用的表达式
'no-console': 'error', // 禁止使用console
'semi': ['error', 'always'], // 启用 semi 规则,要求语句后总是使用分号,并将其设置为错误
'no-const-assign': 'error', //禁止给 const 声明的变量赋值
'no-multi-spaces': 'error', //禁止使用多个空格。
'no-trailing-spaces': 'error', //:禁止行尾有空格。
'no-undef': 'error', //:禁止使用未声明的变量。
'no-empty': 2, //块语句中的内容不能为空
'no-extra-semi': 2, //禁止多余的冒号
'no-func-assign': 2, //禁止重复的函数声明
'space-before-function-paren': [
'error',
{
// "always" - 要求在函数名和参数列表之间总是有空白。
// "never" - 禁止在函数名和参数列表之间有空格。
anonymous: 'always', // "anonymous" - 指定匿名函数表达式前的空格要求("always" 或 "never")。
named: 'never', // "named" - 指定具名函数表达式前的空格要求("always" 或 "never")。
asyncArrow: 'always' // "asyncArrow" - 指定异步箭头函数前的空格要求("always" 或 "never"
}
],
'no-multiple-empty-lines': [1, { max: 2 }], //空行最多不能超过2行
'no-nested-ternary': 0, //禁止使用嵌套的三目运算
'no-redeclare': 2, //禁止重复声明变量
'no-shadow': 2, //外部作用域中的变量不能与它所包含的作用域中的变量或参数同名
'no-mixed-spaces-and-tabs': 'error', // 禁止在代码中混用空格和制表符
}
};