// @see https://eslint.bootcss.com/docs/rules/ module.exports = { env: { browser: true, es2021: true, node: true }, globals: { uni: true, wx: true, getCurrentPages: true }, /* 指定如何解析语法 */ parser: 'vue-eslint-parser', /** 优先级低于 parse 的语法解析配置 */ parserOptions: { ecmaVersion: 'latest', sourceType: 'module', parser: '@typescript-eslint/parser', jsxPragma: 'React', ecmaFeatures: { jsx: true } }, /* 继承已有的规则 */ extends: ['eslint:recommended', 'plugin:vue/vue3-essential', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], plugins: ['vue', '@typescript-eslint'], overrides: [ { files: ['*.ts', '*.tsx', '*.vue'], rules: { 'no-undef': 0 } } ], /* * 'off' 或 0 ==> 关闭规则 * 'warn' 或 1 ==> 打开的规则作为警告(不影响代码执行) * 'error' 或 2 ==> 规则作为一个错误(代码不能执行,界面报错) */ rules: { // typeScript (https://typescript-eslint.io/rules) '@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_' }], // 禁止定义未使用的变量 '@typescript-eslint/prefer-ts-expect-error': 2, // 禁止使用 @ts-ignore '@typescript-eslint/no-explicit-any': 0, // 禁止使用 any 类型 '@typescript-eslint/no-non-null-assertion': 0, '@typescript-eslint/no-namespace': 0, // 禁止使用自定义 TypeScript 模块和命名空间。 '@typescript-eslint/semi': 0, 'no-prototype-builtins': 0, // 可以使用obj.hasOwnProperty() '@typescript-eslint/no-var-requires': 0, // 不允许在import 中使用require '@typescript-eslint/no-empty-function': 2, // 关闭空方法检查 // eslint-plugin-vue (https://eslint.vuejs.org/rules/) 'vue/multi-word-component-names': 0, // 要求组件名称始终为 “-” 链接的单词 'vue/script-setup-uses-vars': 2, // 防止