website refactor

This commit is contained in:
2026-01-12 19:24:59 +01:00
parent 1f0c4f7fa6
commit 5ea95eaf51
54 changed files with 2894 additions and 2342 deletions

View File

@@ -275,7 +275,16 @@ module.exports = {
create(context) {
return {
FunctionDeclaration(node) {
if (!node.id.name.startsWith('assert') &&
// Skip if this is the main component (default export or ends with Page/Template)
const filename = context.getFilename();
const isMainComponent =
(node.parent && node.parent.type === 'ExportDefaultDeclaration') ||
(node.id && node.id.name && (node.id.name.endsWith('Page') || node.id.name.endsWith('Template') || node.id.name.endsWith('Component')));
if (isMainComponent) return;
// Only flag nested helper functions
if (!node.id.name.startsWith('assert') &&
!node.id.name.startsWith('invariant') &&
!isInComment(node)) {
context.report({
@@ -285,9 +294,16 @@ module.exports = {
}
},
VariableDeclarator(node) {
if (node.init &&
// Skip if this is the main component
const isMainComponent =
(node.parent && node.parent.parent && node.parent.parent.type === 'ExportDefaultDeclaration') ||
(node.id && node.id.name && (node.id.name.endsWith('Page') || node.id.name.endsWith('Template') || node.id.name.endsWith('Component')));
if (isMainComponent) return;
if (node.init &&
(node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression') &&
!node.id.name.startsWith('assert') &&
!node.id.name.startsWith('assert') &&
!node.id.name.startsWith('invariant') &&
!isInComment(node)) {
context.report({