eslint.config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. "vue/no-unused-vars": "warn",
  63. "vue/no-unused-components": "warn",
  64. "@intlify/vue-i18n/no-dynamic-keys": "off",
  65. "@intlify/vue-i18n/no-raw-text": "off",
  66. "@intlify/vue-i18n/no-unused-keys": [
  67. "error",
  68. {
  69. extensions: [".js", ".vue"],
  70. },
  71. ],
  72. // allow debugger during development only
  73. "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
  74. },
  75. },
  76. {
  77. settings: {
  78. "vue-i18n": {
  79. localeDir: "./src/i18n/locales/*.{json,json5,yaml,yml}",
  80. messageSyntaxVersion: "^11.0.0",
  81. },
  82. },
  83. },
  84. {
  85. files: ["src-pwa/custom-service-worker.js"],
  86. languageOptions: {
  87. globals: {
  88. ...globals.serviceworker,
  89. },
  90. },
  91. },
  92. prettierSkipFormatting, // optional, if you want prettier
  93. ];