
.eslintrc.js
module.exports = {
//此项是用来告诉eslint找当前配置文件不能往父级查找
root: true,
parser: 'vue-eslint-parser',
plugins: ['@typescript-eslint', 'vue'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended'
],
env: {
node: true
},
parserOptions: {
'parser': '@typescript-eslint/parser',
'ecmaVersion': 7,
'sourceType': 'module',
'ecmaFeatures': {
'modules': true
}
},
rules: {
'@typescript-eslint/member-delimiter-style': [
2, {
'multiline': {
'delimiter': 'comma',
'requireLast': false
},
'singleline': {
'delimiter': 'comma',
'requireLast': false
}
}
],
//return后面是否允许省略
'array-callback-return': 1,
//箭头函数的参数可以不使用圆括号
'arrow-parens': ['error', 'as-needed'],
//要求return语句要么总是指定返回的值,要么不指定
'consistent-return': 0,
//强制驼峰法命名
'camelcase': 0,
//要求或禁止使用拖尾逗号
'comma-dangle': ['error', 'never'],
//强制全等( === 和 !==)
'eqeqeq': 0,
//函数表达式必须有名字
'func-names': 0,
//取消对require的验证,使得可以使用require来加载图片的相对路径
'global-require': 0,
//取消自动解析路径,以此开启alias的别名路径设置
'import/no-unresolved': 0,
//取消对文件扩展名的验证
'import/extensions': 0,
//混合ts
'indent': 'off',
//缩进风格(强制使用一致的缩进)
'@typescript-eslint/indent': ['error', 4, { 'VariableDeclarator': 4 }],
'@typescript-eslint/explicit-function-return-type': 'off',
//取消换行符\n或\r\n的验证()
'linebreak-style': 0,
//字符串最大长度
'max-len': 0,
//使用const和let代替var
'no-var': 'error',
'no-undef':'off',
//禁止出现未使用过的变量
'no-unused-vars': 'off',
//合并选项
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any':'off',
//禁止多次声明同一变量
'no-redeclare': 1,
//禁止在变量定义之前使用它们
'no-use-before-define': 1,
//允许使用未使用过的表达式,以此来支持a && a()的代码形式
'no-unused-expressions': 0,
//禁用特定的语法
'no-restricted-syntax': 1,
//禁止使用++ --
'no-plusplus': 0,
//允许在标识符中使用下划线
'no-underscore-dangle': 0,
//禁止对function的参数进行重新赋值
'no-param-reassign': 0,
//禁止嵌套三元表达式
'no-nested-ternary': 0,
//禁止if语句中return语句之后有else块
'no-else-return': 0,
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
//外部作用域中的变量不能与它所包含的作用域中的变量或参数同名
'no-shadow': [
0, {
'allow': ['resolve', 'reject', 'done', 'cb']
}
],
//要求使用剩余参数而不是arguments
'prefer-rest-params': 1,
//要求回调函数使用箭头函数
'prefer-arrow-callback': 0,
//首选const
'prefer-const': 1,
//使用分号
'semi': [2, 'never'],
//使用单引号
'quotes': [2, 'single'],
//要求或禁止模板字符串中的嵌入表达式周围空格的使用
'template-curly-spacing': 'off',
//运算符两边必须包含空格
'space-infix-ops': ['error', { 'int32Hint': true }],
//强制在花括号中使用一致的空格
'object-curly-spacing': ['error', 'always', { 'objectsInObjects': false }],
'array-bracket-newline': ['error', { 'multiline': true }],
'arrow-spacing': ['error', { 'before': true, 'after': true }],
'vue/max-attributes-per-line': [
'error', {
'singleline': {
'max': 100,
'allowFirstLine': true
},
'multiline': {
'max': 100,
'allowFirstLine': true
}
}
],
'vue/no-v-html':'off',
'vue/require-default-prop': 0,
'vue/singleline-html-element-content-newline': [
0, {
'ignoreWhenNoAttributes': false,
'ignoreWhenEmpty': false,
'ignores': ['pre', 'textarea']
}
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment':'off',
'@typescript-eslint/explicit-module-boundary-types':'off',
'vue/html-indent': [
'error', 4, {
'attribute': 1,
'baseIndent': 1,
'closeBracket': 0,
'alignAttributesVertically': true,
'ignores': []
}
]
}
}
共0人打赏
打赏的土豪们
Rewarded users
暂无打赏
© 未经允许禁止转载
「留下足迹」- Footprint