.eslintrc.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * @Author: PoJun
  3. * @Date: 2023-05-14 16:31:46
  4. * @LastEditors: PoJun
  5. * @LastEditTime: 2023-12-14 20:17:01
  6. * @Message: Nothing
  7. */
  8. module.exports = {
  9. root: true,
  10. env: {
  11. node: true,
  12. },
  13. extends: ["plugin:vue/essential", "eslint:recommended"],
  14. parserOptions: {
  15. parser: "babel-eslint",
  16. },
  17. rules: {
  18. "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
  19. "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
  20. "no-alert": 0, //禁止使用alert confirm prompt
  21. "no-empty": 2, //块语句中的内容不能为空
  22. "no-nested-ternary": 0, //禁止使用嵌套的三目运算
  23. "no-redeclare": 2, //禁止重复声明变量
  24. "no-spaced-func": 2, //函数调用时 函数名与()之间不能有空格
  25. "no-unreachable": 2, //不能有无法执行的代码
  26. "no-unused-vars": [2, { vars: "all", args: "after-used" }], //不能有声明后未被使用的变量或参数
  27. "no-var": 0, //禁用var,用let和const代替
  28. curly: [2, "all"], //必须使用 if(){} 中的{}
  29. semi: [2, "always"], //语句强制分号结尾
  30. },
  31. globals: {
  32. uni: null,
  33. wx: null,
  34. getCurrentPages: null,
  35. plus: null,
  36. },
  37. };