/* eslint-env node */ module.exports = { root: true, env: { browser: true, es2021: true, node: true, }, extends: ["eslint:recommended", "plugin:vue/vue3-recommended", "@vue/eslint-config-prettier"], parserOptions: { ecmaVersion: "latest", sourceType: "module", }, ignorePatterns: ["dist/", "node_modules/"], rules: { // ===== 错误预防(主流团队级标配防错规则) ===== eqeqeq: ["error", "always", { null: "ignore" }], "no-var": "error", "prefer-const": "error", "no-shadow": ["error", { hoist: "never" }], "no-throw-literal": "error", "no-unused-expressions": ["error", { allowShortCircuit: true, allowTernary: true }], "no-param-reassign": [ "error", { props: true, ignorePropertyModificationsFor: [ "config", "state", "acc", "e", "ctx", "req", "res", "options", "opts", "draft", "el", "vm", ], }, ], "require-await": "error", "no-return-await": "error", "no-template-curly-in-string": "warn", "default-case": "error", "no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }], "no-console": "warn", "no-debugger": "warn", // ===== 复杂度治理(中大型团队协作约束) ===== complexity: ["warn", 15], "max-depth": ["warn", 4], "max-params": ["warn", 4], "max-lines-per-function": ["warn", { max: 200, skipBlankLines: true, skipComments: true }], // ===== 代码风格(统一交给 Prettier,冲突规则已关闭) ===== "prettier/prettier": "error", // ===== Vue 专项 ===== "vue/multi-word-component-names": "off", "vue/no-v-html": "warn", }, };