{"id":17115779,"url":"https://github.com/denisraslov/folderslint","last_synced_at":"2025-04-05T21:09:43.193Z","repository":{"id":40771203,"uuid":"260889385","full_name":"denisraslov/folderslint","owner":"denisraslov","description":"📁  Directory structure linter for Front-End projects","archived":false,"fork":false,"pushed_at":"2023-01-06T04:54:29.000Z","size":650,"stargazers_count":187,"open_issues_count":6,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T19:08:39.962Z","etag":null,"topics":["directory-tree","folder-structure","javascript","lint","linter","nodejs","project-structure"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denisraslov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-03T10:59:29.000Z","updated_at":"2025-02-08T03:53:04.000Z","dependencies_parsed_at":"2023-02-05T09:02:21.830Z","dependency_job_id":null,"html_url":"https://github.com/denisraslov/folderslint","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisraslov%2Ffolderslint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisraslov%2Ffolderslint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisraslov%2Ffolderslint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisraslov%2Ffolderslint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denisraslov","download_url":"https://codeload.github.com/denisraslov/folderslint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399879,"owners_count":20932880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directory-tree","folder-structure","javascript","lint","linter","nodejs","project-structure"],"created_at":"2024-10-14T17:46:43.556Z","updated_at":"2025-04-05T21:09:43.166Z","avatar_url":"https://github.com/denisraslov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# FoldersLint \u003cimg src=\"https://ph-files.imgix.net/ca08c2f9-856e-4995-b500-85935be555e7.png\" alt=\"FoldersLint logo\" width=\"90\" height=\"90\" align=\"right\" /\u003e\n\nDirectory structure linter for Front-End projects\n\n\u003cimg src=\"https://thumbnails.visme.co/c0/e6/f2/83/08271a1cdafd2c288d7f2ec677dda7b7.png\" alt=\"FoldersLint in action\" title=\"FoldersLint in action\" height=\"390\" style=\"margin-left: -200px;\"\u003e\n\n✅ \u0026nbsp;\u0026nbsp;Easily configured with simple rules in a single file\n\n✅ \u0026nbsp;\u0026nbsp;Incredibly fast\n\n✅ \u0026nbsp;\u0026nbsp;Support for Windows, MacOS and Linux\n\n✅ \u0026nbsp;\u0026nbsp;Can be used with [lint-staged](https://github.com/okonet/lint-staged)\n\n## Why\n\n*Make you project sctructure pretty by linting it* 🗂\n\nDirectory structure rules are important part of any project. These rules help to raise clarity of the project and reduce its complexity. Having a clearly defined structure make developers always know where to put files and where to find them. If the project is big enough, it is necessary to avoid chaos in it.\n\n`folderslint` let you configure directory structure rules and check if existed or new files fit these rules.\n\n## Quick Overview\n\nInstall `folderslint` globally:\n\n```sh\nnpm install -g folderslint\n```\n\nSetup a config file `.folderslintrc` in the root of the project.\n\nRun `folderslint` to check the whole project or a directory (i.e. `/components`):\n\n```sh\nfolderslint components\n```\n\n## Configuration\n`folderslint` needs configuration file named `.folderslintrc` in the root of the project.\n\nThe example of the config:\n\n```js\n{\n  \"root\": \"src\", // optional\n  \"rules\": [\n    \"components/*\",\n    \"pages/components/*/utils\",\n    \"hooks\",\n    \"legacy/**\"\n   ]\n}\n```\n\n`root` is the directory the structure of which should be checked.\n\n`rules` is an array of rules which define permitted directory paths.\n\n### Root directory\n\nYou have to specify `root` if you want to check structure in a specific directory. Directories which are out of the `root` will not be checked.\nIf you want all the directories of the project to be checked, you don't need to specify `root`.\n\n### Rules syntax\n\nThere are 3 ways to specify a rule:\n- the exact path of a directory,\n- `*` instead of a directory name if any directory accepted on that level,\n- `**` **at the end of a rule** instead of a directory name if any directory accepted on any lower level. \n\n⚠️ `**` **can be used only at the end of a rule** because it doesn't make sense to use it at the middle of a rule. It would make any number of nested directories in the middle of a path accepted which gives too much flexibility for the idea of clearly defined directory structure rules.\n\nFor example:\n\nRule | Meaning\n--- | --- \n`hooks` | ✅\u0026nbsp;\u0026nbsp;The directory `hooks` (and files in it) is accepted.\u003cbr/\u003e ❌\u0026nbsp;\u0026nbsp;Any nested directory is not accepted.\n`components/*` | ✅\u0026nbsp;\u0026nbsp;The directory `components` is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;Any *first level* nested directory is accepted.\u003cbr/\u003e ❌\u0026nbsp;\u0026nbsp;Any *second level* nested directory is not accepted. \n`components/*/utils` | ✅\u0026nbsp;\u0026nbsp;The directory `components` is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;Any *first level* nested directory is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;The *second level* nested directory `utils` is accepted.\u003cbr/\u003e ❌\u0026nbsp;\u0026nbsp;Any other *second level* nested directory is not accepted.\n`legacy/**` | ✅\u0026nbsp;\u0026nbsp;The directory `legacy` is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;Any nested directory on *any level* is accepted.\n`components/*/legacy/**` | ✅\u0026nbsp;\u0026nbsp;The directory `components` is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;Any *first level* nested directory is accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;The *second level* nested directory `legacy` is accepted.\u003cbr/\u003e ❌\u0026nbsp;\u0026nbsp;Any other *second level* nested directory is not accepted.\u003cbr/\u003e ✅\u0026nbsp;\u0026nbsp;Any nested directory on *any level* inside of *legacy* directory is accepted.\n\n⚠️ A rule like `components/*/utils` automatically make the `components` and `components/*` rules work. So, no need to specify a rule for every level directory. You need to specify the deepest path.\n\n⚠️ It's not recommended to overuse `**` pattern. It lets absence of structure to sprout in your project. Still it could be useful for some directories which have messy structure by its nature - i.e. `node_modules`, not maintained legacy directories.\n\n## Usage with [lint-staged](https://github.com/okonet/lint-staged)\nIt is handy to use `folderslint` together with `lint-staged`. In this case `folderslint` checks only the files which were modified for a commit.\n\nFor that, add `folderslint` to the `lint-staged` section of your `package.json`.\n\nFor example, this is how `package.json` can look like if you want to run `folderslint` as a pre-commit hook via [husky](https://github.com/typicode/husky) tool:\n\n```json\n\"husky\": {\n  \"hooks\": {\n    \"pre-commit\": \"lint-staged\",\n  }\n},\n\"lint-staged\": {\n  \"*.{js,ts,tsx}\": [\n    \"folderslint\"\n  ]\n}\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisraslov%2Ffolderslint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenisraslov%2Ffolderslint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisraslov%2Ffolderslint/lists"}