File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ src/lib/
3838
3939- ** Components** : Access Helpers via Stores/LocalStores (direct Helper dependency is prohibited)
4040- ** Stores/LocalStores** : Can directly access Helpers, pass state to Helpers for execution
41+ - ** Helpers/Utility** : Cannot depend on Stores (must be pure functions, receive values as arguments)
4142
4243## State Management
4344
Original file line number Diff line number Diff line change @@ -36,4 +36,21 @@ export default [
3636 ] ,
3737 } ,
3838 } ,
39+ // Helpers and Utility layers cannot depend on Stores layer
40+ {
41+ files : [ 'src/lib/helpers/**/*.ts' , 'src/lib/utility/**/*.ts' ] ,
42+ rules : {
43+ 'no-restricted-imports' : [
44+ 'error' ,
45+ {
46+ patterns : [
47+ {
48+ group : [ '$lib/stores' , '$lib/stores/**' ] ,
49+ message : 'Pass values as arguments to keep Helpers/Utility pure functions' ,
50+ } ,
51+ ] ,
52+ } ,
53+ ] ,
54+ } ,
55+ } ,
3956] ;
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export default pages;
4646- ** Prettier Integration** - Seamless integration with Prettier formatting
4747- ** Test File Detection** - Automatic relaxed rules for ` *.test.{js,ts} ` and ` *.spec.{js,ts} `
4848- ** Config File Detection** - Relaxed JSDoc requirements for ` *.config.{js,ts} `
49+ - ** Architecture Rules** - Layered architecture enforcement (available in ` web ` config)
4950
5051## Included Plugins
5152
@@ -64,6 +65,22 @@ bun lint # Run linting
6465bun format # Format code
6566```
6667
68+ ## Architecture Rules (Web Config)
69+
70+ The ` web ` configuration includes architectural layer rules to enforce clean separation of concerns:
71+
72+ ### Layer Restrictions
73+
74+ - ** Stores Layer Access** : Direct imports from ` $lib/stores/* ` are prohibited; use ` $lib/stores ` index
75+ - ** Components Layer** : Cannot directly import Helpers; must access via Stores/LocalStores
76+ - ** Helpers/Utility Layers** : Cannot import from Stores layer; must be pure functions receiving values as arguments
77+
78+ These rules ensure:
79+
80+ - ** Testability** : Pure functions in Helpers/Utility layers are easy to test without mocking
81+ - ** Maintainability** : Clear separation of concerns and unidirectional data flow
82+ - ** Type Safety** : Dependency injection through function arguments provides better type inference
83+
6784## Design Philosophy
6885
6986- ** Centralized Management** - All ESLint configurations managed from a single source
You can’t perform that action at this time.
0 commit comments