{"id":16383849,"url":"https://github.com/jakesidsmith/antler","last_synced_at":"2026-03-11T04:31:11.003Z","repository":{"id":57180766,"uuid":"149604315","full_name":"JakeSidSmith/antler","owner":"JakeSidSmith","description":"Directory structure linter","archived":false,"fork":false,"pushed_at":"2022-09-30T14:10:50.000Z","size":404,"stargazers_count":5,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T04:09:57.716Z","etag":null,"topics":["directories","directory","files","folder","folders","linter","linting","structure"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/antler","language":"TypeScript","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/JakeSidSmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-20T12:15:49.000Z","updated_at":"2023-02-12T11:02:19.000Z","dependencies_parsed_at":"2023-01-18T20:15:10.580Z","dependency_job_id":null,"html_url":"https://github.com/JakeSidSmith/antler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeSidSmith%2Fantler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeSidSmith%2Fantler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeSidSmith%2Fantler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeSidSmith%2Fantler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JakeSidSmith","download_url":"https://codeload.github.com/JakeSidSmith/antler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221844211,"owners_count":16890447,"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":["directories","directory","files","folder","folders","linter","linting","structure"],"created_at":"2024-10-11T04:09:50.093Z","updated_at":"2026-03-11T04:31:10.838Z","avatar_url":"https://github.com/JakeSidSmith.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antler\n\n[![CircleCI](https://circleci.com/gh/JakeSidSmith/antler/tree/master.svg?style=svg)](https://circleci.com/gh/JakeSidSmith/antler/tree/master)\n\n**Directory structure linter**\n\n## About\n\nAntler allows you to configure linting rules to enforce the structure of your project directories and files.\n\n## Installation\n\nInstall with NPM:\n\n```shell\nnpm i antler -S\n```\n\nNote: `-S` is shorthand for `--save` to automatically add this to your package.json\n\nIf you are using a version of NPM that doesn't support package lock files I'd recommend using `-SE` or `--save-exact`, which will pin the version in your package.json.\n\n## Usage\n\nCurrently Antler only supports supplying a root directory to lint from, but I intend to allow multiple root directories in the future.\n\n```shell\nantler \u003cdirectory\u003e\n```\n\nIf no directory is supplied Antler won't run. If you'd like to lint the current directory you can supply `.` or `./`, as you like.\n\nNote: there are no rules configured by default. You will have to configure your own `.antlerrc.json` config file as explained below.\n\n## Configuration\n\nAll Antler configuration is stored in an `.antlerrc.json` file. Antler will look in the target directory, and all of its parent directories until it finds a file named `.antlerrc.json`.\n\nThe basic structure of a config file is as follows:\n\n```json\n{\n  \"rules\": {\n    \"RuleName\": \"warning\",\n    \"AnotherRule\": {\n      \"level\": \"error\",\n      \"options\": {\n        \"allow\": \"^my-file$\",\n        \"disallow\": [\"nope\", \"bad\"]\n      }\n    }\n  }\n}\n```\n\nEach rule can be provided with either a string representing the error level (`off`, `warning`, or `error`), or an object with a level key.\n\nSome rules allow (or require) the user to provide additional options as an object in the `options` key.\n\nOptions are (at the time of writing) always strings, or arrays of strings.\n\nSee the example `.antlerrc.json` file in the root of this project for a more complex example.\n\n## Rules\n\n### NoLonelyIndex\n\nEnsures that no directories contain only a single index file e.g. `index.js`, or `index.html`.\n\n```json\n{\n  \"NoLonelyIndex\": \"error\"\n}\n```\n\n#### Acceptable\n\n```\nfoo/\n  cli.js\n  index.js\n\nfoo/\n  index/\n    file.js\n```\n\n#### Unacceptable\n\n```\nfoo/\n  index.js\n```\n\n### NoJuniors\n\nEnsures that no files, or directories share a name with their parent directory.\n\n```json\n{\n  \"NoJuniors\": \"error\"\n}\n```\n\n#### Acceptable\n\n```\nfoo/\n  bar.js\n```\n\n#### Unacceptable\n\n```\nfoo/\n  foo.js\n\nfoo/\n  foo/\n```\n\n### NoEmptyDirectory\n\nEnsures that there are no empty directories.\n\n```json\n{\n  \"NoEmptyDirectory\": \"error\"\n}\n```\n\n#### Acceptable\n\n```\nfoo/\n  bar/\n    baz.js\n\nfoo/\n  bar.js\n```\n\n#### Unacceptable\n\n```\nfoo/\n  bar/\n\nfoo/\n```\n\n### FileName\n\nAllows the user to define allowed and disallowed patterns to match all file names against.\n\nThe patterns provided are converted to case sensitive regular expressions, and should be prefixed with `^` (start of string) and suffixed with `$` (end of string), if you want to ensure that the whole string matches your pattern, and not just a section of it.\n\nThe options; `allow` and `disallow`, can be either a string, or array of strings.\n\n```json\n{\n  \"FileName\": {\n    \"level\": \"error\",\n    \"options\": {\n      \"allow\": \"\",\n      \"disallow\": \"\"\n    }\n  }\n}\n```\n\n### DirectoryName\n\nAllows the user to define allowed and disallowed patterns to match all directory names against.\n\nThe patterns provided are converted to case sensitive regular expressions, and should be prefixed with `^` (start of string) and suffixed with `$` (end of string), if you want to ensure that the whole string matches your pattern, and not just a section of it.\n\nThe options; `allow` and `disallow`, can be either a string, or array of strings.\n\n```json\n{\n  \"DirectoryName\": {\n    \"level\": \"error\",\n    \"options\": {\n      \"allow\": \"\",\n      \"disallow\": \"\"\n    }\n  }\n}\n```\n\n### Extension\n\nAllows the user to define allowed and disallowed patterns to match all file extensions against. The extensions are extracted using Node's `path.extname`, and so will include only the last period and following characters e.g.\n\nAll of the following files will be tested against `.ts`:\n\n```\nindex.ts\nindex.d.ts\nindex.min.ts\n```\n\nIf you want to enforce checking of the `.min.ts` section, you should use the [FileName](#filename) rule.\n\nThe patterns provided are converted to case sensitive regular expressions, and should be prefixed with `^` (start of string) and suffixed with `$` (end of string), if you want to ensure that the whole string matches your pattern, and not just a section of it.\n\nThe options; `allow` and `disallow`, can be either a string, or array of strings.\n\n```json\n{\n  \"Extension\": {\n    \"level\": \"error\",\n    \"options\": {\n      \"allow\": \"\",\n      \"disallow\": \"\"\n    }\n  }\n}\n```\n\n### Path\n\nAllows the user to define allowed and disallowed patterns to match all paths against. The paths will include the root directory that you specified in the command e.g.\n\nIf you run:\n\n```shell\nantler src/\n```\n\nAgainst the structure:\n\n```\nsrc/\n  foo/\n    bar.js\n```\n\nThe paths that are checked will be:\n\n```\nsrc/\nsrc/foo/\nsrc/foo/bar.js\n```\n\nThe patterns provided are converted to case sensitive regular expressions, and should be prefixed with `^` (start of string) and suffixed with `$` (end of string), if you want to ensure that the whole string matches your pattern, and not just a section of it.\n\nThe options; `allow` and `disallow`, can be either a string, or array of strings.\n\n```json\n{\n  \"Path\": {\n    \"level\": \"error\",\n    \"options\": {\n      \"allow\": \"\",\n      \"disallow\": \"\"\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakesidsmith%2Fantler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakesidsmith%2Fantler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakesidsmith%2Fantler/lists"}