eslint-plugin-zod-v4 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12466,6 +12466,14 @@ function isModuleLevelFactoryFunction(node) {
|
|
|
12466
12466
|
}
|
|
12467
12467
|
|
|
12468
12468
|
// src/rules/prefer-error-param.ts
|
|
12469
|
+
function isDirectZodObjectCall(node) {
|
|
12470
|
+
if (node.callee.type !== "MemberExpression") return false;
|
|
12471
|
+
const { object, property } = node.callee;
|
|
12472
|
+
if (object.type === "Identifier" && object.name === "z") {
|
|
12473
|
+
return property.type === "Identifier" && property.name === "object";
|
|
12474
|
+
}
|
|
12475
|
+
return false;
|
|
12476
|
+
}
|
|
12469
12477
|
var preferErrorParam = createRule({
|
|
12470
12478
|
name: "prefer-error-param",
|
|
12471
12479
|
meta: {
|
|
@@ -12484,6 +12492,7 @@ var preferErrorParam = createRule({
|
|
|
12484
12492
|
return {
|
|
12485
12493
|
CallExpression(node) {
|
|
12486
12494
|
if (!isZodCall(node)) return;
|
|
12495
|
+
if (isDirectZodObjectCall(node)) return;
|
|
12487
12496
|
for (const arg of node.arguments) {
|
|
12488
12497
|
if (arg.type !== "ObjectExpression") continue;
|
|
12489
12498
|
for (const prop of arg.properties) {
|