eslint.config.mjs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. },
  51. },
  52. // Directory-specific configurations
  53. {
  54. files: ['**/*.vue'],
  55. rules: {
  56. '@typescript-eslint/no-unused-vars': 0,
  57. },
  58. },
  59. {
  60. files: ['layouts/**/*.vue'],
  61. rules: {
  62. 'vue/multi-word-component-names': 0,
  63. },
  64. },
  65. {
  66. files: ['pages/**/*.vue'],
  67. rules: {
  68. 'vue/multi-word-component-names': 0,
  69. },
  70. },
  71. {
  72. files: ['tests/**/*'],
  73. rules: {
  74. '@typescript-eslint/ban-ts-comment': 0,
  75. '@typescript-eslint/no-unused-vars': 0,
  76. '@typescript-eslint/no-explicit-any': 0,
  77. 'require-await': 0,
  78. },
  79. }
  80. ]
  81. // Utiliser withNuxt avec l'option standalone: false pour éviter les conflits
  82. export default withNuxt(customConfig)