Skip to content

Commit 6003e3e

Browse files
style(prettier): Apply new prettier configuration to the codebase
1 parent 5a807e5 commit 6003e3e

50 files changed

Lines changed: 2026 additions & 1903 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

webapp/components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
"hooks": "@/hooks"
2323
},
2424
"registries": {}
25-
}
25+
}

webapp/eslint.config.ts

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
import js from "@eslint/js";
1+
import pluginReact from "eslint-plugin-react";
22
import globals from "globals";
33
import tseslint from "typescript-eslint";
4-
import pluginReact from "eslint-plugin-react";
4+
5+
import js from "@eslint/js";
56
import json from "@eslint/json";
6-
import { defineConfig } from "eslint/config";
77
import pluginPrettier from "eslint-config-prettier/flat";
8+
import { defineConfig } from "eslint/config";
89

910
export default defineConfig([
10-
{ files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
11+
{
12+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
13+
plugins: { js },
14+
extends: ["js/recommended"],
15+
languageOptions: { globals: globals.browser },
16+
},
1117
tseslint.configs.recommended,
1218
{
1319
...pluginReact.configs.flat.recommended,
@@ -16,17 +22,27 @@ export default defineConfig([
1622
* Disable react/display-name since it's currently broken
1723
* TypeError: Error while loading rule 'react/display-name': sourceCode.getAllComments is not a function
1824
*/
19-
"react/display-name": ["off"]
25+
"react/display-name": ["off"],
2026
},
2127
settings: {
2228
react: {
23-
version: "detect"
24-
}
29+
version: "detect",
30+
},
2531
},
2632
},
27-
/** @ts-expect-error json plugin not typed well*/
28-
{ files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] },
29-
/** @ts-expect-error json plugin not typed well*/
30-
{ files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] },
33+
{
34+
files: ["**/*.json"],
35+
/** @ts-expect-error json plugin not typed well*/
36+
plugins: { json },
37+
language: "json/json",
38+
extends: ["json/recommended"],
39+
},
40+
{
41+
files: ["**/*.jsonc"],
42+
/** @ts-expect-error json plugin not typed well*/
43+
plugins: { json },
44+
language: "json/jsonc",
45+
extends: ["json/recommended"],
46+
},
3147
pluginPrettier,
3248
]);

webapp/index.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<link
6+
rel="icon"
7+
type="image/svg+xml"
8+
href="/vite.svg"
9+
/>
10+
<meta
11+
name="viewport"
12+
content="width=device-width, initial-scale=1.0"
13+
/>
714
<title>frontend</title>
815
</head>
916
<body>
1017
<div id="root"></div>
11-
<script type="module" src="/src/main.tsx"></script>
18+
<script
19+
type="module"
20+
src="/src/main.tsx"
21+
></script>
1222
</body>
1323
</html>

webapp/scripts/check-architecture.cjs

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
* Vérifie que les imports respectent les règles de l'architecture
44
*/
55

6-
const fs = require('fs');
7-
const path = require('path');
6+
const fs = require("fs");
7+
const path = require("path");
88

9-
const LAYERS = ['app', 'pages', 'widgets', 'features', 'entities', 'shared'];
9+
const LAYERS = ["app", "pages", "widgets", "features", "entities", "shared"];
1010
const LAYER_HIERARCHY = {
11-
'shared': [],
12-
'entities': ['shared'],
13-
'features': ['entities', 'shared'],
14-
'widgets': ['features', 'entities', 'shared'],
15-
'pages': ['widgets', 'features', 'entities', 'shared'],
16-
'app': ['pages', 'widgets', 'features', 'entities', 'shared']
11+
shared: [],
12+
entities: ["shared"],
13+
features: ["entities", "shared"],
14+
widgets: ["features", "entities", "shared"],
15+
pages: ["widgets", "features", "entities", "shared"],
16+
app: ["pages", "widgets", "features", "entities", "shared"],
1717
};
1818

1919
function getLayerFromPath(filePath) {
20-
const relativePath = path.relative(path.join(__dirname, 'src'), filePath);
20+
const relativePath = path.relative(path.join(__dirname, "src"), filePath);
2121
const firstDir = relativePath.split(path.sep)[0];
2222
return LAYERS.includes(firstDir) ? firstDir : null;
2323
}
@@ -33,12 +33,15 @@ function checkImports(filePath, fileContent) {
3333
while ((match = importRegex.exec(fileContent)) !== null) {
3434
const importedLayer = match[1];
3535

36-
if (LAYERS.includes(importedLayer) && !LAYER_HIERARCHY[layer].includes(importedLayer)) {
36+
if (
37+
LAYERS.includes(importedLayer) &&
38+
!LAYER_HIERARCHY[layer].includes(importedLayer)
39+
) {
3740
violations.push({
3841
file: filePath,
3942
layer,
4043
importedLayer,
41-
line: fileContent.substring(0, match.index).split('\n').length
44+
line: fileContent.substring(0, match.index).split("\n").length,
4245
});
4346
}
4447
}
@@ -54,10 +57,17 @@ function scanDirectory(dir) {
5457
const filePath = path.join(dir, file);
5558
const stat = fs.statSync(filePath);
5659

57-
if (stat.isDirectory() && !file.startsWith('.') && file !== 'node_modules') {
60+
if (
61+
stat.isDirectory() &&
62+
!file.startsWith(".") &&
63+
file !== "node_modules"
64+
) {
5865
violations.push(...scanDirectory(filePath));
59-
} else if (stat.isFile() && (file.endsWith('.ts') || file.endsWith('.tsx'))) {
60-
const content = fs.readFileSync(filePath, 'utf8');
66+
} else if (
67+
stat.isFile() &&
68+
(file.endsWith(".ts") || file.endsWith(".tsx"))
69+
) {
70+
const content = fs.readFileSync(filePath, "utf8");
6171
violations.push(...checkImports(filePath, content));
6272
}
6373
}
@@ -66,21 +76,27 @@ function scanDirectory(dir) {
6676
}
6777

6878
// Exécution
69-
console.log('🔍 Vérification de l\'architecture FSD...\n');
79+
console.log("🔍 Vérification de l'architecture FSD...\n");
7080

71-
const srcDir = path.join(__dirname, '../src');
81+
const srcDir = path.join(__dirname, "../src");
7282
const violations = scanDirectory(srcDir);
7383

7484
if (violations.length === 0) {
75-
console.log('✅ Aucune violation détectée ! L\'architecture FSD est respectée.');
85+
console.log(
86+
"✅ Aucune violation détectée ! L'architecture FSD est respectée.",
87+
);
7688
} else {
7789
console.log(`❌ ${violations.length} violation(s) détectée(s):\n`);
7890

7991
violations.forEach(({ file, layer, importedLayer, line }) => {
8092
const relativeFile = path.relative(__dirname, file);
8193
console.log(` ${relativeFile}:${line}`);
82-
console.log(` ↳ La couche "${layer}" ne peut pas importer depuis "${importedLayer}"`);
83-
console.log(` ↳ Imports autorisés: ${LAYER_HIERARCHY[layer].join(', ') || 'aucun'}\n`);
94+
console.log(
95+
` ↳ La couche "${layer}" ne peut pas importer depuis "${importedLayer}"`,
96+
);
97+
console.log(
98+
` ↳ Imports autorisés: ${LAYER_HIERARCHY[layer].join(", ") || "aucun"}\n`,
99+
);
84100
});
85101

86102
process.exit(1);

webapp/scripts/generate-tree.cjs

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@
66
* @example node scripts/generate-tree.cjs ./frontend/src docs/frontend-archi.md
77
*/
88

9-
const fs = require('fs');
10-
const path = require('path');
11-
12-
const IGNORE_LIST = [
13-
'node_modules',
14-
'.git',
15-
'dist',
16-
'coverage',
17-
'.vscode',
18-
];
9+
const fs = require("fs");
10+
const path = require("path");
11+
12+
const IGNORE_LIST = ["node_modules", ".git", "dist", "coverage", ".vscode"];
1913

2014
// Caractères Unicode (maintenant commentés)
2115
// const PREFIX_BRANCH = '├── ';
@@ -24,36 +18,36 @@ const IGNORE_LIST = [
2418
// const PREFIX_EMPTY = ' ';
2519

2620
// Alternative avec des caractères ASCII-safe pour une compatibilité maximale
27-
const PREFIX_BRANCH = '|-- ';
28-
const PREFIX_LAST_BRANCH = '`-- '; // Utilise un accent grave pour simuler la branche finale
29-
const PREFIX_CHILD = '| ';
30-
const PREFIX_EMPTY = ' ';
31-
21+
const PREFIX_BRANCH = "|-- ";
22+
const PREFIX_LAST_BRANCH = "`-- "; // Utilise un accent grave pour simuler la branche finale
23+
const PREFIX_CHILD = "| ";
24+
const PREFIX_EMPTY = " ";
3225

3326
/**
3427
* Fonction récursive qui génère l'arborescence d'un dossier.
3528
* @param {string} directory - Le chemin du dossier à analyser.
3629
* @param {string} prefix - Le préfixe de ligne pour l'indentation.
3730
* @returns {string[]} Un tableau de chaînes, chaque chaîne étant une ligne de l'arbre.
3831
*/
39-
function generateTree(directory, prefix = '') {
40-
const lines = [];
41-
const files = fs.readdirSync(directory)
42-
.filter(file => !IGNORE_LIST.includes(file));
43-
44-
files.forEach((file, index) => {
45-
const filePath = path.join(directory, file);
46-
const isLast = index === files.length - 1;
47-
const isDirectory = fs.statSync(filePath).isDirectory();
48-
49-
lines.push(prefix + (isLast ? PREFIX_LAST_BRANCH : PREFIX_BRANCH) + file);
50-
51-
if (isDirectory) {
52-
const childPrefix = prefix + (isLast ? PREFIX_EMPTY : PREFIX_CHILD);
53-
lines.push(...generateTree(filePath, childPrefix));
54-
}
55-
});
56-
return lines;
32+
function generateTree(directory, prefix = "") {
33+
const lines = [];
34+
const files = fs
35+
.readdirSync(directory)
36+
.filter((file) => !IGNORE_LIST.includes(file));
37+
38+
files.forEach((file, index) => {
39+
const filePath = path.join(directory, file);
40+
const isLast = index === files.length - 1;
41+
const isDirectory = fs.statSync(filePath).isDirectory();
42+
43+
lines.push(prefix + (isLast ? PREFIX_LAST_BRANCH : PREFIX_BRANCH) + file);
44+
45+
if (isDirectory) {
46+
const childPrefix = prefix + (isLast ? PREFIX_EMPTY : PREFIX_CHILD);
47+
lines.push(...generateTree(filePath, childPrefix));
48+
}
49+
});
50+
return lines;
5751
}
5852

5953
// --- Point d'entrée du script ---
@@ -62,35 +56,45 @@ const targetDir = process.argv[2];
6256
const outputFile = process.argv[3];
6357

6458
if (!targetDir) {
65-
console.error('❌ Erreur : Veuillez spécifier le chemin du dossier à analyser.');
66-
console.error('Usage: node scripts/generate-tree.cjs <chemin_dossier> [fichier_sortie]');
67-
process.exit(1);
59+
console.error(
60+
"❌ Erreur : Veuillez spécifier le chemin du dossier à analyser.",
61+
);
62+
console.error(
63+
"Usage: node scripts/generate-tree.cjs <chemin_dossier> [fichier_sortie]",
64+
);
65+
process.exit(1);
6866
}
6967

7068
if (!fs.existsSync(targetDir) || !fs.statSync(targetDir).isDirectory()) {
71-
console.error(`❌ Erreur : Le dossier "${targetDir}" n'est pas un dossier valide.`);
72-
process.exit(1);
69+
console.error(
70+
`❌ Erreur : Le dossier "${targetDir}" n'est pas un dossier valide.`,
71+
);
72+
process.exit(1);
7373
}
7474

7575
const treeLines = [
76-
`\`\`\`text`,
77-
path.basename(targetDir),
78-
...generateTree(targetDir),
79-
`\`\`\``
76+
`\`\`\`text`,
77+
path.basename(targetDir),
78+
...generateTree(targetDir),
79+
`\`\`\``,
8080
];
8181

82-
const outputString = treeLines.join('\n');
82+
const outputString = treeLines.join("\n");
8383

84-
console.log('🌳 Arborescence générée :\n');
84+
console.log("🌳 Arborescence générée :\n");
8585
console.log(outputString);
8686

8787
if (outputFile) {
88-
try {
89-
// Le BOM n'est plus nécessaire avec des caractères ASCII purs.
90-
fs.writeFileSync(outputFile, outputString, 'utf8');
91-
console.log(`\n✅ Arborescence sauvegardée avec succès dans : ${outputFile}`);
92-
} catch (error) {
93-
console.error(`\n❌ Erreur lors de l'écriture du fichier : ${error.message}`);
94-
process.exit(1);
95-
}
96-
}
88+
try {
89+
// Le BOM n'est plus nécessaire avec des caractères ASCII purs.
90+
fs.writeFileSync(outputFile, outputString, "utf8");
91+
console.log(
92+
`\n✅ Arborescence sauvegardée avec succès dans : ${outputFile}`,
93+
);
94+
} catch (error) {
95+
console.error(
96+
`\n❌ Erreur lors de l'écriture du fichier : ${error.message}`,
97+
);
98+
process.exit(1);
99+
}
100+
}

webapp/src/app/App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import { ThemeProvider, ApiProvider, AuthProvider } from "@providers";
2-
import { AppRouter } from "./routes/AppRouter";
1+
import { ApiProvider, AuthProvider, ThemeProvider } from "@providers";
32

3+
import { AppRouter } from "./routes/AppRouter";
44
import "./styles/all4trees.css";
55
import "./styles/globals.css";
66

77
function App() {
8-
98
return (
10-
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
9+
<ThemeProvider
10+
defaultTheme="dark"
11+
storageKey="vite-ui-theme"
12+
>
1113
<AuthProvider>
1214
<ApiProvider>
1315
<AppRouter />
@@ -17,4 +19,4 @@ function App() {
1719
);
1820
}
1921

20-
export default App;
22+
export default App;

0 commit comments

Comments
 (0)