website refactor

This commit is contained in:
2026-01-12 14:52:04 +01:00
parent e3e451d959
commit 48957bfc56
13 changed files with 82 additions and 42 deletions

View File

@@ -0,0 +1,36 @@
/**
* ESLint rule: Components must not manipulate data
*/
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Forbid data manipulation in components',
category: 'Components',
},
messages: {
message: 'Components must not manipulate data - see apps/website/lib/contracts/view-data/ViewData.ts',
},
},
create(context) {
return {
CallExpression(node) {
const filename = context.getFilename();
if (filename.includes('/components/')) {
// Check for mutation methods
if (node.callee.type === 'MemberExpression') {
const property = node.callee.property;
if (property.type === 'Identifier' &&
['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse', 'assign'].includes(property.name)) {
context.report({
node,
messageId: 'message',
});
}
}
}
},
};
},
};