-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce front project structure through ESLINT #7863
Changes from 5 commits
07c8097
8399d05
44e28eb
f3566ca
28db80e
ae412bd
5021f2b
736edcd
0d2d998
001626d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
.nx/installation | ||
.nx/cache | ||
projectStructure.cache.json | ||
|
||
.pnp.* | ||
.yarn/* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"$schema": "../../node_modules/eslint-plugin-project-structure/folderStructure.schema.json", | ||
"regexParameters": { | ||
"camelCase": "^[a-z]+([A-Za-z0-9]+)+" | ||
}, | ||
"structure": [ | ||
{ | ||
"name": "packages", | ||
"children": [ | ||
{ | ||
"name": "twenty-front", | ||
"children": [ | ||
{ "name": "*", "children": [] }, | ||
{ "name": "*" }, | ||
{ | ||
"name": "src", | ||
"children": [ | ||
{ "name": "*", "children": [] }, | ||
{ "name": "*" }, | ||
{ | ||
"name": "modules", | ||
"children": [ | ||
{ "ruleId": "moduleFolderRule" }, | ||
{ "name": "types", "ruleId": "doNotCheckLeafFolderRule" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. temporary |
||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"rules": { | ||
"moduleFolderRule": { | ||
"name": "^(?!utils$|hooks$|states$|types$|graphql$|components$|effect-components$|constants$|validation-schemas$|contexts$|scopes$|services$|errors$)[a-z][a-z0-9]**(?:-[a-z0-9]+)**$", | ||
"folderRecursionLimit": 6, | ||
"children": [ | ||
{ "ruleId": "moduleFolderRule" }, | ||
{ "name": "hooks", "ruleId": "hooksLeafFolderRule" }, | ||
{ "name": "utils", "ruleId": "utilsLeafFolderRule" }, | ||
{ "name": "states", "ruleId": "doNotCheckLeafFolderRule" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added this rule for now we can progressively add the rules folder by folder once we have fixed the existing warnings (we have ~150), let's do it step by step There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've actually fixed existing warnings but I don't want to move everything now, we will activate these rules progressively |
||
{ "name": "types", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "graphql", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "components", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "effect-components", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "constants", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "validation-schemas", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "contexts", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "scopes", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "services", "ruleId": "doNotCheckLeafFolderRule" }, | ||
{ "name": "errors", "ruleId": "doNotCheckLeafFolderRule" } | ||
] | ||
}, | ||
"hooksLeafFolderRule": { | ||
"folderRecursionLimit": 2, | ||
"children": [ | ||
{ "name": "use{PascalCase}.(ts|tsx)" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: The naming convention for hooks files is strict. Ensure all existing hooks follow this pattern, or consider allowing more flexibility. |
||
{ | ||
"name": "__tests__", | ||
"children": [{ "name": "use{PascalCase}.test.(ts|tsx)" }] | ||
}, | ||
{ "name": "internal", "ruleId": "hooksLeafFolderRule" } | ||
] | ||
}, | ||
"doNotCheckLeafFolderRule": { | ||
"folderRecursionLimit": 1, | ||
"children": [{ "name": "*" }, { "name": "*", "children": [] }] | ||
}, | ||
"utilsLeafFolderRule": { | ||
"folderRecursionLimit": 1, | ||
"children": [ | ||
{ "name": "{camelCase}.ts" }, | ||
{ | ||
"name": "__tests__", | ||
"children": [{ "name": "{camelCase}.test.ts" }] | ||
} | ||
] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding a comment explaining the purpose of the 'project-structure' plugin for future maintainers