website refactor
This commit is contained in:
37
core/eslint-rules/domain-no-application.js
Normal file
37
core/eslint-rules/domain-no-application.js
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Enforce that Core Domain does not depend on Application layer',
|
||||
category: 'Architecture',
|
||||
recommended: true,
|
||||
},
|
||||
fixable: null,
|
||||
schema: [],
|
||||
messages: {
|
||||
forbiddenImport: 'Domain layer should not depend on Application layer. Forbidden import from "{{source}}".',
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const filename = context.getFilename();
|
||||
const isDomainFile = filename.includes('/domain/');
|
||||
|
||||
if (!isDomainFile) return {};
|
||||
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
const source = node.source.value;
|
||||
if (source.includes('/application/')) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'forbiddenImport',
|
||||
data: {
|
||||
source,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user