# rel1cx/eslint-react architecture

> Architecture diagram of the GitHub repository rel1cx/eslint-react, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rel1cx/eslint-react
- Repository: https://github.com/rel1cx/eslint-react

## Overview

##### Main System Components
- Monorepo Structure – The repository is organized as a monorepo. The high-level parts include:
- Apps: For instance, the “apps/website” folder is where the documentation site, demos, and playgrounds are built.
- Packages: This is the heart of the project and further subdivided into:
o Core functionality (packages/core)
o Shared utilities (packages/shared)
o Utilities modules (packages/utilities with further sub-modules like “ast”, “eff”, “jsx”, “kit”, and “var”)
o Plugins: Multiple ESLint plugins are maintained under packages/plugins (for example, eslint-plugin-react-x, eslint-plugin-react-dom, eslint-plugin-react-web-api, eslint-plugin-react-hooks-extra, eslint-plugin-react-naming-convention) and then combined in the all-in-one package (@eslint-react/eslint-plugin).
- Scripts and Configurations – Scripts for CI, version updates, and website/documentation updates are available under the “scripts” folder. Additionally, configuration files (.github, tsconfig.json, etc.) show integration with CI/CD and build pipelines.
- Tests – The “test” directory indicates that a comprehensive testing strategy is in place for rule case testing and fixture validation.

##### Relationships and Interactions
- Dependency Hierarchy – The plugins (in packages/plugins) rely on the underlying core logic (in packages/core) and shared helpers (in packages/shared) to enforce rules and validations.
- Utility & Helper Layers – The utilities modules (found under packages/utilities) are organized into distinct concerns (e.g., Abstract Syntax Tree (AST) handling, JSX parsing, code analysis utilities, etc.) and are used across multiple packages.
- Aggregation – The combined package “@eslint-react/eslint-plugin” aggregates the individual plugins, providing a single point of integration for end-users.
- Website & Documentation – The “apps/website” application draws its content (documentation, examples, and configuration guides) from the various documentation sources within the monorepo (for example, packages/core/docs and packages/shared/docs).
- Build/CI Layers – Configuration and scripts (including workflows in .github/workflows) indicate automated testing, code analysis, and publishing processes that interconnect the different modules.

##### Architectural Patterns and Design Principles
- Modularity – The project follows a highly modular approach, splitting functionalities into focused packages (core, shared, utilities, plugins) that can evolve independently.
- Reusability and Composability – By having common utilities and shared configurations, rules among plugins are easily reused. The “all-in-one” plugin is built by composing the individual ones.
- Separation of Concerns – There is a clear separation between rule definition (plugins), core logic (packages/core), shared tools (packages/shared), end-user documentation (apps/website), and CI/CD scripts.
- Monorepo Management – The use of workspaces (pnpm-workspace.yaml) and consistent TypeScript configurations (tsconfig.json files scattered throughout) supports a scalable and maintainable codebase.

##### Technology Stack Details
- TypeScript – Every package uses TypeScript, and various shared tsconfig and tsup (for bundling) configs are evident.
- ESLint and JavaScript – The project interfaces with ESLint (and uses @eslint/js, typescript-eslint, etc.) and provides rules targeted for React.
- Build Tools – Tools like TSUP are used for building modules, and CI workflows utilize GitHub Actions for automated testing, code analysis, and publishing.
- Documentation and Website Tools – The “apps/website” folder indicates a Next.js based or similar React application that serves as a documentation portal.

##### Final Recommendations
- Clarity by arranging components hierarchically—from lower-level utilities up to end-user facing products.
- Internal processing layers (core, shared, utilities) from front-end components (apps/website) and from CI/CD/infrastructure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Monorepo
    subgraph "Monorepo"
        %% Apps Subgraph
        subgraph "Apps"
            Website["Website"]:::apps
            Playground["Playground"]:::apps
        end

        %% Packages Subgraph
        subgraph "Packages"
            Core["Core Functionality"]:::packages
            Shared["Shared Utilities"]:::packages

            %% Utilities Subgraph
            subgraph "Utilities Modules"
                AST["AST Module"]:::utilities
                Eff["Eff Module"]:::utilities
                JSX["JSX Module"]:::utilities
                Kit["Kit Module"]:::utilities
                Var["Var Module"]:::utilities
            end

            %% ESLint Plugins Subgraph
            subgraph "ESLint Plugins"
                ReactX["eslint-plugin-react-x"]:::plugins
                ReactDOM["eslint-plugin-react-dom"]:::plugins
                WebAPI["eslint-plugin-react-web-api"]:::plugins
                HooksExtra["eslint-plugin-react-hooks-extra"]:::plugins
                NamingConvention["eslint-plugin-react-naming-convention"]:::plugins
                Aggregated["Aggregated Plugin (@eslint-react/eslint-plugin)"]:::plugins
            end
        end

        %% Scripts & Configurations
        Scripts["Scripts & Configurations"]:::external
        
        %% Tests
        Tests["Tests"]:::external
    end

    %% Relationships
    %% Plugins depend on Core and Shared
    Core -->|"dependency"| ReactX
    Core -->|"dependency"| ReactDOM
    Core -->|"dependency"| WebAPI
    Core -->|"dependency"| HooksExtra
    Core -->|"dependency"| NamingConvention

    Shared -->|"dependency"| ReactX
    Shared -->|"dependency"| ReactDOM
    Shared -->|"dependency"| WebAPI
    Shared -->|"dependency"| HooksExtra
    Shared -->|"dependency"| NamingConvention

    %% Utilities used by Core and Plugins
    AST ---|"provides"| Core
    Eff ---|"provides"| Core
    JSX ---|"provides"| Core
    Kit ---|"provides"| Core
    Var ---|"provides"| Core

    AST ---|"provides"| ReactX
    Eff ---|"provides"| ReactX
    JSX ---|"provides"| ReactX
    Kit ---|"provides"| ReactX
    Var ---|"provides"| ReactX

    %% Aggregation of Plugins
    ReactX -->|"aggregated"| Aggregated
    ReactDOM -->|"aggregated"| Aggregated
    WebAPI -->|"aggregated"| Aggregated
    HooksExtra -->|"aggregated"| Aggregated
    NamingConvention -->|"aggregated"| Aggregated

    %% Website Documentation uses Core and Shared docs
    Website -->|"docs"| Core
    Website -->|"docs"| Shared

    %% Scripts & CI automation interactions
    Scripts -->|"CI/CD"| Core
    Scripts -->|"CI/CD"| Shared
    Scripts -->|"CI/CD"| AST
    Scripts -->|"CI/CD"| Eff
    Scripts -->|"CI/CD"| JSX
    Scripts -->|"CI/CD"| Kit
    Scripts -->|"CI/CD"| Var
    Scripts -->|"CI/CD"| ReactX
    Scripts -->|"CI/CD"| ReactDOM
    Scripts -->|"CI/CD"| WebAPI
    Scripts -->|"CI/CD"| HooksExtra
    Scripts -->|"CI/CD"| NamingConvention
    Scripts -->|"CI/CD"| Aggregated
    Scripts -->|"CI/CD"| Tests

    %% Click Events
    click Website "https://github.com/rel1cx/eslint-react/tree/main/apps/website"
    click Playground "https://github.com/rel1cx/eslint-react/tree/main/apps/playground"
    click Core "https://github.com/rel1cx/eslint-react/tree/main/packages/core"
    click Shared "https://github.com/rel1cx/eslint-react/tree/main/packages/shared"
    click AST "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/ast"
    click Eff "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/eff"
    click JSX "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/jsx"
    click Kit "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/kit"
    click Var "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/var"
    click ReactX "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x"
    click ReactDOM "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom"
    click WebAPI "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-web-api"
    click HooksExtra "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-hooks-extra"
    click NamingConvention "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-naming-convention"
    click Aggregated "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin"
    click Scripts "https://github.com/rel1cx/eslint-react/tree/main/scripts"
    click Tests "https://github.com/rel1cx/eslint-react/tree/main/test"

    %% Styles
    classDef apps fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef packages fill:#aed6f1,stroke:#1b4f72,stroke-width:2px;
    classDef utilities fill:#a9dfbf,stroke:#145a32,stroke-width:2px;
    classDef plugins fill:#f5b7b1,stroke:#78281f,stroke-width:2px;
    classDef external fill:#d2b4de,stroke:#4a235a,stroke-width:2px;
```
