{"id":17288811,"url":"https://github.com/hay-kot/flint","last_synced_at":"2025-03-22T18:34:38.656Z","repository":{"id":64300225,"uuid":"569952979","full_name":"hay-kot/flint","owner":"hay-kot","description":"Customizable linter for frontmatter","archived":false,"fork":false,"pushed_at":"2025-03-13T15:09:06.000Z","size":132,"stargazers_count":4,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T14:05:08.968Z","etag":null,"topics":["frontmatter","linter","markdown"],"latest_commit_sha":null,"homepage":"","language":"Go","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/hay-kot.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-24T02:02:18.000Z","updated_at":"2024-04-11T03:33:44.000Z","dependencies_parsed_at":"2024-03-05T18:46:59.876Z","dependency_job_id":"ea735f21-33c2-4002-92a6-534cc7126290","html_url":"https://github.com/hay-kot/flint","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hay-kot%2Fflint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hay-kot%2Fflint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hay-kot%2Fflint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hay-kot%2Fflint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hay-kot","download_url":"https://codeload.github.com/hay-kot/flint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245003731,"owners_count":20545653,"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","linter","markdown"],"created_at":"2024-10-15T10:30:05.544Z","updated_at":"2025-03-22T18:34:38.325Z","avatar_url":"https://github.com/hay-kot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eFlint\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n    Customizable FrontMatter linter for your static site generator\n    \u003cbr /\u003e\n    \u003ca href=\"#configuration\"\u003e\u003cstrong\u003eConfig Reference »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/hay-kot/flint/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/hay-kot/flint/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nFlint is a customizable linter for frontmatter that can can be tailored to your projects needs. It uses a configuration file to define rule sets that can be applied conditionally to files based on their path.\n\n- Supported frontmatter formats:\n  - YAML\n  - JSON (Partial)\n  - TOML (Partial)\n\n| Format | Linting | Line / Col |\n| ------ | :-----: | :--------: |\n| YAML   |    ✓    |     ✓      |\n| JSON   |    ✓    |     ✖      |\n| TOML   |    ✓    |     ✖      |\n\nThis library is still experimental.\n\n**Example Output**\n\n\u003cimg height=\"500\" src=\"https://user-images.githubusercontent.com/64056131/204726580-3fa7c1d9-cc60-43bc-bac0-6c4b14c3d698.jpg\"\u003e\u003c/img\u003e\n\n## Features\n\n- Powerful glob matching support\n- Customizable rule-sets\n- Customizable error messages\n- Report errors when no front matter is detected\n- Powerful builtin checks\n  - Required fields\n  - Regex matching\n  - Enums Sets\n  - Date Format\n  - Field Length\n  - Disallowed Fields\n  - Asset Existence\n  - \u003cs\u003eField types\u003c/s\u003e (coming soon!)\n\n## Installation\n\n### Go Install\n\n```bash\ngo install github.com/hay-kot/flint@latest\n```\n\n### Homebrew\n\n```bash\nbrew tap hay-kot/flint-tap\nbrew install hay-kot/flint-tap/flint\n```\n\n## Usage\n\nflint does nothing out of the box, you must initialize a configuration file in the root directory where you'll call flint. This is usually the root of your project.\n\n### Configuration\n\nThe configuration has two areas (1) the `rules` and (2) the `content`. The rules is where you define a Key/Value pair of rules where the key is the ID of the rule and the value is the checks to be performed. The content is where you define the content to be linted and which rules to apply to it. You can write your configuration in YAML, JSON, or TOML, though we recommend YAML is it's the most readable.\n\n```yaml\nrules:\n  FM001:\n    level: error\n    description: \"required post fields are missing\"\n    required:\n      - \"title\"\n      - \"date\"\n\ncontent:\n  - name: Blog Posts\n    paths:\n      - content/**/*.{md,html}\n    rules:\n      - FM001\n```\n\n**Note:** If the configuration file cannot be found, flint will attempt to look for a glob match for a toml, json, or yaml file in the current directory, or the parent directory of the config path passed in. If you have multiple files that may match the glob, the first one found will be used. This may lead to unexpected results if you have multiple configuration files in your project. We recommend you use the `--config` flag to specify the path to your configuration file explicitly if you're using multiple configuration files.\n\n#### Rules\n\nThe key is the ID of the rule. This is used to identify the rule in the output. We recommend using either `FM001` and up or define your own rule id using a common prefix and number scheme.\n\nThe value represents the configuration for the rule set being created. Flint comes with a set of built in rules that can be applied to keys within your front matter. Custom rules cannot be defined at this time. Note that if multiple checks are defined for a rule, they will all be applied to the front matter.\n\n#### Properties\n\n- `level` - The level of the rule. This can be `error`, `warning`, or `info`. This is used to determine the exit code of the program.\n- `description` - A description of the rule. This is used in the output to describe the rule. Keep it short and sweet.\n\n#### Built-in Rules\n\n##### `required`\n\nThis rule checks to see if the keys defined in the array are present in the front matter. It's values is a list of strings\n\n```yaml\nrules:\n  FM002:\n    level: warning\n    description: \"author is missing\"\n    required:\n      - \"author.name\"\n      - \"author.email\"\n```\n\n##### `disallowed`\n\nThis rule checks to see if a key is defined in the front matter and if it is, will result in an error. Useful for checking for keys that should not be present. It's values is a list of strings\n\n```yaml\nrules:\n  FM003:\n    level: error\n    description: \"disallowed key\"\n    disallowed:\n      - \"disallowed_key\"\n```\n\n##### `match`\n\nThis rules checks to see if the regular expressions defined in the array match the values of the fields defined in the array. You can provide multiple regular expressions and field, just keep in mind that every regex will be applied to each field.\n\nSupported types are `string` and `[]string`\n\n```yaml\n  FM003:\n    level: error\n    description: \"slug is not valid url\"\n    match:\n      re:\n        - \"^[a-z0-9]+(?:-[a-z0-9]+)*$\"\n      fields:\n        - \"meta.slug\"\n        - \"slug\"\n```\n\n##### `enum`\n\nchecks to see if the string or string array are defined in the values.\n\nSupported types are `string` and `[]string`\n\n```yaml\n  FM004:\n    level: error\n    description: \"category not in list\"\n    enum:\n      values:\n        - \"Go\"\n        - \"Python\"\n      fields:\n        - \"category\"\n        - \"post.category\"\n```\n\n##### `date`\n\nchecks to see if the date is in the correct format. The format is defined using the [Go Time package](https://golang.org/pkg/time/#pkg-constants) string format.\n\nIf the format property not defined it will default to all parsable formats defined in the [Go Time package](https://golang.org/pkg/time/#pkg-constants).\n\nSupported types are `string`\n\n```yaml\n  FM005:\n    level: error\n    description: \"date is not in correct format\"\n    date:\n      format:\n        - \"2006-01-02\"\n      fields:\n        - \"date\"\n```\n\n##### `length`\n\nChecks to see if the field meets a min/max length\n\nSupported types are `string` and `[]string`\n\n```yaml\n  FM006:\n    level: error\n    description: \"must be between 2 and 5\"\n    length:\n      min: 2\n      max: 5\n      fields:\n        - \"keywords\"\n        - \"categories\"\n        - \"tags\"\n```\n\n##### `assets`\n\nChecks to see if the filepath defined in the field exists in a relative path to the sources defined in the assets section. This is useful for checking to see if an image exists in a directory.\n\nSupported types are `string` and `[]string`\n\n```yaml\n  FM008:\n    level: error\n    description: \"assets required\"\n    assets:\n      sources:\n        - \"content/\"\n        - \"static/\"\n        - \"public/\"\n      fields:\n        - image\n        - images\n```\n\n#### Content\n\nThe content is an array of objects that define the content to be linted and the rules to apply to it. You can use a robust glob pattern to define the paths to be linted. See [doublestar](https://github.com/bmatcuk/doublestar) for more details on supported patterns\n\n```yaml\ncontent:\n  - name: Blog Posts\n    paths:\n      - content/**/*.{md,html}\n    rules:\n      - FM001\n      - FM002\n      - FM003\n```\n\n### Recipes\n\n#### Blog Requirements\n\n```yaml\nrules:\n  FM001:\n    level: error\n    description: \"blog post requirements\"\n    required:\n      - \"title\"\n      - \"slug\"\n      - \"description\"\n      - \"date\"\n      - \"keywords\"\n    date:\n      format:\n        - \"2006-01-02\"\n      fields:\n        - \"date\"\n    length:\n      min: 2\n      max: 5\n      fields:\n        - \"keywords\"\n        - \"categories\"\n        - \"tags\"\n    match:\n      re:\n        - \"^[a-z0-9]+(?:-[a-z0-9]+)*$\"\n      fields:\n        - \"slug\"\n```\n\n#### Ignore Files that start with an underscore\n\n```yaml\ncontent:\n  - name: Blog Posts\n    paths:\n      - content/blog/**/[!_]*.md\n    rules:\n      - FM001\n      - FM002\n      - FM003\n```\n\n#### Regular Expressions\n\n| Description | Regex                      |\n| ----------- | -------------------------- |\n| Slug        | ^[a-z0-9]+(?:-[a-z0-9]+)*$ |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhay-kot%2Fflint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhay-kot%2Fflint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhay-kot%2Fflint/lists"}