website refactor
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"extends": ["next/core-web-vitals"],
|
||||
"plugins": ["gridpilot-rules"],
|
||||
"ignorePatterns": [
|
||||
"lib/types/generated/**",
|
||||
"**/*.test.ts",
|
||||
@@ -10,87 +11,86 @@
|
||||
{
|
||||
"files": ["lib/presenters/*.ts", "lib/presenters/*.tsx"],
|
||||
"rules": {
|
||||
"presenter-contract": "error",
|
||||
"filename-presenter-match": "error"
|
||||
"gridpilot-rules/presenter-contract": "error",
|
||||
"gridpilot-rules/filename-presenter-match": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["app/**/*.tsx"],
|
||||
"rules": {
|
||||
"template-no-direct-mutations": "error",
|
||||
"template-no-side-effects": "error",
|
||||
"template-no-async-render": "error",
|
||||
"template-no-external-state": "error",
|
||||
"template-no-global-objects": "error",
|
||||
"template-no-mutation-props": "error",
|
||||
"template-no-unsafe-html": "error"
|
||||
"gridpilot-rules/template-no-direct-mutations": "error",
|
||||
"gridpilot-rules/template-no-side-effects": "error",
|
||||
"gridpilot-rules/template-no-async-render": "error",
|
||||
"gridpilot-rules/template-no-external-state": "error",
|
||||
"gridpilot-rules/template-no-global-objects": "error",
|
||||
"gridpilot-rules/template-no-mutation-props": "error",
|
||||
"gridpilot-rules/template-no-unsafe-html": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["app/**/page.tsx", "app/**/layout.tsx"],
|
||||
"rules": {
|
||||
"rsc-no-container-manager": "error",
|
||||
"rsc-no-page-data-fetcher": "error",
|
||||
"rsc-no-view-models": "error",
|
||||
"rsc-no-presenters": "error",
|
||||
"rsc-no-intl": "error",
|
||||
"rsc-no-sorting-filtering": "error",
|
||||
"rsc-no-display-objects": "error",
|
||||
"rsc-no-unsafe-services": "error",
|
||||
"rsc-no-di": "error",
|
||||
"rsc-no-local-helpers": "error",
|
||||
"rsc-no-object-construction": "error",
|
||||
"rsc-no-container-manager-calls": "error"
|
||||
"gridpilot-rules/rsc-no-container-manager": "error",
|
||||
"gridpilot-rules/rsc-no-page-data-fetcher": "error",
|
||||
"gridpilot-rules/rsc-no-view-models": "error",
|
||||
"gridpilot-rules/rsc-no-presenters": "error",
|
||||
"gridpilot-rules/rsc-no-intl": "error",
|
||||
"gridpilot-rules/rsc-no-sorting-filtering": "error",
|
||||
"gridpilot-rules/rsc-no-display-objects": "error",
|
||||
"gridpilot-rules/rsc-no-unsafe-services": "error",
|
||||
"gridpilot-rules/rsc-no-di": "error",
|
||||
"gridpilot-rules/rsc-no-local-helpers": "error",
|
||||
"gridpilot-rules/rsc-no-object-construction": "error",
|
||||
"gridpilot-rules/rsc-no-container-manager-calls": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["lib/display-objects/**/*.ts", "lib/display-objects/**/*.tsx"],
|
||||
"rules": {
|
||||
"display-no-domain-models": "error",
|
||||
"display-no-business-logic": "error",
|
||||
"model-no-domain-in-display": "error",
|
||||
"filename-display-match": "error"
|
||||
"gridpilot-rules/display-no-domain-models": "error",
|
||||
"gridpilot-rules/display-no-business-logic": "error",
|
||||
"gridpilot-rules/model-no-domain-in-display": "error",
|
||||
"gridpilot-rules/filename-display-match": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["lib/page-queries/**/*.ts"],
|
||||
"rules": {
|
||||
"page-query-no-null-returns": "error",
|
||||
"page-query-filename": "error",
|
||||
"page-query-contract": "error",
|
||||
"page-query-execute": "error",
|
||||
"page-query-return-type": "error"
|
||||
"gridpilot-rules/page-query-no-null-returns": "error",
|
||||
"gridpilot-rules/page-query-filename": "error",
|
||||
"gridpilot-rules/page-query-contract": "error",
|
||||
"gridpilot-rules/page-query-execute": "error",
|
||||
"gridpilot-rules/page-query-return-type": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["lib/services/**/*.ts"],
|
||||
"rules": {
|
||||
"services-must-be-marked": "error",
|
||||
"services-no-external-api": "error",
|
||||
"services-must-be-pure": "error",
|
||||
"filename-service-match": "error"
|
||||
"gridpilot-rules/services-must-be-marked": "error",
|
||||
"gridpilot-rules/services-no-external-api": "error",
|
||||
"gridpilot-rules/services-must-be-pure": "error",
|
||||
"gridpilot-rules/filename-service-match": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["app/**/*.tsx"],
|
||||
"rules": {
|
||||
"client-only-no-server-code": "error",
|
||||
"client-only-must-have-directive": "error"
|
||||
"gridpilot-rules/client-only-no-server-code": "error",
|
||||
"gridpilot-rules/client-only-must-have-directive": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["lib/write-boundaries/**/*.ts"],
|
||||
"rules": {
|
||||
"write-boundary-no-direct-mutations": "error",
|
||||
"write-boundary-must-use-repository": "error"
|
||||
"gridpilot-rules/write-boundary-no-direct-mutations": "error",
|
||||
"gridpilot-rules/write-boundary-must-use-repository": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["lib/domain/**/*.ts", "lib/models/**/*.ts"],
|
||||
"rules": {
|
||||
"model-no-display-in-domain": "error"
|
||||
"gridpilot-rules/model-no-display-in-domain": "error"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rulesdir": ["./eslint-rules"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ module.exports = {
|
||||
'services-no-external-api': servicesRules['no-external-api-in-services'],
|
||||
'services-must-be-pure': servicesRules['services-must-be-pure'],
|
||||
'services-must-return-result': cleanErrorHandling,
|
||||
'services-must-be-marked': servicesImplementContract,
|
||||
|
||||
// Client-Only Rules
|
||||
'client-only-no-server-code': clientOnlyRules['no-server-code-in-client-only'],
|
||||
|
||||
@@ -32,7 +32,13 @@ module.exports = {
|
||||
'apps/website/index.ts', // Root entry
|
||||
];
|
||||
|
||||
if (isIndexFile && !allowedPaths.some(path => filename.endsWith(path))) {
|
||||
// Check if the filename ends with any of the allowed paths
|
||||
// The filename is an absolute path, so we need to check if it contains the relative path
|
||||
const isAllowedPath = allowedPaths.some(allowedPath => {
|
||||
return filename.endsWith(allowedPath) || filename.includes('/' + allowedPath);
|
||||
});
|
||||
|
||||
if (isIndexFile && !isAllowedPath) {
|
||||
context.report({
|
||||
node: null, // Report on the file level
|
||||
loc: { line: 1, column: 0 },
|
||||
|
||||
@@ -27,6 +27,7 @@ module.exports = {
|
||||
mustUseDomainError: 'Error types must be DomainError objects, not strings',
|
||||
noConstructorParams: 'Services must be self-contained. Constructor cannot have parameters. Dependencies should be created inside the constructor.',
|
||||
mustImplementContract: 'Services must explicitly implement Service<TApiDto, TError> interface',
|
||||
servicesMustBeMarked: 'Services must be explicitly marked with @Service decorator or similar (placeholder for services-must-be-marked)',
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user