Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-zod-openapi

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-zod-openapi

Eslint rules for zod-openapi

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

eslint-plugin-zod-openapi

This is a set of Eslint rules created for use with zod-openapi. This aims to optimise the overall developer experience with a little sprinkle of magic ✨.

npm version npm downloads Node.js version Powered by skuba

Installation

To install simply run on yarn, npm or pnpm

yarn add -D eslint-plugin-zod-openapi
# or
npm i -D eslint-plugin-zod-openapi
# or
pnpm i -D eslint-plugin-zod-openapi

Add the following configuration to your .eslintrc file

{
  "plugins": ["zod-openapi"]
}
{
  "rules": {
    "zod-openapi/require-openapi": "error"
    "zod-openapi/require-comment": "error",
    "zod-openapi/prefer-zod-default": "warn",
  }
}

You may wish to use overrides as this plugin by default will assume that all Zod Objects are using zod-openapi.

"overrides": [
    {
      "files": ["src/api-types/*.ts"],
      "rules": {
        "zod-openapi/require-openapi": "error"
      }
    }
  ]

Rules

🔧 This rule is automatically fixable by the --fix CLI option.

NameDescription🔧
require-openapiRequires that all ZodTypes have an .openapi() method.
require-commentRequires that all ZodTypes have a description and matching JSDoc comment.
require-exampleRequires that all ZodTypes have an example or examples field.
prefer-openapi-lastPrefers that the .openapi() method be the last method in the ZodType chain.
prefer-zod-defaultProvides an error when default in .openapi() is used

Development

Test

pnpm test

Lint

# Fix issues
pnpm format

# Check for issues
pnpm lint

Release

To release a new version

  1. Create a new GitHub Release
  2. Select 🏷️ Choose a tag, enter a version number. eg. v1.2.0 and click + Create new tag: vX.X.X on publish.
  3. Click the Generate release notes button and adjust the description.
  4. Tick the Set as the latest release box and click Publish release. This will trigger the Release workflow.
  5. Check the Pull Requests tab for a PR labelled Release vX.X.X.
  6. Click Merge Pull Request on that Pull Request to update master with the new package version.

To release a new beta version

  1. Create a new GitHub Release
  2. 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.
  3. Click the Generate release notes button and adjust the description.
  4. Tick the Set as a pre-release box and click Publish release. This will trigger the Prerelease workflow.

FAQs

Package last updated on 28 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc