# igorkowalski94/eslint-plugin-project-structure architecture

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

- Interactive diagram: https://gitdiagram.com/igorkowalski94/eslint-plugin-project-structure
- Repository: https://github.com/igorkowalski94/eslint-plugin-project-structure

## Overview

##### Project type and purpose
- This is an open-source ESLint plugin (“eslint-plugin-project-structure”)
- It provides three rule-sets—folder-structure, independent-modules, file-composition—to enforce project conventions
- Written in TypeScript/Node.js, integrates with ESLint’s plugin API

##### File structure
Top-level
– .github/, LICENSE, README.md, package.json, tsconfig.json, eslint.config.mjs, jest.config.ts, tsup.config.ts
– JSON schemas and generators (fileComposition.schema.json + fileComposition.mjs, folderStructure.schema.json + folderStructure.mjs, independentModules.schema.json + independentModules.mjs)
src/
– index.ts (plugin entry point)
– parser.ts (AST preprocessing)
– consts.ts, types.ts (shared constants/types)
– errors/ (error constructors and guards)
– helpers/ (utility functions for config reading, cache handling, regex, case transforms, project root resolution)
– rules/
- folderStructure/ (schema, rule logic, helpers, custom errors)
- independentModules/ (schema, rule logic, helpers, custom errors)
- fileComposition/ (schema, rule logic, helpers)

##### README for additional insights
- Describes each rule-set’s purpose, features, and configuration options
- Points to JSON schema→TypeScript config generator flow for each rule category
- Explains plugin usage in ESLint, built-in import resolver, and --fix capabilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Services
    subgraph "External Dependencies"
        ESLINT["ESLint Core"]:::external
        NODEFS["Node.js FS"]:::external
        TSAPI["TypeScript Compiler API"]:::external
        MICROMATCH["micromatch"]:::external
    end

    %% Schema Generators & Config
    subgraph "Config & Schema Generators" 
        FG1["fileComposition.mjs"]:::schema
        FS1["fileComposition.schema.json"]:::schema
        FG2["folderStructure.mjs"]:::schema
        FS2["folderStructure.schema.json"]:::schema
        FG3["independentModules.mjs"]:::schema
        FS3["independentModules.schema.json"]:::schema
    end

    %% Plugin Core
    subgraph "Plugin Core" 
        ENTRY["index.ts"]:::core
        PARSER["parser.ts"]:::core
        CONSTS["consts.ts"]:::helper
        TYPES["types.ts"]:::helper
    end

    %% Shared Helpers & Errors
    subgraph "Shared Helpers & Error Factories"
        HELPERS["helpers/"]:::helper
        CACHE["Cache Layer"]:::storage
        ERRORS["errors/"]:::helper
    end

    %% Rule Modules
    subgraph "Rule Modules"
        subgraph "Folder-Structure" 
            FS_RULE["folderStructure.ts"]:::rule
        end
        subgraph "Independent-Modules"
            IM_RULE["independentModules.ts"]:::rule
        end
        subgraph "File-Composition"
            FC_RULE["fileComposition.ts"]:::rule
        end
    end

    %% Tests & Build
    subgraph "Testing & Build"
        TESTS["jest.config.ts"]:::test
        BUILD1["tsup.config.ts"]:::build
        BUILD2["package.json"]:::build
        BUILD3["tsconfig.json"]:::build
    end

    %% Connections
    ESLINT -->|loads plugin via| ENTRY
    ENTRY -->|registers parser| PARSER
    PARSER -->|builds AST for| FS_RULE
    PARSER --> IM_RULE
    PARSER --> FC_RULE

    FG1 --> FS1
    FG2 --> FS2
    FG3 --> FS3

    FS_RULE -->|reads config via| FS1
    IM_RULE -->|reads config via| FS3
    FC_RULE -->|reads config via| FS1

    FS_RULE --> HELPERS
    IM_RULE --> HELPERS
    FC_RULE --> HELPERS

    HELPERS --> CACHE
    HELPERS --> ERRORS

    FS_RULE --> ERRORS
    IM_RULE --> ERRORS
    FC_RULE --> ERRORS

    FS_RULE -->|uses micromatch| MICROMATCH
    IM_RULE -->|uses micromatch| MICROMATCH

    TESTS --> HELPERS
    TESTS --> FS_RULE
    TESTS --> IM_RULE
    TESTS --> FC_RULE

    ENTRY -->|uses| CONSTS
    ENTRY -->|uses| TYPES

    ENTRY -->|invokes| FG1
    ENTRY --> FG2
    ENTRY --> FG3

    %% Click Events
    click ENTRY "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/index.ts"
    click PARSER "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/parser.ts"
    click CONSTS "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/consts.ts"
    click TYPES "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/types.ts"
    click FG1 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/fileComposition.mjs"
    click FS1 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/fileComposition.schema.json"
    click FG2 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/folderStructure.mjs"
    click FS2 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/folderStructure.schema.json"
    click FG3 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/independentModules.mjs"
    click FS3 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/independentModules.schema.json"
    click TESTS "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/jest.config.ts"
    click BUILD1 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/tsup.config.ts"
    click BUILD2 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/package.json"
    click BUILD3 "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/tsconfig.json"
    click FS_RULE "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/rules/folderStructure/folderStructure.ts"
    click IM_RULE "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/rules/independentModules/independentModules.ts"
    click FC_RULE "https://github.com/igorkowalski94/eslint-plugin-project-structure/blob/main/src/rules/fileComposition/fileComposition.ts"

    %% Styles
    classDef external fill:#bbf,stroke:#000,color:#000
    classDef core fill:#bfe,stroke:#000,color:#000
    classDef schema fill:#eee,stroke:#666,color:#000
    classDef rule fill:#fca,stroke:#000,color:#000
    classDef helper fill:#fea,stroke:#000,color:#000
    classDef storage fill:#ccc,stroke:#000,color:#000
    classDef test fill:#cff,stroke:#000,color:#000
    classDef build fill:#dfd,stroke:#000,color:#000
```
