{"id":16650570,"url":"https://github.com/samchungy/eslint-plugin-zod-openapi","last_synced_at":"2025-03-21T16:31:24.289Z","repository":{"id":153127223,"uuid":"628265569","full_name":"samchungy/eslint-plugin-zod-openapi","owner":"samchungy","description":"Eslint rules for zod-openapi","archived":false,"fork":false,"pushed_at":"2025-03-10T21:05:22.000Z","size":829,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T23:40:01.772Z","etag":null,"topics":["eslint","openapi","typescript","typescript-eslint","zod"],"latest_commit_sha":null,"homepage":"","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/samchungy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["samchungy"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-04-15T12:15:00.000Z","updated_at":"2025-01-21T23:42:37.000Z","dependencies_parsed_at":"2023-04-24T12:02:39.544Z","dependency_job_id":"17b1e98f-4470-41fd-95eb-e6f6e17997ef","html_url":"https://github.com/samchungy/eslint-plugin-zod-openapi","commit_stats":{"total_commits":243,"total_committers":4,"mean_commits":60.75,"dds":"0.31275720164609055","last_synced_commit":"a54b4b524cba24a978e0c08a7de6934c197c7381"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchungy%2Feslint-plugin-zod-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchungy%2Feslint-plugin-zod-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchungy%2Feslint-plugin-zod-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchungy%2Feslint-plugin-zod-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samchungy","download_url":"https://codeload.github.com/samchungy/eslint-plugin-zod-openapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244829499,"owners_count":20517311,"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":["eslint","openapi","typescript","typescript-eslint","zod"],"created_at":"2024-10-12T09:17:01.427Z","updated_at":"2025-03-21T16:31:23.913Z","avatar_url":"https://github.com/samchungy.png","language":"TypeScript","funding_links":["https://github.com/sponsors/samchungy"],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-zod-openapi\n\nThis is a set of Eslint rules created for use with [zod-openapi](https://github.com/samchungy/zod-openapi). This aims to optimise the overall developer experience with a little sprinkle of magic ✨.\n\n[![npm version](https://img.shields.io/npm/v/eslint-plugin-zod-openapi)](https://www.npmjs.com/package/eslint-plugin-zod-openapi)\n[![npm downloads](https://img.shields.io/npm/dm/eslint-plugin-zod-openapi)](https://www.npmjs.com/package/eslint-plugin-zod-openapi)\n[![Node.js version](https://img.shields.io/badge/node-%3E%3D%2016.11-brightgreen)](https://nodejs.org/en/)\n[![Powered by skuba](https://img.shields.io/badge/🤿%20skuba-powered-009DC4)](https://github.com/seek-oss/skuba)\n\n## Installation\n\nTo install simply run on yarn, npm or pnpm\n\n```bash\nyarn add -D eslint-plugin-zod-openapi\n# or\nnpm i -D eslint-plugin-zod-openapi\n# or\npnpm i -D eslint-plugin-zod-openapi\n```\n\nAdd the following configuration to your `.eslintrc` file\n\n```js\n{\n  \"plugins\": [\"zod-openapi\"]\n}\n```\n\n```js\n{\n  \"rules\": {\n    \"zod-openapi/require-openapi\": \"error\"\n    \"zod-openapi/require-comment\": \"error\",\n    \"zod-openapi/prefer-zod-default\": \"warn\",\n  }\n}\n```\n\nYou may wish to use overrides as this plugin by default will assume that all Zod Objects are using zod-openapi.\n\n```js\n\"overrides\": [\n    {\n      \"files\": [\"src/api-types/*.ts\"],\n      \"rules\": {\n        \"zod-openapi/require-openapi\": \"error\"\n      }\n    }\n  ]\n```\n\n## Rules\n\n🔧 This rule is automatically fixable by the [--fix CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).\n\n| Name                                                       | Description                                                                   | 🔧  |\n| ---------------------------------------------------------- | ----------------------------------------------------------------------------- | :-: |\n| [require-openapi](./docs/rules/require-openapi.md)         | Requires that all ZodTypes have an `.openapi()` method.                       |     |\n| [require-comment](./docs/rules/require-comment.md)         | Requires that all ZodTypes have a `description` and matching JSDoc comment.   | ✅  |\n| [require-example](./docs/rules/require-example.md)         | Requires that all ZodTypes have an `example` or `examples` field.             |     |\n| [prefer-openapi-last](./docs/rules/prefer-openapi-last.md) | Prefers that the `.openapi()` method be the last method in the ZodType chain. |     |\n| [prefer-zod-default](./docs/rules/prefer-zod-default.md)   | Provides an error when `default` in `.openapi()` is used                      |     |\n\n## Development\n\n### Test\n\n```shell\npnpm test\n```\n\n### Lint\n\n```shell\n# Fix issues\npnpm format\n\n# Check for issues\npnpm lint\n```\n\n### Release\n\nTo release a new version\n\n1. Create a [new GitHub Release](https://github.com/samchungy/eslint-plugin-zod-openapi/releases/new)\n2. Select `🏷️ Choose a tag`, enter a version number. eg. `v1.2.0` and click `+ Create new tag: vX.X.X on publish`.\n3. Click the `Generate release notes` button and adjust the description.\n4. Tick the `Set as the latest release` box and click `Publish release`. This will trigger the `Release` workflow.\n5. Check the `Pull Requests` tab for a PR labelled `Release vX.X.X`.\n6. Click `Merge Pull Request` on that Pull Request to update master with the new package version.\n\nTo release a new beta version\n\n1. Create a [new GitHub Release](https://github.com/samchungy/eslint-plugin-zod-openapi/releases/new)\n2. Select `🏷️ Choose a tag`, enter a version number with a `-beta.X` suffix eg. `v1.2.0-beta.1` and click `+ Create new tag: vX.X.X-beta.X on publish`.\n3. Click the `Generate release notes` button and adjust the description.\n4. Tick the `Set as a pre-release` box and click `Publish release`. This will trigger the `Prerelease` workflow.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchungy%2Feslint-plugin-zod-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamchungy%2Feslint-plugin-zod-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchungy%2Feslint-plugin-zod-openapi/lists"}