do to formatters
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* 1. NOT contain the word "DTO" (DTOs are for API/Services)
|
||||
* 2. NOT define ViewData interfaces (ViewData must be in lib/view-data/)
|
||||
* 3. NOT import from DTO paths (DTOs belong to lib/types/generated/)
|
||||
* 4. ONLY import from allowed paths: lib/contracts/, lib/view-models/, lib/view-data/, lib/display-objects/
|
||||
* 4. ONLY import from allowed paths: lib/contracts/, lib/view-models/, lib/view-data/, lib/formatters/
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
@@ -22,7 +22,7 @@ module.exports = {
|
||||
noDtoInViewModel: 'ViewModels must not use the word "DTO". DTOs belong to the API/Service layer. Use plain logic-rich properties or ViewData types.',
|
||||
noDtoImport: 'ViewModels must not import from DTO paths. DTOs belong to lib/types/generated/. Import from lib/view-data/ or use plain properties instead.',
|
||||
noViewDataDefinition: 'ViewData must not be defined within ViewModel files. Import them from lib/view-data/ instead.',
|
||||
strictImport: 'ViewModels can only import from lib/contracts/, lib/view-models/, lib/view-data/, or lib/display-objects/. External imports are allowed. Found: {{importPath}}',
|
||||
strictImport: 'ViewModels can only import from lib/contracts/, lib/view-models/, lib/view-data/, or lib/formatters/. External imports are allowed. Found: {{importPath}}',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ module.exports = {
|
||||
'@/lib/contracts/',
|
||||
'@/lib/view-models/',
|
||||
'@/lib/view-data/',
|
||||
'@/lib/display-objects/',
|
||||
'@/lib/formatters/',
|
||||
];
|
||||
|
||||
const isAllowed = allowedPaths.some(path => importPath.startsWith(path));
|
||||
@@ -83,12 +83,12 @@ module.exports = {
|
||||
importPath.includes('/lib/contracts/') ||
|
||||
importPath.includes('/lib/view-models/') ||
|
||||
importPath.includes('/lib/view-data/') ||
|
||||
importPath.includes('/lib/display-objects/') ||
|
||||
importPath.includes('/lib/formatters/') ||
|
||||
// Also check for patterns like ../contracts/...
|
||||
importPath.includes('contracts') ||
|
||||
importPath.includes('view-models') ||
|
||||
importPath.includes('view-data') ||
|
||||
importPath.includes('display-objects') ||
|
||||
importPath.includes('formatters') ||
|
||||
// Allow relative imports to view models (e.g., ./InvoiceViewModel, ../ViewModelName)
|
||||
// This matches patterns like ./ViewModelName or ../ViewModelName
|
||||
/^\.\/[A-Z][a-zA-Z0-9]*ViewModel$/.test(importPath) ||
|
||||
|
||||
Reference in New Issue
Block a user