{"id":13821964,"url":"https://github.com/PaulRosset/linter-farch","last_synced_at":"2025-05-16T15:32:00.175Z","repository":{"id":57290263,"uuid":"130246875","full_name":"PaulRosset/linter-farch","owner":"PaulRosset","description":"Make sure the filenames stay the same, control them! 👁 ","archived":false,"fork":false,"pushed_at":"2018-07-02T21:51:35.000Z","size":333,"stargazers_count":103,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-10T23:58:58.347Z","etag":null,"topics":["architecture","cli","filename","linter"],"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/PaulRosset.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":"2018-04-19T16:59:00.000Z","updated_at":"2023-04-30T14:40:02.000Z","dependencies_parsed_at":"2022-08-24T22:11:45.629Z","dependency_job_id":null,"html_url":"https://github.com/PaulRosset/linter-farch","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/PaulRosset%2Flinter-farch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Flinter-farch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Flinter-farch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Flinter-farch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulRosset","download_url":"https://codeload.github.com/PaulRosset/linter-farch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213893315,"owners_count":15653524,"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":["architecture","cli","filename","linter"],"created_at":"2024-08-04T08:01:36.038Z","updated_at":"2024-08-04T08:07:22.494Z","avatar_url":"https://github.com/PaulRosset.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cimg width=\"320\" src=\"media/logo.png\" alt=\"farch\"\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\u003c/h1\u003e\n\n\u003e Make sure the file-names stay the same, control them! 👁\n\n[![Travis CI Build Status](https://travis-ci.org/PaulRosset/linter-farch.svg?branch=master)](https://travis-ci.org/PaulRosset/linter-farch)\n[![npm version](https://badge.fury.io/js/linter-farch.svg)](https://badge.fury.io/js/linter-farch)\n[![Code Coverage](https://img.shields.io/codecov/c/github/PaulRosset/linter-farch.svg)](https://travis-ci.org/PaulRosset/linter-farch)\n\n## Motivation\n\nMore and more frameworks that have been created recently gave the possibility to the user to write content in markdown, like [Gatsby](https://github.com/gatsbyjs/gatsby) or [Docusaurus](https://github.com/facebook/docusaurus), but sometimes if you collaborate with multiples people on these markdown files, keeping a clean file-name is more important than ever. That's why I created this tiny linter to force people to respect a file-name architecture in order the keep everything clean and understandable.  \nOf course, many other usages can be considered.\n\n## Install\n\n```sh\nyarn add --dev linter-farch\n```\n\n## Usage\n\nOnce installed, a small and quick configuration is needed in the `package.json` file.  \nThe `package.json` file is used here, to avoid creating another file with a purpose of configuration.\n\n### Configuration:\n\nFor the configuration, two possibles way can be taken, the first is the `package.json` file like below (essentially for the JS project and if you don't want to create another config file):\n\nIn the `package.json` file:\n\n```json\n{\n  \"farch\": {\n    \"src\": \"([a-z]*-[0-9]{4})[.]*[a-z]*\",\n    \"src/utilities\": \"[a-z]*\",\n    \"src/utilities/*.js\": \"[a-z]\"\n  }\n}\n```\n\n\u003e You can use [`glob`](http://man7.org/linux/man-pages/man3/glob.3.html) as key/path to provide more flexibility to capture the wanted files.\n\n* Creating regex can be hard or simply boring, that's why you can simply put template placeholder like this:\n\n```json\n{\n  \"farch\": {\n    \"src\": \"([a-z]*-[0-9]{4})[.]*[a-z]*\",\n    \"src/utilities\": [\"LOWER_CAMEL_CASE_JS\", \"[a-z]*\"],\n    \"src/utilities/*.js\": \"[a-z]\"\n  }\n}\n```\n\nYou can find any template placeholder already created [here](https://github.com/PaulRosset/linter-farch/blob/master/src/template.js), feel free to contribute by adding more template/placeholder regex. The keys have to be of the following form: \"XXX*XXX_XXX_YY\", where \\_XXX* is the name and _YY_ the extension of the file that we want to test.\n\n---\n\nBut, there is still the possibility to create a `farch.json` config file at the root of the project, essentially for the non-js project or if you don't want to put the configuration in your `package.json`.\n\n```json\n{\n  \"farch\": {\n    \"src\": \"([a-z]*-[0-9]{4})[.]*[a-z]*\",\n    \"src/utilities\": \"[a-z]*\"\n  }\n}\n```\n\n\u003e `farch.json` file have the priority over the `package.json` file.\n\nInside the `farch` property, insert the directory that you want to test:  \nPass as `key`, the path from the root directory to the target directory, then in value pass `regex` to match.\n\n**Then, you are all set!**\n\n### Execution\n\nTo avoid creating tons of rules if you have a lot of directory nested and they apply to the same assertion you can pass `-R`, hence it will recursively check all the directory.\n\nAt the root of your project:\n\n```sh\nnpx farch\n```\n\nor\n\nInsert it in your `package.json` file:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"farch ((-R))\"\n  }\n}\n```\n\n**And run `CI` on it !**\n\n### Output\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"media/demo1.png\" width=\"320\" alt=\"output-farch\"/\u003e\n\u003c/div\u003e\n\n## License\n\nMIT Paul Rosset\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRosset%2Flinter-farch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPaulRosset%2Flinter-farch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRosset%2Flinter-farch/lists"}