Description
The src/components/Editor/index.tsx file currently requires ESLint config overrides to bypass code complexity limits:
max-lines: ["error", 400] (increased from 350)
max-lines-per-function: ["error", 180]
max-statements: ["error", 25]
These overrides indicate that the Editor component has grown too large and complex, making it difficult to maintain and understand.
Proposed Solution
Refactor the Editor component by:
- Extract utility functions: Move standalone functions like
getSelectedLogEventNum, handleCopyLogEventAction, handleToggleWordWrapAction, and handleEditorCustomAction to separate utility files
- Create smaller sub-components: Break down the main Editor component into focused sub-components (e.g., EditorActions, EditorDecorations, etc.)
- Custom hooks: Extract complex useEffect logic into custom hooks for better separation of concerns
- Separate constants: Move configuration and constants to dedicated files
Benefits
- Improved code maintainability and readability
- Better testability with smaller, focused units
- Elimination of ESLint overrides
- Enhanced developer experience
Context
Referenced from PR #305 and comment
Description
The
src/components/Editor/index.tsxfile currently requires ESLint config overrides to bypass code complexity limits:max-lines: ["error", 400](increased from 350)max-lines-per-function: ["error", 180]max-statements: ["error", 25]These overrides indicate that the Editor component has grown too large and complex, making it difficult to maintain and understand.
Proposed Solution
Refactor the Editor component by:
getSelectedLogEventNum,handleCopyLogEventAction,handleToggleWordWrapAction, andhandleEditorCustomActionto separate utility filesBenefits
Context
Referenced from PR #305 and comment