.eslintrc.cjs 1.3 KB

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