eslint.config.mjs 2.0 KB

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