module.exports = { root: true, env: { es2021: true, node: true, es6: true, }, globals: { process: true, require: true, module: true, AMap: true, qq: true, uni: true, uniApp: true }, extends: ['plugin:vue/strongly-recommended', 'eslint:recommended'], parserOptions: { 'ecmaVersion': 2021, 'sourceType': 'module', }, rules: { // "off"或者0 //关闭规则关闭 // "warn"或者1 //在打开的规则作为警告(不影响退出代码) // "error"或者2 //把规则作为一个错误(退出代码触发时为1) 'vue/multi-word-component-names': 0, 'no-console': 0, //禁止使用console 'no-mixed-spaces-and-tabs': 0, 'vue/attribute-hyphenation': 0, 'no-catch-shadow': 2, //禁止catch子句参数与外部作用域变量同名 'no-const-assign': 2, //禁止修改const声明的变量 'no-constant-condition': 2, //禁止在条件中使用常量表达式 if(true) if(1) 'no-debugger': 0, //禁止使用debugger 'no-delete-var': 2, //不能对var声明的变量使用delete操作符 'no-dupe-keys': 2, //在创建对象字面量时不允许键重复 {a:1,a:1} 'no-dupe-args': 2, //函数参数不能重复 'no-duplicate-case': 2, //switch中的case标签不能重复 'no-else-return': 0, //如果if语句里面有return,后面不能跟else语句 'no-empty': 2, //块语句中的内容不能为空 'no-empty-character-class': 2, //正则表达式中的[]内容不能为空 'no-empty-label': 0, //禁止使用空label 'no-eq-null': 2, //禁止对null使用==或!=运算符 'no-extra-boolean-cast': 2, //禁止不必要的bool转换 'no-extra-parens': 2, //禁止非必要的括号 'no-func-assign': 2, //禁止重复的函数声明 'no-implicit-coercion': 2, //禁止隐式转换 'no-inline-comments': 0, //禁止行内备注 'no-irregular-whitespace': 2, //不能有不规则的空格 'no-lone-blocks': 2, //禁止不必要的嵌套块 'no-loop-func': 1, //禁止在循环中使用函数(如果没有引用外部变量不形成闭包就可以) 'linebreak-style': [0, 'windows'], //换行风格 'no-multi-spaces': 1, //不能用多余的空格 'no-multiple-empty-lines': [1, { max: 2 }], //空行最多不能超过2行 'no-negated-in-lhs': 2, //in 操作符的左边不能有! 'no-nested-ternary': 0, //禁止使用嵌套的三目运算 'no-new': 1, //禁止在使用new构造一个实例后不赋值 'no-new-func': 1, //禁止使用new Function 'no-new-object': 2, //禁止使用new Object() 'no-new-require': 2, //禁止使用new require 'no-new-wrappers': 2, //禁止使用new创建包装实例,new String new Boolean new Number 'no-obj-calls': 2, //不能调用内置的全局对象,比如Math() JSON() 'no-octal': 2, //禁止使用八进制数字 'no-octal-escape': 2, //禁止使用八进制转义序列 'no-param-reassign': 0, //禁止给参数重新赋值 'no-plusplus': 0, //禁止使用++,-- 'no-process-env': 0, //禁止使用process.env 'no-process-exit': 0, //禁止使用process.exit() 'no-proto': 2, //禁止使用__proto__属性 'no-redeclare': 2, //禁止重复声明变量 'no-return-assign': 1, //return 语句中不能有赋值表达式 'no-script-url': 0, //禁止使用javascript:void(0) 'no-self-compare': 2, //不能比较自身 'no-sequences': 0, //禁止使用逗号运算符 'no-shadow': 0, //外部作用域中的变量不能与它所包含的作用域中的变量或参数同名 'no-ternary': 0, //禁止使用三目运算符 'no-trailing-spaces': 1, //一行结束后面不要有空格 // 允许js中使用未命明的对象 'no-undef': 0, //不能有未定义的变量 'no-undef-init': 2, //变量初始化时不能直接给它赋值为undefined 'no-undefined': 0, //不能使用undefined 'camelcase': 2, //强制驼峰法命名 'quotes': [1, 'single'], //引号类型 `` "" ' // vue html的属性单行最多属性 'vue/max-attributes-per-line': ['error', { 'singleline': { 'max': 5 // 最大 }, 'multiline': { 'max': 1 // 最小 } }], 'vue/no-v-model-argument': 0, 'vue/singleline-html-element-content-newline': 0, // 强制html标签闭合 'vue/html-self-closing': 0, // eslint提示:不允许向模板添加多个根节点 'vue/no-multiple-template-root': 0, 'no-unused-vars': 0, }, };