New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-zod-to-openapi

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-zod-to-openapi - npm Package Compare versions

Comparing version 0.0.19 to 0.0.20

30

lib-commonjs/util/type.js

@@ -10,2 +10,10 @@ "use strict";

const traverse_1 = require("./traverse");
const getPropType = (checker, nodeType, property) => {
const prop = nodeType.getProperty(property);
if (!prop) {
return;
}
const propSymbol = checker.getTypeOfSymbolAtLocation(prop, prop.valueDeclaration);
return checker.typeToString(propSymbol);
};
const getType = (node, context) => {

@@ -18,9 +26,21 @@ // 1. Grab the TypeScript program from parser services

const nodeType = checker.getTypeAtLocation(originalNode);
if (!nodeType.symbol) {
const defType = getPropType(checker, nodeType, '_def');
if (!defType) {
return;
}
const type = checker.typeToString(checker.getTypeOfSymbolAtLocation(nodeType.symbol, nodeType.symbol.valueDeclaration));
const name = nodeType.symbol.getName();
const maybeUnwrapType = getPropType(checker, nodeType, 'unwrap');
const unwrapType = maybeUnwrapType?.startsWith('() => ')
? maybeUnwrapType.slice(6)
: undefined;
const symbol = nodeType.getSymbol();
if (!symbol) {
return;
}
const constructorType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
const type = checker.typeToString(constructorType);
const name = symbol.getName();
return {
name: nodeType.symbol.getName(),
defType,
unwrapType,
name,
type,

@@ -33,3 +53,3 @@ isZodType: name.includes('Zod'),

'ZodRecord',
].includes(name),
].includes(unwrapType ?? name),
};

@@ -36,0 +56,0 @@ };

import { TSESLint, TSESTree } from '@typescript-eslint/utils';
declare const getType: <T extends TSESTree.Node>(node: T, context: Readonly<TSESLint.RuleContext<any, any>>) => {
defType: string;
unwrapType: string | undefined;
name: string;

@@ -4,0 +6,0 @@ type: string;

2

package.json
{
"name": "eslint-plugin-zod-to-openapi",
"version": "0.0.19",
"version": "0.0.20",
"private": false,

@@ -5,0 +5,0 @@ "description": "Eslint rules for zod-to-openapi",

Sorry, the diff of this file is not supported yet

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