|
@@ -1,108 +1,17 @@
|
|
|
-// Polyfill for structuredClone if it doesn't exist
|
|
|
|
|
-if (typeof structuredClone !== 'function') {
|
|
|
|
|
- globalThis.structuredClone = function(obj) {
|
|
|
|
|
- return JSON.parse(JSON.stringify(obj));
|
|
|
|
|
- };
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// eslint.config.mjs
|
|
|
|
|
+import withNuxt from './.nuxt/eslint.config.mjs'
|
|
|
|
|
|
|
|
-import path from 'node:path'
|
|
|
|
|
-import { fileURLToPath } from 'node:url'
|
|
|
|
|
-import vue from 'eslint-plugin-vue'
|
|
|
|
|
-import typescriptEslint from '@typescript-eslint/eslint-plugin'
|
|
|
|
|
-import globals from 'globals'
|
|
|
|
|
-import parser from 'vue-eslint-parser'
|
|
|
|
|
-import js from '@eslint/js'
|
|
|
|
|
-import { FlatCompat } from '@eslint/eslintrc'
|
|
|
|
|
-import { defineConfig } from "eslint/config"
|
|
|
|
|
-
|
|
|
|
|
-const __filename = fileURLToPath(import.meta.url)
|
|
|
|
|
-const __dirname = path.dirname(__filename)
|
|
|
|
|
-const compat = new FlatCompat({
|
|
|
|
|
- baseDirectory: __dirname,
|
|
|
|
|
- recommendedConfig: js.configs.recommended,
|
|
|
|
|
- allConfig: js.configs.all,
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
-const baseConfig = [
|
|
|
|
|
- {
|
|
|
|
|
- ignores: [
|
|
|
|
|
- '**/.nuxt',
|
|
|
|
|
- 'coverage/*',
|
|
|
|
|
- 'vendor/*',
|
|
|
|
|
- 'dist/*',
|
|
|
|
|
- 'models/models.ts',
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- ...compat.extends(
|
|
|
|
|
- '@nuxtjs/eslint-config-typescript',
|
|
|
|
|
- 'plugin:nuxt/recommended',
|
|
|
|
|
- 'eslint:recommended',
|
|
|
|
|
- 'plugin:@typescript-eslint/recommended',
|
|
|
|
|
- 'plugin:vue/vue3-recommended',
|
|
|
|
|
- 'plugin:prettier/recommended',
|
|
|
|
|
- 'plugin:you-dont-need-lodash-underscore/compatible',
|
|
|
|
|
- ),
|
|
|
|
|
- {
|
|
|
|
|
- plugins: {
|
|
|
|
|
- vue,
|
|
|
|
|
- '@typescript-eslint': typescriptEslint,
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- languageOptions: {
|
|
|
|
|
- globals: {
|
|
|
|
|
- ...globals.browser,
|
|
|
|
|
- ...globals.node,
|
|
|
|
|
- useRuntimeConfig: 'readonly',
|
|
|
|
|
- useAsyncData: 'readonly',
|
|
|
|
|
- navigateTo: 'readonly',
|
|
|
|
|
- computed: 'readonly',
|
|
|
|
|
- ref: 'readonly',
|
|
|
|
|
- definePageMeta: 'readonly',
|
|
|
|
|
- useRouter: 'readonly',
|
|
|
|
|
- useRoute: 'readonly',
|
|
|
|
|
- useI18n: 'readonly',
|
|
|
|
|
- onMounted: 'readonly',
|
|
|
|
|
- onUnmounted: 'readonly',
|
|
|
|
|
- watch: 'readonly',
|
|
|
|
|
- useRepo: 'readonly',
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- parser,
|
|
|
|
|
- ecmaVersion: 2020,
|
|
|
|
|
- sourceType: 'module',
|
|
|
|
|
-
|
|
|
|
|
- parserOptions: {
|
|
|
|
|
- parser: '@typescript-eslint/parser',
|
|
|
|
|
- tsconfigRootDir: __dirname,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- rules: {
|
|
|
|
|
- 'no-console': 0,
|
|
|
|
|
-
|
|
|
|
|
- 'vue/valid-v-slot': [
|
|
|
|
|
- 'error',
|
|
|
|
|
- {
|
|
|
|
|
- allowModifiers: true,
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
- 'vue/multi-word-component-names': 0,
|
|
|
|
|
- '@typescript-eslint/no-inferrable-types': 0,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
-]
|
|
|
|
|
-
|
|
|
|
|
-// Directory-specific configurations
|
|
|
|
|
-baseConfig.push(
|
|
|
|
|
|
|
+// Configuration spécifique au projet qui sera fusionnée avec la configuration Nuxt
|
|
|
|
|
+const customConfig = [
|
|
|
|
|
+ // Configurations spécifiques par répertoire
|
|
|
{
|
|
{
|
|
|
- files: ['layouts/**/*.vue'],
|
|
|
|
|
|
|
+ files: ['**/*.vue'],
|
|
|
rules: {
|
|
rules: {
|
|
|
- 'vue/multi-word-component-names': 0,
|
|
|
|
|
|
|
+ '@typescript-eslint/no-unused-vars': 0,
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- files: ['pages/**/*.vue'],
|
|
|
|
|
|
|
+ files: ['layouts/**/*.vue', 'pages/**/*.vue'],
|
|
|
rules: {
|
|
rules: {
|
|
|
'vue/multi-word-component-names': 0,
|
|
'vue/multi-word-component-names': 0,
|
|
|
},
|
|
},
|
|
@@ -116,6 +25,7 @@ baseConfig.push(
|
|
|
'require-await': 0,
|
|
'require-await': 0,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
-)
|
|
|
|
|
|
|
+]
|
|
|
|
|
|
|
|
-export default defineConfig(baseConfig)
|
|
|
|
|
|
|
+// Exporte la configuration en utilisant le helper de Nuxt
|
|
|
|
|
+export default withNuxt(customConfig)
|