Bruno Predot

Modification de la config de eslint avec la suppression de tout ce qui concerne …

…prettier, suppression du module @nuxt/eslint, contenant le module eslint/recommanded, et remplacemant par le module @antfu/eslint-config, plus complet et simple .
1 module.exports = { 1 module.exports = {
2 // https://dev.to/tao/adding-eslint-and-prettier-to-nuxt-3-2023-5bg 2 // https://dev.to/tao/adding-eslint-and-prettier-to-nuxt-3-2023-5bg
3 root: true, 3 root: true,
4 - extends: ["@nuxtjs/eslint-config", "plugin:prettier/recommended"], 4 + extends: ["@nuxtjs/eslint-config"],
5 env: { 5 env: {
6 browser: true, 6 browser: true,
7 node: true, 7 node: true,
1 -node_modules  
2 -  
3 -logs  
4 -*.log*  
5 -  
6 -.output  
7 -.nuxt  
8 -.nitro  
9 -.cache  
10 -dist  
11 -  
12 -.gitignore  
13 -  
14 -.env  
15 -.env.*  
16 -!.env.example  
17 -  
18 -CHANGELOG.md  
19 -CHANGELOG_RELEASE.md  
20 -  
21 -.idea  
1 -{  
2 - "semi": true,  
3 - "trailingComma": "all",  
4 - "singleQuote": false,  
5 - "printWidth": 120,  
6 - "arrowParens": "always",  
7 - "useTabs": false,  
8 - "tabWidth": 2  
9 -}  
1 -// @ts-check 1 +import antfu from "@antfu/eslint-config";
2 -import withNuxt from "./.nuxt/eslint.config.mjs";  
3 -import js from "@eslint/js";  
4 -import eslintPluginVue from "eslint-plugin-vue";  
5 -import ts from "typescript-eslint";  
6 2
7 -const TsConfigRecommended = ts.configs.recommended; 3 +export default antfu({
  4 +// Type of the project. 'lib' for libraries, the default is 'app'
  5 + type: "app",
8 6
9 -export default withNuxt( 7 + // Enable stylistic formatting rules
10 - // Your custom configs here 8 + // stylistic: true,
11 - js.configs.recommended, 9 +
12 - // eslint-disable-next-line @typescript-eslint/ban-ts-comment 10 + // Or customize the stylistic rules
13 - // @ts-expect-error 11 + stylistic: {
14 - ...TsConfigRecommended, 12 + indent: 2, // 4, or 'tab'
15 - ...eslintPluginVue.configs["flat/recommended"], 13 + semi: true,
16 - { 14 + stylistic: true,
17 - files: ["*.vue", "**/*.vue"], 15 + quotes: "double", // 'single' or 'double'
18 - languageOptions: {  
19 - parserOptions: {  
20 - parser: "@typescript-eslint/parser",  
21 - },  
22 - },  
23 - rules: {  
24 - "vue/multi-word-component-names": "off",  
25 - },  
26 }, 16 },
27 - // your custom flat configs go here, for example: 17 +
28 - // { 18 + // TypeScript and Vue are autodetected, you can also explicitly enable them:
29 - // files: ['**/*.ts', '**/*.tsx'], 19 + typescript: true,
30 - // rules: { 20 + vue: true,
31 - // 'no-console': 'off' // allow console.log in TypeScript files 21 +
32 - // } 22 + // Disable jsonc and yaml support
33 - // }, 23 + jsonc: false,
34 - // { 24 + markdown: false,
35 - // ... 25 + yaml: false,
36 - // } 26 +
37 -); 27 + // `.eslintignore` is no longer supported in Flat config, use `ignores` instead
  28 + ignores: [
  29 + "**/fixtures",
  30 + "**/.cache",
  31 + "**/.data",
  32 + "**/.gitignore",
  33 + "**/.env",
  34 + "**/.env.dist",
  35 + "**/.output",
  36 + "**/.nitro",
  37 + "**/.nuxt",
  38 + "**/assets",
  39 + "**/dist",
  40 + "**/logs",
  41 + "**/node_modules",
  42 + "**/public",
  43 + "**/server",
  44 + ],
  45 +});
  46 +
  47 +// Ancienne config eslint.
  48 +// import withNuxt from "./.nuxt/eslint.config.mjs";
  49 +// import js from "@eslint/js";
  50 +// import eslintPluginVue from "eslint-plugin-vue";
  51 +// import ts from "typescript-eslint";
  52 +//
  53 +// const TsConfigRecommended = ts.configs.recommended;
  54 +//
  55 +// export default withNuxt(
  56 +// // Your custom configs here
  57 +// js.configs.recommended,
  58 +// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  59 +// // @ts-expect-error
  60 +// ...TsConfigRecommended,
  61 +// ...eslintPluginVue.configs["flat/recommended"],
  62 +// {
  63 +// files: ["*.vue", "**/*.vue"],
  64 +// languageOptions: {
  65 +// parserOptions: {
  66 +// parser: "@typescript-eslint/parser",
  67 +// },
  68 +// },
  69 +// rules: {
  70 +// "vue/multi-word-component-names": "off",
  71 +// },
  72 +// },
  73 +// // your custom flat configs go here, for example:
  74 +// // {
  75 +// // files: ['**/*.ts', '**/*.tsx'],
  76 +// // rules: {
  77 +// // 'no-console': 'off' // allow console.log in TypeScript files
  78 +// // }
  79 +// // },
  80 +// // {
  81 +// // ...
  82 +// // }
  83 +// );
  1 +import process from "node:process";
  2 +
1 // https://nuxt.com/docs/api/configuration/nuxt-config 3 // https://nuxt.com/docs/api/configuration/nuxt-config
2 export default defineNuxtConfig({ 4 export default defineNuxtConfig({
3 compatibilityDate: "2024-11-01", 5 compatibilityDate: "2024-11-01",
@@ -28,7 +30,6 @@ export default defineNuxtConfig({ @@ -28,7 +30,6 @@ export default defineNuxtConfig({
28 }, 30 },
29 31
30 modules: [ 32 modules: [
31 - "@nuxt/eslint",  
32 "@nuxt/icon", 33 "@nuxt/icon",
33 "@nuxt/image", 34 "@nuxt/image",
34 "@nuxt/test-utils/module", 35 "@nuxt/test-utils/module",
This diff could not be displayed because it is too large.
@@ -10,14 +10,11 @@ @@ -10,14 +10,11 @@
10 "preview": "nuxt preview", 10 "preview": "nuxt preview",
11 "postinstall": "nuxt prepare", 11 "postinstall": "nuxt prepare",
12 "lint:js": "eslint --ext \".ts,.vue\" . --fix", 12 "lint:js": "eslint --ext \".ts,.vue\" . --fix",
13 - "lint:prettier": "prettier --write \"{components,pages,plugins,middleware,layouts,composables,assets}/**/*.{js,jsx,ts,tsx,vue,html,css,scss,json,md}\" .", 13 + "lint": "npm run lint:js",
14 - "lint": "npm run lint:js && npm run lint:prettier", 14 + "lintfix": "eslint . --fix",
15 - "format": "prettier --write \"{components,pages,plugins,middleware,layouts,composables,assets}/**/*.{js,jsx,ts,tsx,vue,html,css,scss,json,md}\" --list-different .",  
16 - "lintfix": "npm run format && npm run lint:js",  
17 "test": "vitest" 15 "test": "vitest"
18 }, 16 },
19 "dependencies": { 17 "dependencies": {
20 - "@nuxt/eslint": "^1.3.0",  
21 "@nuxt/icon": "^1.12.0", 18 "@nuxt/icon": "^1.12.0",
22 "@nuxt/image": "^1.10.0", 19 "@nuxt/image": "^1.10.0",
23 "@nuxt/scripts": "^0.11.6", 20 "@nuxt/scripts": "^0.11.6",
@@ -42,16 +39,14 @@ @@ -42,16 +39,14 @@
42 "vuetify-nuxt-module": "^0.18.6" 39 "vuetify-nuxt-module": "^0.18.6"
43 }, 40 },
44 "devDependencies": { 41 "devDependencies": {
  42 + "@antfu/eslint-config": "^4.13.0",
45 "@nuxt/test-utils": "^3.17.2", 43 "@nuxt/test-utils": "^3.17.2",
46 "@nuxtjs/tailwindcss": "^6.13.2", 44 "@nuxtjs/tailwindcss": "^6.13.2",
47 "@typescript-eslint/parser": "^8.32.1", 45 "@typescript-eslint/parser": "^8.32.1",
48 "@vue/test-utils": "^2.4.6", 46 "@vue/test-utils": "^2.4.6",
49 - "eslint-config-prettier": "^10.1.2",  
50 - "eslint-plugin-prettier": "^5.2.6",  
51 "happy-dom": "^17.4.4", 47 "happy-dom": "^17.4.4",
52 "jsdom": "^26.1.0", 48 "jsdom": "^26.1.0",
53 "playwright-core": "^1.52.0", 49 "playwright-core": "^1.52.0",
54 - "prettier": "^3.5.3",  
55 "typescript-eslint": "^8.32.1", 50 "typescript-eslint": "^8.32.1",
56 "vitest": "^3.1.2", 51 "vitest": "^3.1.2",
57 "vue-eslint-parser": "^10.1.3" 52 "vue-eslint-parser": "^10.1.3"