{"id":15776351,"url":"https://github.com/jackdevau/flinter","last_synced_at":"2025-05-07T02:05:13.576Z","repository":{"id":52953744,"uuid":"518636086","full_name":"JackDevAU/Flinter","owner":"JackDevAU","description":"A frontmatter linter for markdown files with custom lint rules!","archived":false,"fork":false,"pushed_at":"2022-09-09T02:36:15.000Z","size":1207,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T02:05:09.663Z","etag":null,"topics":["frontmatter","github-action","lint","linter","linting","markdown"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JackDevAU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-27T23:11:31.000Z","updated_at":"2022-08-25T04:53:45.000Z","dependencies_parsed_at":"2023-01-11T17:23:15.142Z","dependency_job_id":null,"html_url":"https://github.com/JackDevAU/Flinter","commit_stats":{"total_commits":13,"total_committers":3,"mean_commits":4.333333333333333,"dds":0.5384615384615384,"last_synced_commit":"e1b7e26a865266d7cacb0ecf92fcd7e4c83b574d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackDevAU%2FFlinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackDevAU%2FFlinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackDevAU%2FFlinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackDevAU%2FFlinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackDevAU","download_url":"https://codeload.github.com/JackDevAU/Flinter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252798855,"owners_count":21805887,"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":["frontmatter","github-action","lint","linter","linting","markdown"],"created_at":"2024-10-04T17:20:52.123Z","updated_at":"2025-05-07T02:05:13.550Z","avatar_url":"https://github.com/JackDevAU.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flinter\n\nA GitHub Action that lints the frontmatter of markdown files. Write your own rules in `js` or just stick with the defaults for a quick and easy solution. \n\n## Build locally\n\n1. Install packages\n\n```bash\nyarn install\n```\n\n2. Build with ncc\n\n```bash\nyarn build\n```\n\nCurrently, as this is built using TS we need to run `yarn build` before pushing.\n\n## Getting Started\n\nTo use this GitHub action, you'll need to create a `.flinter/config.json` file. See the below table for information. (Scroll a bit further for an example `config.json`)\n\n### Defaults\n\nPut these fields inside a `defaults` section\n\n| Field                    | Type           | Required | Information                                                                                                                                     |\n| ------------------------ | -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `markdownFileExtensions` | Array          | ✅       | A list of markdown file extensions to lint against                                                                                              |\n| `frontmatter`            | Array\u003cObjects\u003e | ✅       | A list of all fields to lint. If you add `directories` these fields won't be checked. See below for more information on the frontmatter object. |                                                                                                                     |\n| `directories`            | Array          | ❌       | If you have a specific directories where you only want to lint against those specific markdown files.                                           |\n\n### Frontmatter Object\n\n| Field      | Type    | Required | Information                                        |\n| ---------- | ------- | -------- | -------------------------------------------------- |\n| `field`    | String  | ✅       | The name of the frontmatter field to lint          |\n| `required` | Boolean | ❌       | If true, will return an error if the value is null |\n| `type`     | String  | ❌       | TODO: Implement basic type checking                |\n| `rule`     | String  | ❌       | name of the custom rule to run. e.g. \"custom.js\"   |\n\n### Writing custom rules\n\nTo write custom rules.\n\n1. Create a new folder `./flinter/linters/`\n1. Create a `.js` file and export an async function called `run`. See the template below.\n1. Return a FlinterResult [Boolean,String]\n1. Add the file name to the Frontmatter field's `rule`.\n\n```js\n// This must return a boolean value.\n\n/**\n * @param {{field: string, value?: string}} params\n * @returns {{result: boolean, error?: string}}\n */\nexport async function run(params) {\n  return {\n    result: true,\n  };\n}\n```\n\n### Example Config.json\n\n```json\n{\n  \"defaults\": {\n    \"markdownFileExtensions\": [\"md\", \"mdx\"],\n    \"frontmatter\": [\n      {\n        \"field\": \"title\",\n        \"type\": \"text\",\n        \"required\": true\n      }\n    ]\n  },\n  \"rules\": {\n    \"frontmatter\": [\n      {\n        \"field\": \"title\",\n        \"type\": \"text\",\n        \"required\": true,\n        \"rule\": \"title.js\"\n      },\n      {\n        \"field\": \"authors\",\n        \"type\": \"object\",\n        \"rule\": \"authors.js\"\n      }\n    ]\n  }\n}\n```\n\n\u003e **Note**  \n\u003e To enable debug logging, set `DEBUG` to `true` where the Flinter action is used  \n\u003e e.g.\n\u003e ```yml\n\u003e     steps:\n\u003e       - name: Flinter.md\n\u003e         uses: JackDevAU/Flinter@Alpha-v0.0.1\n\u003e         with:\n\u003e           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\u003e           DEBUG: true\n\u003e ```\n\n## Acknowledgements\n\nThis builds on from the awesome work over @ [lint-md-fm](https://github.com/timhagn/lint-md-fm).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdevau%2Fflinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdevau%2Fflinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdevau%2Fflinter/lists"}