Files
mengxiang-vpp-portal-web/.eslintrc.cjs
T
zhangzhenbing 9ddecbdb9a feat: 完成梦象虚拟电厂集中门户基础框架搭建
新增登录页、布局、路由、Pinia状态管理、Mock数据等核心模块,配置环境变量、Vite、ESLint、Prettier、CommitLint等开发工具,添加品牌资源与全局样式。
2026-11-12 17:00:48 +08:00

65 lines
1.8 KiB
JavaScript

/* 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",
},
};