module.exports = { root: true, env: { browser: true, node: true, es6: true }, globals: { uni: 'writable', getApp: 'writable', wx: 'writable' }, // 指定如何解析语法 parser: 'vue-eslint-parser', // 优先级低于 parse 的语法解析配置 parserOptions: { ecmaVersion: 'latest', sourceType: 'module', ecmaFeatures: { jsx: false } }, // 继承某些已有的规则 extends: [ 'plugin:vue/vue3-recommended', // 使用插件支持vue3 'airbnb-base', 'plugin:prettier/recommended', './.eslintrc-auto-import.json' ], /** * "off" 或 0 ==> 关闭规则 * "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行) * "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错) */ rules: { // eslint (http://eslint.cn/docs/rules) 'prettier/prettier': 'error', 'import/extensions': 0, 'prefer-template': 0, 'no-var': 'error', // 要求使用 let 或 const 而不是 var 'no-multiple-empty-lines': ['error', { max: 1 }], // 不允许多个空行 'prefer-const': 'off', // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const 'no-use-before-define': 'off', // 禁止在 函数/类/变量 定义之前使用它们 'no-irregular-whitespace': 'off', // 禁止不规则的空白\ 'import/no-cycle': 0, 'no-nested-ternary': 0, 'import/prefer-default-export': 0, 'import/no-unresolved': 0, 'prefer-destructuring': 0, 'no-shadow': 0, 'no-param-reassign': 0, 'consistent-return': 0, 'no-case-declarations': 0, 'prefer-promise-reject-errors': 0, 'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/no-static-element-interactions': 0, camelcase: 0, 'import/no-extraneous-dependencies': 0, 'no-underscore-dangle': 0, 'no-debugger': 0, 'no-promise-executor-return': 0, // vue (https://eslint.vuejs.org/rules) 'vue/script-setup-uses-vars': 'error', // 防止