.eslintrc.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. "prettier/prettier": ["error", { endOfLine: "auto" }],
  14. "no-debugger": process.env.NODE_ENV == "production" ? 2 : 1,
  15. "no-unreachable": process.env.NODE_ENV == "production" ? 2 : 1, //return 警告不报错
  16. "no-undef": "off", // 没有声明的变量
  17. "vue/no-v-html": "off",
  18. "no-irregular-whitespace": "off",
  19. "vue/html-self-closing": [
  20. "error",
  21. {
  22. html: {
  23. void: "always",
  24. normal: "never",
  25. component: "always"
  26. },
  27. svg: "always",
  28. math: "always"
  29. }
  30. ],
  31. "vue/multi-word-component-names": "off", // 关闭驼峰命名
  32. /* ts相关 */
  33. "@typescript-eslint/no-empty-function": "off", // 可以为空函数
  34. "@typescript-eslint/explicit-module-boundary-types": "off", //函数不需要返回类型也可以
  35. "@typescript-eslint/no-explicit-any": "off", //可以为any
  36. "@typescript-eslint/no-non-null-assertion": "off", //! 非空断言
  37. "@typescript-eslint/no-this-alias": "off" //忽略this关键字
  38. }
  39. }