eslint.config.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
  6. import prettierSkipFormatting from '@vue/eslint-config-prettier/skip-formatting'
  7. export default defineConfigWithVueTs(
  8. {
  9. /**
  10. * Ignore the following files.
  11. * Please note that pluginQuasar.configs.recommended() already ignores
  12. * the "node_modules" folder for you (and all other Quasar project
  13. * relevant folders and files).
  14. *
  15. * ESLint requires "ignores" key to be the only one in this object
  16. */
  17. // ignores: []
  18. },
  19. pluginQuasar.configs.recommended(),
  20. js.configs.recommended,
  21. /**
  22. * https://eslint.vuejs.org
  23. *
  24. * pluginVue.configs.base
  25. * -> Settings and rules to enable correct ESLint parsing.
  26. * pluginVue.configs[ 'flat/essential']
  27. * -> base, plus rules to prevent errors or unintended behavior.
  28. * pluginVue.configs["flat/strongly-recommended"]
  29. * -> Above, plus rules to considerably improve code readability and/or dev experience.
  30. * pluginVue.configs["flat/recommended"]
  31. * -> Above, plus rules to enforce subjective community defaults to ensure consistency.
  32. */
  33. pluginVue.configs[ 'flat/essential' ],
  34. {
  35. files: ['**/*.ts', '**/*.vue'],
  36. rules: {
  37. '@typescript-eslint/consistent-type-imports': [
  38. 'error',
  39. { prefer: 'type-imports' }
  40. ],
  41. }
  42. },
  43. // https://github.com/vuejs/eslint-config-typescript
  44. vueTsConfigs.recommendedTypeChecked,
  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. // allow debugger during development only
  64. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  65. }
  66. },
  67. {
  68. files: [ 'src-pwa/custom-service-worker.ts' ],
  69. languageOptions: {
  70. globals: {
  71. ...globals.serviceworker
  72. }
  73. }
  74. },
  75. prettierSkipFormatting
  76. )