eslint.config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import js from "@eslint/js";
  2. import globals from "globals";
  3. import pluginVue from "eslint-plugin-vue";
  4. import pluginQuasar from "@quasar/app-vite/eslint";
  5. import vueI18n from "@intlify/eslint-plugin-vue-i18n";
  6. // the following is optional, if you want prettier too:
  7. import prettierSkipFormatting from "@vue/eslint-config-prettier/skip-formatting";
  8. export default [
  9. {
  10. /**
  11. * Ignore the following files.
  12. * Please note that pluginQuasar.configs.recommended() already ignores
  13. * the "node_modules" folder for you (and all other Quasar project
  14. * relevant folders and files).
  15. *
  16. * ESLint requires "ignores" key to be the only one in this object
  17. */
  18. ignores: [
  19. "/dist",
  20. "/src-capacitor",
  21. "/src-cordova",
  22. "/.quasar",
  23. "/node_modules",
  24. "/quasar.config.*.temporary.compiled*",
  25. ],
  26. },
  27. ...pluginQuasar.configs.recommended(),
  28. js.configs.recommended,
  29. /**
  30. * https://eslint.vuejs.org
  31. *
  32. * pluginVue.configs.base
  33. * -> Settings and rules to enable correct ESLint parsing.
  34. * pluginVue.configs[ 'flat/essential']
  35. * -> base, plus rules to prevent errors or unintended behavior.
  36. * pluginVue.configs["flat/strongly-recommended"]
  37. * -> Above, plus rules to considerably improve code readability and/or dev experience.
  38. * pluginVue.configs["flat/recommended"]
  39. * -> Above, plus rules to enforce subjective community defaults to ensure consistency.
  40. */
  41. ...pluginVue.configs["flat/essential"],
  42. ...pluginVue.configs["flat/strongly-recommended"],
  43. ...pluginVue.configs["flat/recommended"],
  44. ...vueI18n.configs.recommended,
  45. {
  46. languageOptions: {
  47. ecmaVersion: "latest",
  48. sourceType: "module",
  49. globals: {
  50. ...globals.browser,
  51. ...globals.node, // SSR, Electron, config files
  52. process: "readonly", // process.env.*
  53. ga: "readonly", // Google Analytics
  54. cordova: "readonly",
  55. Capacitor: "readonly",
  56. chrome: "readonly", // BEX related
  57. browser: "readonly", // BEX related
  58. },
  59. },
  60. // add your custom rules here
  61. rules: {
  62. "prefer-promise-reject-errors": "off",
  63. "vue/require-prop-types": "off",
  64. "vue/no-v-model-argument": "off",
  65. "vue/no-unused-vars": "warn",
  66. "vue/no-unused-components": "warn",
  67. "@intlify/vue-i18n/no-dynamic-keys": "off",
  68. "@intlify/vue-i18n/no-unused-keys": [
  69. "error",
  70. {
  71. extensions: [".js", ".vue"],
  72. },
  73. ],
  74. // allow debugger during development only
  75. "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
  76. },
  77. },
  78. {
  79. settings: {
  80. "vue-i18n": {
  81. localeDir: "./src/i18n/locales/*.{json,json5,yaml,yml}",
  82. messageSyntaxVersion: "^11.0.0",
  83. },
  84. },
  85. },
  86. {
  87. files: ["src-pwa/custom-service-worker.js"],
  88. languageOptions: {
  89. globals: {
  90. ...globals.serviceworker,
  91. },
  92. },
  93. },
  94. prettierSkipFormatting, // optional, if you want prettier
  95. ];