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
Published by Igorkowalski94 3 months ago
Published by Igorkowalski94 3 months ago
Version 2.0.0 introduces two new rules and minor configuration improvements.
A minor configuration fix will be required for version <= 1.4.7.
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
},
}
From:
{
"$schema": "node_modules/eslint-plugin-project-structure/projectStructure.schema.json",
}
To:
{
"$schema": "node_modules/eslint-plugin-project-structure/folderStructure.schema.json",
}
From: ${{parentName}}
{
"name": "/^${{parentName}}$/",
}
To: {parentName}
{
"name": "/^{parentName}$/",
}
Create independent modules to keep your repository scalable and easy to maintain.
Get rid of dependencies between modules and create truly independent functionalities.
✅ 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.
Enforce naming rules.
✅ 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.
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.
}
// ...
]
}