.eslintrc.js 2.1 KB

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