๐ฎPlayground for eslint-plugin-project-structure.
The project uses ESLint's new config system as default. If you want to test on the old eslint config, follow these steps:
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.
features
folder have all possible correct imports. You can try importing other files to see the errors.examples
folder..const.ts
files must follow {SNAKE_CASE}
..consts.ts
files may only contain variables..types.ts
files must follow {PascalCase}
..types.ts
files must follow {SNAKE_CASE}
..types.ts
files may only contain interfaces, types and enums..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
..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
..ts
and .tsx
files must follow {camelCase}
..types.ts
files can only import from node_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.