website refactor
This commit is contained in:
@@ -5,42 +5,7 @@
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
// Rule 1: Services must be marked with @server-safe or @client-only
|
||||
'services-must-be-marked': {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Enforce service safety marking',
|
||||
category: 'Services',
|
||||
},
|
||||
messages: {
|
||||
message: 'Services must be explicitly marked with @server-safe or @client-only comment - see apps/website/lib/contracts/services/Service.ts',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
Program(node) {
|
||||
const filename = context.getFilename();
|
||||
if (filename.includes('/lib/services/') && filename.endsWith('.ts')) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const text = sourceCode.getText();
|
||||
|
||||
const hasServerSafe = text.includes('@server-safe');
|
||||
const hasClientOnly = text.includes('@client-only');
|
||||
|
||||
if (!hasServerSafe && !hasClientOnly) {
|
||||
context.report({
|
||||
loc: { line: 1, column: 0 },
|
||||
messageId: 'message',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
// Rule 2: No external API calls in services
|
||||
// Rule 1: No external API calls in services
|
||||
'no-external-api-in-services': {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
@@ -87,7 +52,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
|
||||
// Rule 3: Services must be pure functions
|
||||
// Rule 2: Services must be pure functions
|
||||
'services-must-be-pure': {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
|
||||
Reference in New Issue
Block a user