website refactor
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": ["next/core-web-vitals"],
|
"extends": ["next/core-web-vitals"],
|
||||||
|
"plugins": ["gridpilot-rules"],
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
"lib/types/generated/**",
|
"lib/types/generated/**",
|
||||||
"**/*.test.ts",
|
"**/*.test.ts",
|
||||||
@@ -10,87 +11,86 @@
|
|||||||
{
|
{
|
||||||
"files": ["lib/presenters/*.ts", "lib/presenters/*.tsx"],
|
"files": ["lib/presenters/*.ts", "lib/presenters/*.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"presenter-contract": "error",
|
"gridpilot-rules/presenter-contract": "error",
|
||||||
"filename-presenter-match": "error"
|
"gridpilot-rules/filename-presenter-match": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["app/**/*.tsx"],
|
"files": ["app/**/*.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"template-no-direct-mutations": "error",
|
"gridpilot-rules/template-no-direct-mutations": "error",
|
||||||
"template-no-side-effects": "error",
|
"gridpilot-rules/template-no-side-effects": "error",
|
||||||
"template-no-async-render": "error",
|
"gridpilot-rules/template-no-async-render": "error",
|
||||||
"template-no-external-state": "error",
|
"gridpilot-rules/template-no-external-state": "error",
|
||||||
"template-no-global-objects": "error",
|
"gridpilot-rules/template-no-global-objects": "error",
|
||||||
"template-no-mutation-props": "error",
|
"gridpilot-rules/template-no-mutation-props": "error",
|
||||||
"template-no-unsafe-html": "error"
|
"gridpilot-rules/template-no-unsafe-html": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["app/**/page.tsx", "app/**/layout.tsx"],
|
"files": ["app/**/page.tsx", "app/**/layout.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"rsc-no-container-manager": "error",
|
"gridpilot-rules/rsc-no-container-manager": "error",
|
||||||
"rsc-no-page-data-fetcher": "error",
|
"gridpilot-rules/rsc-no-page-data-fetcher": "error",
|
||||||
"rsc-no-view-models": "error",
|
"gridpilot-rules/rsc-no-view-models": "error",
|
||||||
"rsc-no-presenters": "error",
|
"gridpilot-rules/rsc-no-presenters": "error",
|
||||||
"rsc-no-intl": "error",
|
"gridpilot-rules/rsc-no-intl": "error",
|
||||||
"rsc-no-sorting-filtering": "error",
|
"gridpilot-rules/rsc-no-sorting-filtering": "error",
|
||||||
"rsc-no-display-objects": "error",
|
"gridpilot-rules/rsc-no-display-objects": "error",
|
||||||
"rsc-no-unsafe-services": "error",
|
"gridpilot-rules/rsc-no-unsafe-services": "error",
|
||||||
"rsc-no-di": "error",
|
"gridpilot-rules/rsc-no-di": "error",
|
||||||
"rsc-no-local-helpers": "error",
|
"gridpilot-rules/rsc-no-local-helpers": "error",
|
||||||
"rsc-no-object-construction": "error",
|
"gridpilot-rules/rsc-no-object-construction": "error",
|
||||||
"rsc-no-container-manager-calls": "error"
|
"gridpilot-rules/rsc-no-container-manager-calls": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["lib/display-objects/**/*.ts", "lib/display-objects/**/*.tsx"],
|
"files": ["lib/display-objects/**/*.ts", "lib/display-objects/**/*.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"display-no-domain-models": "error",
|
"gridpilot-rules/display-no-domain-models": "error",
|
||||||
"display-no-business-logic": "error",
|
"gridpilot-rules/display-no-business-logic": "error",
|
||||||
"model-no-domain-in-display": "error",
|
"gridpilot-rules/model-no-domain-in-display": "error",
|
||||||
"filename-display-match": "error"
|
"gridpilot-rules/filename-display-match": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["lib/page-queries/**/*.ts"],
|
"files": ["lib/page-queries/**/*.ts"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"page-query-no-null-returns": "error",
|
"gridpilot-rules/page-query-no-null-returns": "error",
|
||||||
"page-query-filename": "error",
|
"gridpilot-rules/page-query-filename": "error",
|
||||||
"page-query-contract": "error",
|
"gridpilot-rules/page-query-contract": "error",
|
||||||
"page-query-execute": "error",
|
"gridpilot-rules/page-query-execute": "error",
|
||||||
"page-query-return-type": "error"
|
"gridpilot-rules/page-query-return-type": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["lib/services/**/*.ts"],
|
"files": ["lib/services/**/*.ts"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"services-must-be-marked": "error",
|
"gridpilot-rules/services-must-be-marked": "error",
|
||||||
"services-no-external-api": "error",
|
"gridpilot-rules/services-no-external-api": "error",
|
||||||
"services-must-be-pure": "error",
|
"gridpilot-rules/services-must-be-pure": "error",
|
||||||
"filename-service-match": "error"
|
"gridpilot-rules/filename-service-match": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["app/**/*.tsx"],
|
"files": ["app/**/*.tsx"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"client-only-no-server-code": "error",
|
"gridpilot-rules/client-only-no-server-code": "error",
|
||||||
"client-only-must-have-directive": "error"
|
"gridpilot-rules/client-only-must-have-directive": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["lib/write-boundaries/**/*.ts"],
|
"files": ["lib/write-boundaries/**/*.ts"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"write-boundary-no-direct-mutations": "error",
|
"gridpilot-rules/write-boundary-no-direct-mutations": "error",
|
||||||
"write-boundary-must-use-repository": "error"
|
"gridpilot-rules/write-boundary-must-use-repository": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": ["lib/domain/**/*.ts", "lib/models/**/*.ts"],
|
"files": ["lib/domain/**/*.ts", "lib/models/**/*.ts"],
|
||||||
"rules": {
|
"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-no-external-api': servicesRules['no-external-api-in-services'],
|
||||||
'services-must-be-pure': servicesRules['services-must-be-pure'],
|
'services-must-be-pure': servicesRules['services-must-be-pure'],
|
||||||
'services-must-return-result': cleanErrorHandling,
|
'services-must-return-result': cleanErrorHandling,
|
||||||
|
'services-must-be-marked': servicesImplementContract,
|
||||||
|
|
||||||
// Client-Only Rules
|
// Client-Only Rules
|
||||||
'client-only-no-server-code': clientOnlyRules['no-server-code-in-client-only'],
|
'client-only-no-server-code': clientOnlyRules['no-server-code-in-client-only'],
|
||||||
|
|||||||
@@ -32,7 +32,13 @@ module.exports = {
|
|||||||
'apps/website/index.ts', // Root entry
|
'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({
|
context.report({
|
||||||
node: null, // Report on the file level
|
node: null, // Report on the file level
|
||||||
loc: { line: 1, column: 0 },
|
loc: { line: 1, column: 0 },
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = {
|
|||||||
mustUseDomainError: 'Error types must be DomainError objects, not strings',
|
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.',
|
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',
|
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