eslint-plugin-project-structure

ESLint plugin with rules to help you achieve a scalable, consistent, and well-structured project. Define your folder structure, advanced naming conventions, file composition, and create independent modules. react folder structure react project structure react file structure react folder structure react folder structure react folder structure native

MIT License

Downloads
44.5K
Stars
283
Committers
2

Bot releases are hidden (Show)

eslint-plugin-project-structure - Migration guide to 2.1.0 Latest Release

Published by Igorkowalski94 3 months ago

eslint-plugin-project-structure - Migration to 2.0.0

Published by Igorkowalski94 3 months ago

Migration guide to 2.0.0

Version 2.0.0 introduces two new rules and minor configuration improvements.

A minor configuration fix will be required for version <= 1.4.7.

Changes for the file .eslintrc

From:

{
    "rules": {
        "project-structure/file-structure": "error", // warn | error
    },
    "settings": {
        "project-structure/config-path": "projectStructure.json", // json | jsonc | yaml
    },
}

To:

{
    "rules": {
        "project-structure/folder-structure": "error", // warn | error
    },
    "settings": {
        "project-structure/folder-structure-config-path": "folderStructure.json", // json | jsonc | yaml
    },
}

Changes for the projectStructure.json

From:

{
    "$schema": "node_modules/eslint-plugin-project-structure/projectStructure.schema.json",
}

To:

{
    "$schema": "node_modules/eslint-plugin-project-structure/folderStructure.schema.json",
}

Changes for the regexParameters

From: ${{parentName}}

{
    "name": "/^${{parentName}}$/",
}

To: {parentName}

{
    "name": "/^{parentName}$/",
}

New rules:

Playground for eslint-plugin-project-structure rules.

project-structure-independent-modules

Create independent modules to keep your repository scalable and easy to maintain.
Get rid of dependencies between modules and create truly independent functionalities.

Features

✅ Creating independent modules in which you control what can be imported.
✅ Disabling external imports (node_modules) for a given module (Option to add exceptions).
✅ Reference {dirname} which allows you to decide about the current directory and its level in the pattern.
✅ Reference {family} which finds the common part between a given import and the current file.
✅ Non-relative/relative imports support.
✅ Support for imports without extension.
✅ Reusable import patterns.

project-structure-naming-rules

Enforce naming rules.

Features

✅ Naming validation.
✅ Support for classes, types, interfaces, enums, variables, functions, arrow function.
✅ Inheriting the file name as the name (Option of adding your own prefixes/suffixes or changing the case).
✅ Deleting parts of a file name.
✅ Naming rules only for name types located in the root of the file (not nested).
✅ Regex validation
✅ Build in case validation.
✅ Different name rules for different files.

eslint-plugin-project-structure - Migration to 1.4.4

Published by Igorkowalski94 about 1 year ago

1.4.4 adds support for validating multiple structure folders/files.

https://github.com/Igorkowalski94/eslint-plugin-project-structure#structure

Minor configuration tweak required:

From:

    "structure": {
        "name": "src",
        "children": [
           // ...
        ]
    }

To:

    "structure": {
        "children": [
            {
                "name": "src",
                "children": [
                   // ...
                ]
            },
            {
              "extension": "*" // All files located in the root of your project, like package.json, .eslintrc, etc. You can specify them more precisely.
            }
           // ...
        ]
    }