Skip to content

Conversation

xbinaryx
Copy link
Contributor

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)

  • Unified per-language AST components (javascript-ast, json-ast, css-ast, html-ast, markdown-ast) into a single generic AST component.
  • Consolidated duplicated *-ast-tree-item components into a single reusable ASTTreeItem.
  • Updated *-view-mode components to delegate rendering logic to a new ViewModeToggle.
  • Extracted and exported new shared UI components:
    • LabeledSelect (converted to named export).
    • LabeledSwitch (new component for consistent labeled toggles).
  • Updated documentation (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?

Copy link

netlify bot commented Sep 22, 2025

Deploy Preview for eslint-code-explorer ready!

Name Link
🔨 Latest commit 8ef75bd
🔍 Latest deploy log https://app.netlify.com/projects/eslint-code-explorer/deploys/68d11015ccab710008a47e18
😎 Deploy Preview https://deploy-preview-162--eslint-code-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

github-actions bot commented Oct 2, 2025

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.

@github-actions github-actions bot added the Stale label Oct 2, 2025
@lumirlumir lumirlumir added the accepted There is consensus among the team that this change meets the criteria for inclusion label Oct 3, 2025
@lumirlumir lumirlumir requested review from a team and Copilot October 3, 2025 09:33
Copy link

@Copilot Copilot AI left a 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 reusable ASTTreeItem
  • Extracted view mode toggle logic into a reusable ViewModeToggle component and created LabeledSwitch 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion chore Stale
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

Suggestion: Refactor codebase to reduce duplication
2 participants