Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ src/lib/

- **Components**: Access Helpers via Stores/LocalStores (direct Helper dependency is prohibited)
- **Stores/LocalStores**: Can directly access Helpers, pass state to Helpers for execution
- **Helpers/Utility**: Cannot depend on Stores (must be pure functions, receive values as arguments)

## State Management

Expand Down
17 changes: 17 additions & 0 deletions apps/web/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,21 @@ export default [
],
},
},
// Helpers and Utility layers cannot depend on Stores layer
{
files: ['src/lib/helpers/**/*.ts', 'src/lib/utility/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['$lib/stores', '$lib/stores/**'],
message: 'Pass values as arguments to keep Helpers/Utility pure functions',
},
],
},
],
},
},
];
17 changes: 17 additions & 0 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default pages;
- **Prettier Integration** - Seamless integration with Prettier formatting
- **Test File Detection** - Automatic relaxed rules for `*.test.{js,ts}` and `*.spec.{js,ts}`
- **Config File Detection** - Relaxed JSDoc requirements for `*.config.{js,ts}`
- **Architecture Rules** - Layered architecture enforcement (available in `web` config)

## Included Plugins

Expand All @@ -64,6 +65,22 @@ bun lint # Run linting
bun format # Format code
```

## Architecture Rules (Web Config)

The `web` configuration includes architectural layer rules to enforce clean separation of concerns:

### Layer Restrictions

- **Stores Layer Access**: Direct imports from `$lib/stores/*` are prohibited; use `$lib/stores` index
- **Components Layer**: Cannot directly import Helpers; must access via Stores/LocalStores
- **Helpers/Utility Layers**: Cannot import from Stores layer; must be pure functions receiving values as arguments

These rules ensure:

- **Testability**: Pure functions in Helpers/Utility layers are easy to test without mocking
- **Maintainability**: Clear separation of concerns and unidirectional data flow
- **Type Safety**: Dependency injection through function arguments provides better type inference

## Design Philosophy

- **Centralized Management** - All ESLint configurations managed from a single source
Expand Down