You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SUGGESTION] Adding eslint-plugin-project-structure to the project for validating folder structure and more, to automatically ensure scalability and consistency.
#390
Open
Igorkowalski94 opened this issue
Sep 23, 2024
· 0 comments
Enforce rules on folder structure to keep your project consistent, orderly and well thought out.
Features:
Validation of folder structure. Any files/folders outside the structure will be considered an error.
File/Folder name regex validation with features like wildcard * and treating . as a character, along with other conveniences.
Build in case validation.
Inheriting the folder's name. The file/folder inherits the name of the folder in which it is located. Option of adding your own prefixes/suffixes or changing the case.
Enforcing the existence of a files/folders when a specific file/folder exists. For example, if ./src/Component.tsx exists, then ./src/Component.test.tsx and ./src/stories/Component.stories.tsx must also exist.
Reusable rules for folder structures.
An option to create a separate configuration file with TypeScript support.
Forcing a nested/flat structure for a given folder.
Support for all file extensions.
Folder recursion. You can repeatedly nest a folder structure and set a limit on the nesting depth. There is also an option to change the rule at the final level, such as flattening the folder structure.
Fewer repetitions and precise error messages, even for deeply nested folders (recursion), by representing the folder structure as a tree.
Checking the length of paths and notifying when the limit is exceeded.
A key principle of a healthy project is to prevent the creation of a massive dependency tree,
where removing or editing one feature triggers a chain reaction that impacts the entire project.
Create independent modules to keep your project 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 (e.g. types, functions, components of one functionality cannot be imported into another functionality).
The ability to create very detailed rules, even for nested folder structures. Whether it's a large module, a sub-module, or a single file, there are no limitations.
Support for all types of imports, including require(), import(), jest.mock(), and jest.requireActual(), as well as ExportAllDeclaration and ExportNamedDeclaration.
Disabling external imports (node_modules) for a given module (Option to add exceptions).
Non-relative/relative imports support.
Support for imports without extension.
Reusable import patterns.
Support for path aliases. The plugin will automatically detect your tsconfig.json and use your settings. There is also an option to enter them manually.
An option to create a separate configuration file with TypeScript support.
Inheriting the filename as the selector name. Option to add your own prefixes/suffixes, change the case, or remove parts of the filename.
Prohibit the use of given selectors in a given file. For example, **/*.consts.ts files can only contain variables, **/*.types.ts files can only contain interfaces and types.
Define the order in which your selectors should appear in a given file. Support for --fix to automatically correct the order.
Rules for exported selectors, selectors in the root of the file and nested/all selectors in the file. They can be used together in combination.
Enforcing a maximum of one main function/class per file.
The ability to set a specific limit on the occurrence of certain selectors in the root of a given file.
Selector name regex validation.
Build in case validation.
Different rules for different files.
An option to create a separate configuration file with TypeScript support.
The text was updated successfully, but these errors were encountered:
Hey, I think my library might interest you. Thanks to it, you can automatically validate your folder structure rules and much more.
If you are interested, I’d be happy to assist with the implementation and answer any questions you may have.
Below is the full description of the features:
eslint‑plugin-project‑structure
Powerful ESLint plugin with rules to help you achieve a scalable, consistent, and well-structured project.
Create your own framework! Define your folder structure, file composition, advanced naming conventions, and create independent modules.
Take your project to the next level and save time by automating the review of key principles of a healthy project!
project‑structure/folder‑structure
Enforce rules on folder structure to keep your project consistent, orderly and well thought out.
*
and treating.
as a character, along with other conveniences../src/Component.tsx
exists, then./src/Component.test.tsx
and./src/stories/Component.stories.tsx
must also exist.project‑structure/independent‑modules
A key principle of a healthy project is to prevent the creation of a massive dependency tree, where removing or editing one feature triggers a chain reaction that impacts the entire project.
Create independent modules to keep your project scalable and easy to maintain. Get rid of dependencies between modules and create truly independent functionalities.
require()
,import()
,jest.mock()
, andjest.requireActual()
, as well asExportAllDeclaration
andExportNamedDeclaration
.project‑structure/file‑composition
Compose your ideal files!
Have full control over the order and quantity of selectors.
Define advanced naming conventions and prohibit the use of specific selectors in given files.
class
,function
,arrowFunction
,type
,interface
,enum
,variable
,variableExpression
.**/*.consts.ts
files can only contain variables,**/*.types.ts
files can only contain interfaces and types.--fix
to automatically correct the order.The text was updated successfully, but these errors were encountered: