folderslint icon indicating copy to clipboard operation
folderslint copied to clipboard

Ability to force only folders creation

Open soullivaneuh opened this issue 1 year ago β€’ 4 comments

Summary

I have a stages directory. I want each first level element of the stages directory to be and only be folders.

Is that possible to achieve that using your tool?

Example of incorrect structure

stages/
stages/foo/README.md
stages/foo/index.js
stages/bar/README.md
stages/bar/index.js

Example of correct structure

stages/
stages/foo/README.md
stages/foo/index.js
stages/bar.js

soullivaneuh avatar Aug 31 '23 10:08 soullivaneuh

As an alternative, you can use eslint-plugin-project-structure

project-structure-folder-structure

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 nest a given folder structure recursively. βœ… Fewer repetitions and precise error messages, even for deeply nested folders (recursion), by representing the folder structure as a tree.

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.

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). βœ… 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.

project-structure-naming-rules

Enforce complex naming rules.

Features:

βœ… Naming validation. βœ… Supported name types: Classes, types, interfaces, enums, variables, functions, arrow function. βœ… Naming rules only for name types located in the root of the file (not nested). βœ… Naming rules only for exported name types. βœ… Inheriting the filename as the name. Option of adding your own prefixes/suffixes, changing the case or deleting parts of a filename. βœ… Enforcing a maximum of one main function/class per file. βœ… Different name rules for different files. βœ… Regex validation βœ… Build in case validation. βœ… An option to create a separate configuration file with TypeScript support.

Igorkowalski94 avatar Sep 04 '23 20:09 Igorkowalski94

@soullivaneuh @Igorkowalski94 I apologize for not noticing this. My day job generates a lot of GitHub notification noise and I must have thought this was part of that.

If I understand the question correctly I believe the answer is yes, but I might be misreading it since the wording and example seem contradictory to me.

I apologize for being confused and will make further effort to understand it and look for edge cases as soon as I can balance it with my family life. Thank you for the interest.

This package shouldn’t require a lot of maintenance and seems to just work and have test coverage. But I’m here for maintenance as needed.

mattferrin avatar Sep 04 '23 21:09 mattferrin

Sorry, I thought no one was looking after this package anymore.

Igorkowalski94 avatar Sep 04 '23 21:09 Igorkowalski94

@soullivaneuh @Igorkowalski94 actually, I’m just a confused person that has a competing package that’s named very similar. My fault for misreading and trying to respond quickly during family time.

mattferrin avatar Sep 04 '23 21:09 mattferrin