Skip to content

Commit a1b0857

Browse files
committed
fix: update no-orphaned-files rule for composables and services usage
1 parent 542c888 commit a1b0857

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

docs/rules/no-orphaned-files.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ The rule validates files against these predefined categories:
6060
### Business Layer
6161

6262
- **`components/`** - Global business components (can contain subdirectories for complex components)
63-
- **`composables/`** - Reusable composition functions (flat structure)
64-
- **`services/`** - Business services and API clients (flat structure)
63+
- **`composables/`** - Reusable composition functions (can contain subdirectories)
64+
- **`services/`** - Business services and API clients (can have subdirectories for organization)
6565

6666
### State Layer
6767

@@ -244,9 +244,11 @@ src/
244244
├── composables/ ✅ Global composables (flat)
245245
│ ├── useAuth.ts
246246
│ └── useApi.ts
247-
├── services/ ✅ Global services (flat)
247+
├── services/ ✅ Global services (can have subdirectories)
248248
│ ├── apiClient.ts
249-
│ └── authService.ts
249+
│ ├── authService.ts
250+
│ └── jsonrpc/
251+
│ └── config.ts
250252
├── stores/ ✅ Global stores (flat)
251253
│ └── userStore.ts
252254
├── entities/ ✅ Data models

docs/vue-project-modules-blueprint.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ src/
4040
├── services/ # Global API clients and business logic services
4141
│ ├── auth.api.ts
4242
│ ├── users.api.ts
43-
│ └── notifications.api.ts
43+
│ ├── notifications.api.ts
44+
│ └── jsonrpc/ # Services can have subdirectories for organization
45+
│ └── config.ts
4446
4547
├── entities/ # Global business entities
4648
│ ├── base/

src/rules/no-orphaned-files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const defaultOptions = {
2121

2222
// Shared business layer
2323
components: ['*'], // Components can have subdirectories for complex components
24-
composables: [], // Flat structure expected
25-
services: [], // Flat structure expected
24+
composables: ['*'], // Flat structure expected
25+
services: ['*'], // Services can have subdirectories for organization
2626

2727
// State layer
2828
stores: ['*.ts'], // Allow TypeScript files in subdirectories (for types, etc.)

tests/no-orphaned-files.spec.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -313,29 +313,10 @@ describe('no-orphaned-files rule', () => {
313313
})
314314
})
315315

316-
it('should flag unexpected subdirectories in flat categories (composables, stores)', () => {
316+
it('should flag unexpected subdirectories in flat categories (stores)', () => {
317317
ruleTester.run('no-orphaned-files', noOrphanedFilesRule, {
318318
valid: [],
319319
invalid: [
320-
{
321-
code: 'export function useApi() {}',
322-
filename: '/project/src/composables/api/useApi.ts',
323-
errors: [
324-
{
325-
messageId: 'orphanedFile',
326-
data: {
327-
message: "Directory 'composables' should have a flat structure, but found subdirectory 'api'",
328-
},
329-
},
330-
{
331-
messageId: 'suggestion',
332-
data: {
333-
suggestion:
334-
"Move files from 'composables/api/' directly to 'composables/' or consider if this belongs in modules/ or features/",
335-
},
336-
},
337-
],
338-
},
339320
{
340321
code: 'export const store = {}',
341322
filename: '/project/src/stores/auth/authStore.js',

0 commit comments

Comments
 (0)