mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
98 lines
4.0 KiB
JavaScript
98 lines
4.0 KiB
JavaScript
module.exports = {
|
||
root: true,
|
||
env: {
|
||
node: true
|
||
},
|
||
extends: [
|
||
'eslint:recommended',
|
||
'plugin:vue/vue3-recommended', // Vue 项目
|
||
'prettier' // 必须放在最后
|
||
],
|
||
parser: 'vue-eslint-parser', // 解析 .vue 文件
|
||
|
||
globals: {
|
||
T: 'readonly' // 声明 T 是只读的全局变量
|
||
},
|
||
plugins: ['react', '@typescript-eslint', 'prettier'], // 添加 prettier 插件
|
||
rules: {
|
||
camelcase: 'off',
|
||
'vue/require-explicit-emits': 'off', // 关闭 emits 声明检查
|
||
'vue/v-on-event-hyphenation': 'off',
|
||
'prettier/prettier': 'off',
|
||
'react/react-in-jsx-scope': 'off', // React 17+ 可关闭 JSX 运行时检查
|
||
// off=0, warn=1, error=2, 如果是数组, 第二项表示参数option
|
||
'vue/attributes-order': 0,
|
||
indent: [2, 2], // 控制缩进为2
|
||
eqeqeq: 0, // 警告使用全等
|
||
quotes: [0, 'single'], // 单引号
|
||
singleQuote: 0,
|
||
'no-console': 0, // 不禁用console
|
||
'no-debugger': 0, // 警告debugger
|
||
'no-var': 2, // 对var禁止
|
||
'no-eval': 0,
|
||
semi: 0, // 强制使用分号
|
||
'comma-dangle': 0,
|
||
'semi-spacing': [0, { before: false, after: false }], // 强制分号前后不允许空格
|
||
// 'no-irregular-whitespace': 0, // 不规则的空白不允许
|
||
// 'no-trailing-spaces': 1, // 一行结束后面有空格就发出警告
|
||
'eol-last': 0, // 文件以单一的换行符结束
|
||
'no-unused-vars': 0, // 不能有声明后未被使用的变量或参数
|
||
'no-underscore-dangle': 0, // 标识符不能以_开头或结尾
|
||
'no-alert': 2, // 禁止使用alert confirm prompt
|
||
'no-lone-blocks': 0, // 禁止不必要的嵌套块
|
||
'no-class-assign': 2, // 禁止给类赋值
|
||
'no-cond-assign': 2, // 禁止在条件表达式中使用赋值语句
|
||
'no-const-assign': 2, // 禁止修改const声明的变量
|
||
'no-delete-var': 2, // 不能对var声明的变量使用delete操作符
|
||
'no-dupe-keys': 2, // 在创建对象字面量时不允许键重复
|
||
'no-duplicate-case': 2, // switch中的case标签不能重复
|
||
'no-dupe-args': 2, // 函数参数不能重复
|
||
'no-empty': 2, // 块语句中的内容不能为空
|
||
'no-func-assign': 2, // 禁止重复的函数声明
|
||
'no-invalid-this': 0, // 禁止无效的this,只能用在构造器,类,对象字面量
|
||
'no-redeclare': 2, // 禁止重复声明变量
|
||
'no-spaced-func': 2, // 函数调用时 函数名与()之间不能有空格
|
||
'no-this-before-super': 0, // 在调用super()之前不能使用this或super
|
||
'no-undef': 2, // 不能有未定义的变量
|
||
'no-use-before-define': 2, // 未定义前不能使用
|
||
camelcase: 'off', // 关闭强制驼峰法命名
|
||
'vue/multi-word-component-names': 0,
|
||
'jsx-quotes': [2, 'prefer-double'], // 强制在JSX属性(jsx-quotes)中一致使用双引号
|
||
// 'react/sort-comp': 2, // 强制组件方法顺序
|
||
'no-extra-boolean-cast': 0, // 禁止不必要的bool转换
|
||
// 'react/no-array-index-key': 0, // 防止在数组中遍历中使用数组key做索引
|
||
'no-unreachable': 1, // 不能有无法执行的代码
|
||
'no-mixed-spaces-and-tabs': 0, // 禁止混用tab和空格
|
||
'prefer-arrow-callback': 0, // 比较喜欢箭头回调
|
||
'arrow-parens': 2, // 箭头函数用小括号括起来
|
||
'arrow-spacing': 0, // = >的前/后括号
|
||
'prefer-const': 0,
|
||
|
||
'prefer-destructuring': [
|
||
'error',
|
||
{
|
||
VariableDeclarator: {
|
||
array: false,
|
||
object: true
|
||
},
|
||
AssignmentExpression: {
|
||
array: false,
|
||
object: false
|
||
}
|
||
},
|
||
{
|
||
enforceForRenamedProperties: false
|
||
}
|
||
],
|
||
'use-isnan': 2, // 禁止比较时使用NaN,只能用isNaN()
|
||
'vue/no-multiple-template-root': 0,
|
||
'space-before-function-paren': 0,
|
||
'vue/no-v-model-argument': 0,
|
||
'promise/param-names': 0,
|
||
'no-case-declarations': 0,
|
||
'vue/valid-v-for': 0,
|
||
'prefer-promise-reject-errors': 0,
|
||
'vue/no-v-for-template-key': 0
|
||
}
|
||
}
|