.eslintrc.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. module.exports = {
  2. root: true,
  3. env: {
  4. node: true
  5. },
  6. extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/typescript/recommended", "plugin:prettier/recommended"],
  7. parserOptions: {
  8. ecmaVersion: 2020
  9. },
  10. //配置
  11. rules: {
  12. "prettier/prettier": "error",
  13. "no-debugger": process.env.NODE_ENV == "production" ? 2 : 1,
  14. "no-unreachable": process.env.NODE_ENV == "production" ? 2 : 1, //return 警告不报错
  15. "no-undef": "off", // 没有声明的变量
  16. "vue/no-v-html": "off",
  17. "no-irregular-whitespace": "off",
  18. "vue/html-self-closing": [
  19. "error",
  20. {
  21. html: {
  22. void: "always",
  23. normal: "never",
  24. component: "always"
  25. },
  26. svg: "always",
  27. math: "always"
  28. }
  29. ],
  30. "vue/multi-word-component-names": "off", // 关闭驼峰命名
  31. /* ts相关 */
  32. "@typescript-eslint/no-empty-function": "off", // 可以为空函数
  33. "@typescript-eslint/explicit-module-boundary-types": "off", //函数不需要返回类型也可以
  34. "@typescript-eslint/no-explicit-any": "off", //可以为any
  35. "@typescript-eslint/no-non-null-assertion": "off", //! 非空断言
  36. "@typescript-eslint/no-this-alias": "off" //忽略this关键字
  37. }
  38. }