.eslintrc.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* eslint-env node */
  2. require("@rushstack/eslint-patch/modern-module-resolution")
  3. module.exports = {
  4. root: true,
  5. env: {
  6. browser: true,
  7. node: true,
  8. },
  9. parserOptions: {
  10. sourceType: "module",
  11. requireConfigFile: false,
  12. ecmaFeatures: {
  13. jsx: false,
  14. },
  15. },
  16. extends: [
  17. "@vue/typescript/recommended",
  18. "plugin:vue/vue3-recommended",
  19. "plugin:prettier/recommended",
  20. ],
  21. ignorePatterns: [
  22. "static/**/*",
  23. "./helpers/backend/graphql.ts",
  24. "**/*.d.ts",
  25. "types/**/*",
  26. ],
  27. plugins: ["vue", "prettier"],
  28. // add your custom rules here
  29. rules: {
  30. semi: [2, "never"],
  31. "import/named": "off", // because, named import issue with typescript see: https://github.com/typescript-eslint/typescript-eslint/issues/154
  32. "no-console": "off",
  33. "no-debugger": process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  34. "prettier/prettier": [
  35. process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  36. {},
  37. {
  38. semi: false,
  39. trailingComma: "es5",
  40. singleQuote: false,
  41. printWidth: 80,
  42. useTabs: false,
  43. tabWidth: 2,
  44. },
  45. ],
  46. "vue/multi-word-component-names": "off",
  47. "vue/no-side-effects-in-computed-properties": "off",
  48. "import/no-named-as-default": "off",
  49. "import/no-named-as-default-member": "off",
  50. "@typescript-eslint/no-unused-vars":
  51. process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  52. "@typescript-eslint/no-non-null-assertion": "off",
  53. "@typescript-eslint/no-explicit-any": "off",
  54. "import/default": "off",
  55. "no-undef": "off",
  56. // localStorage block
  57. "no-restricted-globals": [
  58. "error",
  59. {
  60. name: "localStorage",
  61. message:
  62. "Do not use 'localStorage' directly. Please use the PersistenceService",
  63. },
  64. ],
  65. // window.localStorage block
  66. "no-restricted-syntax": [
  67. "error",
  68. {
  69. selector: "CallExpression[callee.object.property.name='localStorage']",
  70. message:
  71. "Do not use 'localStorage' directly. Please use the PersistenceService",
  72. },
  73. ],
  74. eqeqeq: 1,
  75. "no-else-return": 1,
  76. },
  77. }