eslint.config.mjs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import globals from 'globals'
  2. import withNuxt from './.nuxt/eslint.config.mjs'
  3. // Polyfill for structuredClone if it doesn't exist
  4. if (typeof structuredClone !== 'function') {
  5. globalThis.structuredClone = function (obj) {
  6. return JSON.parse(JSON.stringify(obj))
  7. }
  8. }
  9. // Configuration de base personnalisée
  10. const customConfig = [
  11. {
  12. ignores: [
  13. '**/.nuxt',
  14. 'coverage/*',
  15. 'vendor/*',
  16. 'dist/*',
  17. 'models/models.ts',
  18. ],
  19. },
  20. {
  21. languageOptions: {
  22. globals: {
  23. ...globals.browser,
  24. ...globals.node,
  25. useRuntimeConfig: 'readonly',
  26. useAsyncData: 'readonly',
  27. navigateTo: 'readonly',
  28. computed: 'readonly',
  29. ref: 'readonly',
  30. definePageMeta: 'readonly',
  31. useRouter: 'readonly',
  32. useRoute: 'readonly',
  33. useI18n: 'readonly',
  34. onMounted: 'readonly',
  35. onUnmounted: 'readonly',
  36. watch: 'readonly',
  37. useRepo: 'readonly',
  38. },
  39. },
  40. rules: {
  41. 'no-console': 0,
  42. 'vue/valid-v-slot': [
  43. 'error',
  44. {
  45. allowModifiers: true,
  46. },
  47. ],
  48. 'vue/multi-word-component-names': 0,
  49. '@typescript-eslint/no-inferrable-types': 0,
  50. '@typescript-eslint/no-extraneous-class': 0,
  51. 'vue/html-self-closing': 0,
  52. },
  53. },
  54. // Directory-specific configurations
  55. {
  56. files: ['**/*.vue'],
  57. rules: {
  58. '@typescript-eslint/no-unused-vars': 0,
  59. },
  60. },
  61. {
  62. files: ['layouts/**/*.vue'],
  63. rules: {
  64. 'vue/multi-word-component-names': 0,
  65. },
  66. },
  67. {
  68. files: ['pages/**/*.vue'],
  69. rules: {
  70. 'vue/multi-word-component-names': 0,
  71. },
  72. },
  73. {
  74. files: ['tests/**/*'],
  75. rules: {
  76. '@typescript-eslint/ban-ts-comment': 0,
  77. '@typescript-eslint/no-unused-vars': 0,
  78. '@typescript-eslint/no-explicit-any': 0,
  79. 'require-await': 0,
  80. },
  81. },
  82. ]
  83. // Utiliser withNuxt avec l'option standalone: false pour éviter les conflits
  84. export default withNuxt(customConfig)