ย
Playground for eslint-plugin-project-structure.
- project-structure/folder-structure
- project-structure/independent-modules
- project-structure/file-composition
The project uses ESLint's new config system as default. If you want to test on the old eslint config, follow these steps:
- Remove package.json
- Remove eslint.config.mjs
- Remove independentModules.mjs
- Remove fileComposition.mjs
- Remove folderStructure.mjs
- Rename packageLegacyConfig.json to package.json
npm install
npm run lint:watch
or
npm run lint
Warning
Folder needs to contain at least one file/subfolder with file to be validated. ESLint and Git ignore empty folders, so they wonโt be pushed to the repository and will only remain visible locally.
- All files in the
features
folder have all possible correct imports. You can try importing other files to see the errors. - Examples of individual functionalities can be found in the
examples
folder. - If you have any questions or need help creating a configuration that meets your requirements, click here.
- Variables in
.const.ts
files must follow{SNAKE_CASE}
. .consts.ts
files may only contain variables.- Interfaces and types in
.types.ts
files must follow{PascalCase}
. - Enums in
.types.ts
files must follow{SNAKE_CASE}
. .types.ts
files may only contain interfaces, types and enums.- All
.ts
files must contain only one main function. The main function should be named{fileName}
. The main function can have an interface or type which must be named{FileName}Props
or{FileName}Return
. - All
.tsx
files must contain only one main function. The main function should be named{FileName}
. The main function can have an interface or type which must be named{FileName}Props
or{FileName}Return
. - All nested functions and variables in
.ts
and.tsx
files must follow{camelCase}
. .types.ts
files can only import fromnode_modules
and nothing else..consts.ts
files can only import from.types.ts
files located in the same directory..api.ts
files can only import from.consts.ts
and.types.ts
files located in the same directory.
.
โโโ ...
โโโ ๐ fileComposition.mjs
โโโ ๐ folderStructure.mjs
โโโ ๐ independentModules.mjs
โโโ ๐ eslint.config.mjs
โโโ ๐ src
โโโ ๐ examples // Private
โโโ ๐ hooks
โ โโโ ...
โ โโโ ๐ useSimpleGlobalHook.test.ts // Private.
โ โโโ ๐ useSimpleGlobalHook.ts // Public.
โ โโโ ๐ useComplexGlobalHook // useComplexGlobalHook family.
โ โโโ ๐ hooks (recursion) // Private / Public for useComplexGlobalHook family.
โ โโโ ๐ useComplexGlobalHook.api.ts // Private / Public for useComplexGlobalHook family.
โ โโโ ๐ useComplexGlobalHook.types.ts // Private / Public for useComplexGlobalHook family.
โ โโโ ๐ useComplexGlobalHook.consts.ts // Private / Public for useComplexGlobalHook family.
โ โโโ ๐ useComplexGlobalHook.test.ts // Private.
โ โโโ ๐ useComplexGlobalHook.ts // Public.
โโโ ๐ features
โโโ ...
โโโ ๐ Feature3.test.tsx // Private.
โโโ ๐ Feature3.tsx // Public.
โโโ ๐ Feature2 // Feature2 family. Same structure as Feature1.
โโโ ๐ Feature1 // Feature1 family.
โโโ ๐ feature1.api.ts // Private / Public for Feature1 family.
โโโ ๐ feature1.types.ts // Private / Public for Feature1 family.
โโโ ๐ feature1.consts.ts // Private / Public for Feature1 family.
โโโ ๐ Feature1.test.tsx // Private.
โโโ ๐ Feature1.tsx // Public.
โโโ ๐ components
โ โโโ ...
โ โโโ ๐ SimpleComponent.test.tsx // Private.
โ โโโ ๐ SimpleComponent.tsx // Private / Public for Feature1 family / Public for ComplexComponent family.
โ โโโ ๐ ComplexComponent // ComplexComponent family.
โ โโโ ๐ components (recursion) // Private / Public for ComplexComponent family.
โ โโโ ๐ hooks (recursion) // Private / Public for ComplexComponent family.
โ โโโ ๐ complexComponent.api.ts // Private / Public for ComplexComponent family.
โ โโโ ๐ complexComponent.types.ts // Private / Public for ComplexComponent family.
โ โโโ ๐ complexComponent.consts.ts // Private / Public for ComplexComponent family.
โ โโโ ๐ ComplexComponent.test.tsx // Private.
โ โโโ ๐ ComplexComponent.tsx // Private / Public for ComplexComponent family / Public for Feature1 family / Public for SimpleComponent.tsx.
โโโ ๐ hooks
โโโ ...
โโโ ๐ useSimpleHook.test.ts // Private.
โโโ ๐ useSimpleHook.ts // Private / Public for Feature1 family / Public for useComplexHook family.
โโโ ๐ useComplexHook // useComplexHook family.
โโโ ๐ hooks (recursion) // Private / Public for useComplexHook family.
โโโ ๐ useComplexHook.api.ts // Private / Public for useComplexHook family.
โโโ ๐ useComplexHook.types.ts // Private / Public for useComplexHook family.
โโโ ๐ useComplexHook.consts.ts // Private / Public for useComplexHook family.
โโโ ๐ useComplexHook.test.ts // Private.
โโโ ๐ useComplexHook.ts // Private / Public for useComplexHook family / Public for Feature1 family / Public for useSimpleHook.tsx.
A big thank you to all the sponsors for your support! You give me the strength and motivation to keep going!
Thanks to you, I can help others create their ideal projects!