-
-
Notifications
You must be signed in to change notification settings - Fork 14
refactor: code cleanup and simplification #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for eslint-code-explorer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR consolidates and simplifies the AST component architecture by unifying language-specific AST implementations into a single generic component. It introduces reusable UI components and extracts shared logic to reduce code duplication.
- Unified all per-language AST components (javascript-ast, json-ast, css-ast, html-ast, markdown-ast) into a single generic AST component
- Consolidated duplicate
*-ast-tree-item
components into a single reusableASTTreeItem
- Extracted view mode toggle logic into a reusable
ViewModeToggle
component and createdLabeledSwitch
for consistent UI patterns
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/lib/tools.tsx | Updates import to use the new unified AST component |
src/components/view-mode-toggle.tsx | New reusable component for view mode toggles |
src/components/theme-provider.tsx | Fixes relative import path |
src/components/scope/scope-view-mode.tsx | Refactored to use the new ViewModeToggle component |
src/components/path/path-view-mode.tsx | Refactored to use the new ViewModeToggle component |
src/components/path/index.tsx | Refactored to use shared ErrorState component |
src/components/options.tsx | Refactored to use new LabeledSwitch component and updated imports |
src/components/labeled-switch.tsx | New reusable component for labeled switches |
src/components/labeled-select.tsx | Converted from default to named export |
src/components/ast/markdown-ast.tsx | Removed - consolidated into generic AST component |
src/components/ast/markdown-ast-tree-item.tsx | Removed - consolidated into generic ASTTreeItem |
src/components/ast/json-ast.tsx | Removed - consolidated into generic AST component |
src/components/ast/json-ast-tree-item.tsx | Removed - consolidated into generic ASTTreeItem |
src/components/ast/javascript-ast.tsx | Removed - consolidated into generic AST component |
src/components/ast/javascript-ast-tree-item.tsx | Removed - consolidated into generic ASTTreeItem |
src/components/ast/index.tsx | Rewritten to implement the unified AST component |
src/components/ast/html-ast.tsx | Removed - consolidated into generic AST component |
src/components/ast/html-ast-tree-item.tsx | Removed - consolidated into generic ASTTreeItem |
src/components/ast/css-ast.tsx | Removed - consolidated into generic AST component |
src/components/ast/ast-view-mode.tsx | Refactored to use the new ViewModeToggle component |
src/components/ast/ast-tree-item.tsx | Renamed and made generic to replace all language-specific tree items |
docs/adding-languages.md | Updated documentation to reflect simplified language addition process |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Prerequisites checklist
What is the purpose of this pull request?
The purpose of this pull request is to improve maintainability and consistency across the codebase. It simplifies components, consolidates duplicated logic, and introduces small refactors to shared utilities and UI elements. These changes reduce complexity and make future enhancements easier.
What changes did you make? (Give an overview)
javascript-ast
,json-ast
,css-ast
,html-ast
,markdown-ast
) into a single generic AST component.*-ast-tree-item
components into a single reusableASTTreeItem
.*-view-mode
components to delegate rendering logic to a newViewModeToggle
.LabeledSelect
(converted to named export).LabeledSwitch
(new component for consistent labeled toggles).adding-languages.md
) to reflect the simplified process for adding new languages.Related Issues
Fixes #134
Is there anything you'd like reviewers to focus on?