.eslintrc.cjs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. jest: true,
  9. },
  10. parserOptions: {
  11. sourceType: "module",
  12. requireConfigFile: false,
  13. },
  14. extends: [
  15. "@vue/typescript/recommended",
  16. "plugin:vue/vue3-recommended",
  17. "plugin:prettier/recommended",
  18. ],
  19. ignorePatterns: [
  20. "static/**/*",
  21. "./helpers/backend/graphql.ts",
  22. "**/*.d.ts",
  23. "types/**/*",
  24. ],
  25. plugins: ["vue", "prettier"],
  26. // add your custom rules here
  27. rules: {
  28. semi: [2, "never"],
  29. "import/named": "off", // because, named import issue with typescript see: https://github.com/typescript-eslint/typescript-eslint/issues/154
  30. "no-console": "off",
  31. "no-debugger": process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  32. "prettier/prettier":
  33. process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  34. "vue/multi-word-component-names": "off",
  35. "vue/no-side-effects-in-computed-properties": "off",
  36. "import/no-named-as-default": "off",
  37. "import/no-named-as-default-member": "off",
  38. "@typescript-eslint/no-unused-vars":
  39. process.env.HOPP_LINT_FOR_PROD === "true" ? "error" : "warn",
  40. "@typescript-eslint/no-non-null-assertion": "off",
  41. "@typescript-eslint/no-explicit-any": "off",
  42. "import/default": "off",
  43. "no-undef": "off",
  44. // localStorage block
  45. "no-restricted-globals": [
  46. "error",
  47. {
  48. name: "localStorage",
  49. message:
  50. "Do not use 'localStorage' directly. Please use localpersistence.ts functions or stores",
  51. },
  52. ],
  53. // window.localStorage block
  54. "no-restricted-syntax": [
  55. "error",
  56. {
  57. selector: "CallExpression[callee.object.property.name='localStorage']",
  58. message:
  59. "Do not use 'localStorage' directly. Please use localpersistence.ts functions or stores",
  60. },
  61. ],
  62. },
  63. }