module.exports = { env: { browser: true, es2021: true, node: true }, extends: [ "eslint:recommended", "standard-with-typescript", "plugin:vue/vue3-essential", "plugin:prettier/recommended", ], overrides: [ { env: { node: true }, files: [".eslintrc.{js,cjs}"], parserOptions: { sourceType: "script" } } ], parser: "vue-eslint-parser", parserOptions: { parser: "@typescript-eslint/parser", tsconfigRootDir: __dirname, project: ["tsconfig.json"], extraFileExtensions: [".vue"], ecmaVersion: "latest", sourceType: "module" }, plugins: ["vue"], rules: { // eslint indent: [ "error", "tab", // 缩进2个字符 { ignoredNodes: ["ConditionalExpression"], // 忽略三元表达式 SwitchCase: 1, VariableDeclarator: "first", outerIIFEBody: "off", MemberExpression: 1, FunctionDeclaration: { parameters: "first" }, FunctionExpression: { parameters: "first" }, CallExpression: { arguments: "first" }, ArrayExpression: "first", ObjectExpression: "first", ImportDeclaration: "first", offsetTernaryExpressions: true } ], quotes: "off", eqeqeq: "off", "comma-dangle": "off", "no-tabs": ["off", { allowIndentationTabs: true }], // 允许tabs缩进 "no-var": "error", // 要求使用 let 或 const 而不是 var "no-unused-vars": "off", // 禁止未使用过的变量 "no-multiple-empty-lines": ["warn", { max: 1 }], // 不允许多个空行 "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", "no-unexpected-multiline": "error", // 禁止空余的多行 "no-useless-escape": "off", // 禁止不必要的转义字符 "spaced-comment": ["off", "always"], // typeScript (https://typescript-eslint.io/rules) "@typescript-eslint/quotes": ["off", "double"], // 使用双引号 "@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量 "@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore "@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型 "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间。 "@typescript-eslint/semi": "off", "@typescript-eslint/triple-slash-reference": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/strict-boolean-expressions": "off", "@typescript-eslint/no-dynamic-delete": "off", "@typescript-eslint/naming-convention": "off", "@typescript-eslint/consistent-type-assertions": "off", "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/restrict-plus-operands": "off", "@typescript-eslint/promise-function-async": "off", "@typescript-eslint/no-floating-promises": ["off", { ignoreVoid: true, ignoreIIFE: true }], "@typescript-eslint/no-this-alias": [ "error", { allowDestructuring: false, // Disallow `const { props, state } = this`; true by default allowedNames: ["that"] // Allow `const self = this`; `[]` by default } ], // eslint-plugin-vue (https://eslint.vuejs.org/rules/) "vue/multi-word-component-names": "off", // 要求组件名称始终为 “-” 链接的单词 "vue/script-setup-uses-vars": "error", // 防止