You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 5.0 introduces powerful ESLint rules that enforce project structure, code composition, and module independence.
10
11
These rules help maintain consistency and prevent common architectural issues as your project grows.
11
12
13
+
:::tip Architecture & Module Independence
14
+
This guide covers **ESLint configuration and technical rules**. For a high-level understanding of the architectural model, layer hierarchy, and module dependency rules, see the [Independent Modules Architecture](/docs/independent-modules) guide.
15
+
16
+
Think of it this way:
17
+
18
+
-**Independent Modules** guide = "What is the architecture and why?"
19
+
-**ESLint guide** = "How to configure and customize the rules?"
20
+
:::
21
+
12
22
:::tip Optional Strict Rules
13
23
The project structure enforcement rules are **intentionally strict** to maintain architectural consistency. However, they are:
24
+
14
25
-**Evolutionary**: These rules will be refined and updated over time as best practices emerge
15
26
-**Optional**: If you find them too restrictive for your use case, you can disable them by commenting out the project-structure configuration in `eslint.config.mjs`:
16
27
@@ -79,10 +90,12 @@ export default defineConfig([
79
90
```
80
91
81
92
When you choose JavaScript during project initialization, TypeScript-specific type-checking rules are automatically disabled for `.js` and `.jsx` files. This includes:
93
+
82
94
- All rules requiring type information (from `strictTypeChecked` and `stylisticTypeChecked`)
83
95
- Type-aware linting rules
84
96
85
97
**All other rules remain active for JavaScript:**
98
+
86
99
- Project structure enforcement
87
100
- Code composition rules
88
101
- Import sorting (perfectionist)
@@ -130,14 +143,17 @@ This prevents files from being placed in incorrect locations and enforces the bo
130
143
Enforces what each file can contain based on its location:
131
144
132
145
**Hook files** (`hooks/**/*.ts`):
146
+
133
147
- ✅ Only function declarations and exports
134
148
- ❌ No class declarations, no inline objects
135
149
136
150
**Domain API files** (`services/domains/*/*.api.ts`):
151
+
137
152
- ✅ Only function declarations, exports, and API object
This creates a clear dependency hierarchy and prevents tight coupling.
183
199
200
+
:::info Learn More
201
+
For a complete understanding of the module architecture, layer hierarchy, and detailed import rules, see the dedicated guide: [Independent Modules Architecture](/docs/independent-modules)
202
+
:::
203
+
184
204
### 2. eslint-plugin-perfectionist
185
205
186
206
Automatically sorts and organizes code elements alphabetically:
0 commit comments