From aa9c9d361be8a9ac1f00ac522b49cc366c7c73b9 Mon Sep 17 00:00:00 2001 From: Peter Ovchyn Date: Thu, 12 Jun 2025 14:04:59 +0200 Subject: [PATCH 1/2] feat: Add ESLint complexity and code size rules --- workers/main/eslint.config.mjs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/workers/main/eslint.config.mjs b/workers/main/eslint.config.mjs index 8564d93..224d853 100644 --- a/workers/main/eslint.config.mjs +++ b/workers/main/eslint.config.mjs @@ -62,6 +62,21 @@ export default [ ], 'simple-import-sort/imports': 'error', 'simple-import-sort/exports': 'error', + + // Code complexity and size rules + 'max-depth': ['error', 4], + 'max-lines': ['error', 300], + 'max-nested-callbacks': ['error', 3], + 'max-params': ['error', 5], + 'max-statements': ['error', 50], + 'complexity': ['error', 15], + }, + }, + // Override for test files to allow more nested callbacks + { + files: ['**/*.test.ts', '**/*.test.js'], + rules: { + 'max-nested-callbacks': ['error', 4], }, }, ]; From 41db247dc5d6e798d532d7465b92834857dfcdca Mon Sep 17 00:00:00 2001 From: Peter Ovchyn Date: Thu, 12 Jun 2025 14:19:07 +0200 Subject: [PATCH 2/2] Add max-lines-per-function ESLint rule with test file override - Add max-lines-per-function rule with 50 line limit - Add test file override allowing 150 lines per function - Update test file override comment to reflect additional rule --- workers/main/eslint.config.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workers/main/eslint.config.mjs b/workers/main/eslint.config.mjs index 224d853..70ff8ad 100644 --- a/workers/main/eslint.config.mjs +++ b/workers/main/eslint.config.mjs @@ -66,17 +66,19 @@ export default [ // Code complexity and size rules 'max-depth': ['error', 4], 'max-lines': ['error', 300], + 'max-lines-per-function': ['error', 50], 'max-nested-callbacks': ['error', 3], 'max-params': ['error', 5], 'max-statements': ['error', 50], 'complexity': ['error', 15], }, }, - // Override for test files to allow more nested callbacks + // Override for test files to allow more nested callbacks and longer functions { files: ['**/*.test.ts', '**/*.test.js'], rules: { 'max-nested-callbacks': ['error', 4], + 'max-lines-per-function': ['error', 150], }, }, ];