{"id":14007055,"url":"https://github.com/mausworks/tidier","last_synced_at":"2025-04-24T05:32:46.233Z","repository":{"id":42174081,"uuid":"389380983","full_name":"mausworks/tidier","owner":"mausworks","description":"The file \u0026 folder name formatter","archived":false,"fork":false,"pushed_at":"2022-04-11T20:11:12.000Z","size":963,"stargazers_count":201,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T16:13:25.336Z","etag":null,"topics":["cli","formatter","linter","productivity","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mausworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-25T15:34:16.000Z","updated_at":"2024-09-23T20:07:20.000Z","dependencies_parsed_at":"2022-08-12T08:40:41.556Z","dependency_job_id":null,"html_url":"https://github.com/mausworks/tidier","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mausworks%2Ftidier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mausworks%2Ftidier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mausworks%2Ftidier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mausworks%2Ftidier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mausworks","download_url":"https://codeload.github.com/mausworks/tidier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250572638,"owners_count":21452334,"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":["cli","formatter","linter","productivity","vscode-extension"],"created_at":"2024-08-10T10:01:47.610Z","updated_at":"2025-04-24T05:32:46.216Z","avatar_url":"https://github.com/mausworks.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n![tidier-day](https://user-images.githubusercontent.com/8259221/162104589-ab22ecd7-cc6f-4886-bcf0-cf897ef427e3.png#gh-light-mode-only)\n![tidier-night](https://user-images.githubusercontent.com/8259221/162104591-325e0c1a-52fd-4369-a992-809dea865df4.png#gh-dark-mode-only)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![tidier version](https://img.shields.io/npm/v/tidier?logo=npm\u0026label=tidier)](https://www.npmjs.com/package/tidier)\u0026nbsp;\n[![tidier-core version](https://img.shields.io/npm/v/tidier-core?logo=npm\u0026label=tidier-core)](https://www.npmjs.com/package/tidier-core)\u0026nbsp;\n[![Release status](https://img.shields.io/github/workflow/status/mausworks/tidier/release?event=push\u0026logoColor=ffffff\u0026logo=github-actions\u0026label=Release)](https://github.com/mausworks/tidier/actions/workflows/release.yml)\u0026nbsp;\n[![Test status](https://img.shields.io/github/workflow/status/mausworks/tidier/release?event=push\u0026logoColor=ffffff\u0026logo=github-actions\u0026label=Tests)](https://github.com/mausworks/tidier/actions/workflows/test.yml)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n_Tidier allows you to configure file \u0026 folder name conventions,\nand actively helps you follow them!_\n\n\u003c/div\u003e\n\nhttps://user-images.githubusercontent.com/8259221/162093220-ec9e15e4-b59c-4f07-b643-5709389ffb9d.mp4\n\n## Installation\n\nInstalling the [VSCode extension](https://marketplace.visualstudio.com/items?itemName=mausworks.tidier-vscode):\n\n```plaintext\next install mausworks.tidier-vscode\n```\n\nInstalling the CLI:\n\n```shellscript\nyarn add --dev tidier\n```\n\nRun the CLI with npx:\n\n```shellscript\nnpx tidier --help\n```\n\n## Usage\n\nTo start using Tidier, create a `.tidierrc` to the root of your project.\nThis is where you will configure your file \u0026 folder name conventions.\nBy default, Tidier will ignore files specified in your project's `.gitignore`,\nbut you can add additional patterns in the \"ignore\"-section in the configuration file if need be.\n\nThe example configuration below uses common React conventions,\nbut it can be adapted to work with any project of any framework or language.\n\n```json\n{\n  \"ignore\": [ \"**/build\" ],\n  \"files\": {\n    \"**/src/(setupTests|reportWebVitals).*\": \"camelCase\",\n    \"**/src/**/index.*\": \"camelCase\",\n    \"**/src/**/*.{tsx,jsx,css,scss,sass}\": \"PascalCase.kebab-case\",\n    \"**/(README|LICENSE)*\": \"UPPER CASE.lc\",\n    \"**/*\": \"kebab-case\"\n  },\n  \"folders\": {\n    \"**/*\": \"kebab-case\"\n  }\n}\n```\n\nThe configuration consists two sets of naming conventions: one for files, and one for folders.\nEach convention consists of a glob, and a _name format_.\n\nGlobs are always matched from the location of the configuration file. \nThe first glob that matches gets priority, so conventions with higher specificity should be declared at the top.\n\n## Tidier \u0026 names\n\nTidier conceptualizes each file or folder name as a sequence of _fragments_ delimited by the `.` (period) character.\n\n\u003cdiv align=\"center\"\u003e\n\n![tidier-name-taxonomy-filename](https://user-images.githubusercontent.com/8259221/162204030-90f0f90a-40cc-451e-b958-9978c746566a.png)\n\n\u003c/div\u003e\n\nThe file named `FileBrowser.spec.tsx` consists of three fragments: `FileBrowser`, `spec` and `tsx`.\nIf a name consists of more than one fragment, Tidier will consider the last one \nto be the sole _extension fragment_. Note: This also applies to folders.\n\n### Name formats\n\nThe name format is the part of the convention that decides _how_ a name should be formatted.\nLike with file \u0026 folder names, Tidier also conceptualizes them as a sequence of fragments: `PascalCase.kebab-case.lc`.\nThe idea is that the name format structure should appear similar to a desired name of a file: `FileBrowser.spec.tsx`.\n\n\u003cdiv align=\"center\"\u003e\n\n![tidier-name-taxonomy-name-format](https://user-images.githubusercontent.com/8259221/162204028-4b426e6a-0a4d-46a5-9cef-e21590d51719.png)\n\n\u003c/div\u003e\n\nTo better understand the mechanics of how Tidier reformats names, let's start with a basic example:\nUsing the general casing `UPPER CASE` denotes that upper case\nmust be used for _all fragments_ of the file or folder name—including the extension.\n\n```\nUPPER CASE -\u003e README.MD\n```\n\nTo change the extension to use lower case instead, specify `UPPER CASE.lc` as the name format. \nTwo character casings such as `lc` are _extension casings_ (lc = \"lower case\"),\nand in contrast to the general casings, they are only ever applied to the _extension fragment_.\n\nThe extension casing can only be used _once_ within the name format,\nand it always has to be the last fragment.\n\n```\nUPPER CASE.lc -\u003e README.md\n```\n\nUsing the _general casing_ `lower case` has a similar effect,\nbut in this case all subsequent fragments of the first will be in lower case, including the extension.\n\n```\nUPPER CASE.lower case \n-\u003e README.md, \n-\u003e SOME.longer.file.name.txt\n```\n\n### Border characters\n\nTidier will ignore leading and trailing border characters for each fragment, these are: `_`, `[`, `]`, `(` and `)`.\nThis means that if you have a folders such as `__mocks__`  or `__test__`, or a file named `[id].tsx`,\nTidier is simply going to ignore these characters, and format what's in between them.\n\nHowever: Including these characters in the middle of a fragment (and not at the boundaries),\nthey might be removed or replaced depending on the casing specified in the name format.\n\n### Supported Casings\n\nThe table below lists all the fragment casings which are supported by Tidier.\nUnless specified in a comment, Tidier uses recasing functions from [change-case](https://github.com/blakeembrey/change-case).\n\n| Name \u0026 Aliases                                      | Comment                                               |\n|-----------------------------------------------------|-------------------------------------------------------|\n| `preserve`                                          | Tidier will make no attempt to re-format the fragment |\n| `lower case`                                        | Calls `toLowerCase()` for the fragment                |\n| `UPPER CASE`                                        | Calls `toUpperCase()` for the fragment                |\n| `Title Case`                                        |                                                       |\n| `camelCase`                                         |                                                       |\n| `PascalCase`, `UpperCamelCase`                      |                                                       |\n| `kebab-case`, `dash-case`, `lower-header-case`      |                                                       |\n| `COBOL-CASE`, `UPPER-KEBAB-CASE`, `UPPER-DASH-CASE` |                                                       |\n| `Train-Case`, `Header-Case`                         |                                                       |\n| `snake_case`                                        |                                                       |\n| `Snake_Title_Case`                                  |                                                       |\n| `UPPER_SNAKE_CASE`                                  |                                                       |\n| `p`                                                 | Extension casing for `preserve`                       |\n| `lc`                                                | Extension casing for `lower case`                     |\n| `UC`                                                | Extension casing for `upper case`                     |\n| `Tc`                                                | Extension casing for `Title Case`                     |\n| `sPoNGEcAsE`                                        | _When your naming convention is chaos_                |\n\n# Glossary\n\nFor convenience and consistency; the most noteworthy concepts and their meanings within Tidier are defined below:\n\n- **Fragment** — Part of a file name, delimited by the period character (`.`).\n- **Extension fragment** — The last fragment of a file or folder name.\n- **Name convention** — Defines which name format should apply to which files or folders.\n- **Name format** — A sequence of casings, delimited by the period character (`.`).\n- **General casing** — A casing which may be used to format to any fragment of a name; including the extension.\n- **Extension casing** — A casing which appears at the end of a name format and exclusively formats the extension fragment.\n- **Project** — A set of files folder for which the conventions specified in the configuration applies.\n- **Configuration** — Refers to the `.tidierrc` file, and denotes the root of a project.\n- **Ignorefile** — A file which specifies files and folders to ignore within a project, e.g: `.gitignore`.\n- **Recase** — The mechanism of changing the casing of a file or folder name.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmausworks%2Ftidier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmausworks%2Ftidier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmausworks%2Ftidier/lists"}