.eslintrc.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * @Author: PoJun
  3. * @Date: 2023-05-14 16:31:46
  4. * @LastEditors: PoJun
  5. * @LastEditTime: 2023-05-14 16:32:06
  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. //"off"或者0 关闭规则关闭
  18. //"warn"或者1 在打开的规则作为警告(不影响退出代码)
  19. //"error"或者2 把规则作为一个错误(退出代码触发时为1
  20. rules: {
  21. "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
  22. "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
  23. "no-alert": 0, //禁止使用alert confirm prompt
  24. "no-empty": 2, //块语句中的内容不能为空
  25. "no-nested-ternary": 0, //禁止使用嵌套的三目运算
  26. "no-redeclare": 2, //禁止重复声明变量
  27. "no-spaced-func": 2, //函数调用时 函数名与()之间不能有空格
  28. "no-unreachable": 2, //不能有无法执行的代码
  29. "no-unused-vars": [2, { vars: "all", args: "after-used" }], //不能有声明后未被使用的变量或参数
  30. "no-var": 0, //禁用var,用let和const代替
  31. curly: [2, "all"], //必须使用 if(){} 中的{}
  32. semi: [2, "always"], //语句强制分号结尾
  33. },
  34. globals: {
  35. uni: null,
  36. wx: null,
  37. },
  38. };