eslint.config.mjs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import vue from 'eslint-plugin-vue'
  2. import typescriptEslint from '@typescript-eslint/eslint-plugin'
  3. import globals from 'globals'
  4. import parser from 'vue-eslint-parser'
  5. import path from 'node:path'
  6. import { fileURLToPath } from 'node:url'
  7. import js from '@eslint/js'
  8. import { FlatCompat } from '@eslint/eslintrc'
  9. const __filename = fileURLToPath(import.meta.url)
  10. const __dirname = path.dirname(__filename)
  11. const compat = new FlatCompat({
  12. baseDirectory: __dirname,
  13. recommendedConfig: js.configs.recommended,
  14. allConfig: js.configs.all,
  15. })
  16. export default [
  17. {
  18. ignores: [
  19. '**/.nuxt',
  20. 'coverage/*',
  21. 'vendor/*',
  22. 'dist/*',
  23. 'models/models.ts',
  24. ],
  25. },
  26. ...compat.extends(
  27. '@nuxtjs/eslint-config-typescript',
  28. 'plugin:nuxt/recommended',
  29. 'eslint:recommended',
  30. 'plugin:@typescript-eslint/recommended',
  31. 'plugin:vue/vue3-recommended',
  32. 'plugin:prettier/recommended',
  33. 'plugin:you-dont-need-lodash-underscore/compatible',
  34. ),
  35. {
  36. plugins: {
  37. vue,
  38. '@typescript-eslint': typescriptEslint,
  39. },
  40. languageOptions: {
  41. globals: {
  42. ...globals.browser,
  43. ...globals.node,
  44. useRuntimeConfig: 'readonly',
  45. useAsyncData: 'readonly',
  46. navigateTo: 'readonly',
  47. computed: 'readonly',
  48. ref: 'readonly',
  49. definePageMeta: 'readonly',
  50. useRouter: 'readonly',
  51. useRoute: 'readonly',
  52. useI18n: 'readonly',
  53. onMounted: 'readonly',
  54. onUnmounted: 'readonly',
  55. watch: 'readonly',
  56. useRepo: 'readonly',
  57. },
  58. parser: parser,
  59. ecmaVersion: 2020,
  60. sourceType: 'module',
  61. parserOptions: {
  62. parser: '@typescript-eslint/parser',
  63. tsconfigRootDir: '/home/workspace',
  64. },
  65. },
  66. rules: {
  67. 'no-console': 0,
  68. 'vue/valid-v-slot': [
  69. 'error',
  70. {
  71. allowModifiers: true,
  72. },
  73. ],
  74. 'vue/multi-word-component-names': 0,
  75. '@typescript-eslint/no-inferrable-types': 0,
  76. },
  77. },
  78. ]