@sarj/eslint-plugin 16.4.5 → 16.4.6
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 +27 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7196,7 +7196,7 @@ var import_utils43 = require("@typescript-eslint/utils");
|
|
|
7196
7196
|
// src/rules/_zod.ts
|
|
7197
7197
|
var ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;
|
|
7198
7198
|
function isZodModule(source) {
|
|
7199
|
-
return
|
|
7199
|
+
return source === "zod" || source.startsWith("zod/");
|
|
7200
7200
|
}
|
|
7201
7201
|
|
|
7202
7202
|
// src/rules/no-impossible-zod-literal-bounds.ts
|
|
@@ -7583,6 +7583,7 @@ var NO_REDUNDANT_OPTIONAL_ARRAY_DEFAULT_DOCUMENTATION = {
|
|
|
7583
7583
|
autofix: "safe",
|
|
7584
7584
|
limitations: [
|
|
7585
7585
|
"Only syntactically local Zod array chains with adjacent `.optional().default(...)` calls are checked.",
|
|
7586
|
+
"Imports must name the official zod package or its subpaths; relative modules and unproven npm aliases are excluded.",
|
|
7586
7587
|
"String, scalar, tuple, set, record, aliased, composed, and dynamically constructed schemas are excluded.",
|
|
7587
7588
|
"The reversed `.default(...).optional()` order is preserved because its outer optional can return undefined instead of the default.",
|
|
7588
7589
|
"Defaults must be literal arrays or synchronous functions returning one literal array; dynamic or undefined fallbacks are excluded because Zod 3 reparses the fallback.",
|
|
@@ -7623,6 +7624,30 @@ var NO_REDUNDANT_OPTIONAL_ARRAY_DEFAULT_DOCUMENTATION = {
|
|
|
7623
7624
|
focusPath: "src/schema.ts",
|
|
7624
7625
|
expectedCount: 1,
|
|
7625
7626
|
public: true
|
|
7627
|
+
},
|
|
7628
|
+
{
|
|
7629
|
+
id: "unrelated-relative-builder",
|
|
7630
|
+
title: "Preserve an unrelated builder in a directory named zod",
|
|
7631
|
+
outcome: "no-match",
|
|
7632
|
+
files: [
|
|
7633
|
+
{ path: "src/my-zod/index.ts", source: 'export const z = { string: () => "string", array: (_element: string) => ({ optional: () => ({ default: (value: readonly string[]) => ({ value, optional: true }) }), default: (value: readonly string[]) => ({ value, optional: false }) }) };' },
|
|
7634
|
+
{ path: "src/schema.ts", source: 'import { z } from "./my-zod/index.js"; export const Items = z.array(z.string()).optional().default([]);' }
|
|
7635
|
+
],
|
|
7636
|
+
focusPath: "src/schema.ts",
|
|
7637
|
+
expectedCount: 0,
|
|
7638
|
+
public: true,
|
|
7639
|
+
scenarioId: "module-identity"
|
|
7640
|
+
},
|
|
7641
|
+
{
|
|
7642
|
+
id: "official-zod-subpath-array",
|
|
7643
|
+
title: "Official Zod subpath constructors retain the safe fix",
|
|
7644
|
+
outcome: "match",
|
|
7645
|
+
files: [{ path: "src/schema.ts", source: 'import { array, string } from "zod/v4"; const Items = array(string()).optional().default([]);' }],
|
|
7646
|
+
fixedFiles: [{ path: "src/schema.ts", source: 'import { array, string } from "zod/v4"; const Items = array(string()).default([]);' }],
|
|
7647
|
+
focusPath: "src/schema.ts",
|
|
7648
|
+
expectedCount: 1,
|
|
7649
|
+
public: true,
|
|
7650
|
+
scenarioId: "module-identity"
|
|
7626
7651
|
}
|
|
7627
7652
|
]
|
|
7628
7653
|
};
|
|
@@ -24289,7 +24314,7 @@ var RULES = {
|
|
|
24289
24314
|
};
|
|
24290
24315
|
var meta = {
|
|
24291
24316
|
name: "@sarj/eslint-plugin",
|
|
24292
|
-
version: "16.4.
|
|
24317
|
+
version: "16.4.6"
|
|
24293
24318
|
};
|
|
24294
24319
|
var APPLICATION_ONLY_RULES = [];
|
|
24295
24320
|
var LIBRARY_IMPORT_POLICY = ["error", {
|
package/dist/index.d.cts
CHANGED
|
@@ -927,7 +927,7 @@ type FlatPreset = {
|
|
|
927
927
|
declare const PLUGIN: {
|
|
928
928
|
readonly meta: {
|
|
929
929
|
readonly name: "@sarj/eslint-plugin";
|
|
930
|
-
readonly version: "16.4.
|
|
930
|
+
readonly version: "16.4.6";
|
|
931
931
|
};
|
|
932
932
|
readonly rules: {
|
|
933
933
|
readonly "require-explicit-contract-implementation": DocumentedRule<readonly [], "declareActualContract">;
|
package/dist/index.d.ts
CHANGED
|
@@ -927,7 +927,7 @@ type FlatPreset = {
|
|
|
927
927
|
declare const PLUGIN: {
|
|
928
928
|
readonly meta: {
|
|
929
929
|
readonly name: "@sarj/eslint-plugin";
|
|
930
|
-
readonly version: "16.4.
|
|
930
|
+
readonly version: "16.4.6";
|
|
931
931
|
};
|
|
932
932
|
readonly rules: {
|
|
933
933
|
readonly "require-explicit-contract-implementation": DocumentedRule<readonly [], "declareActualContract">;
|
package/dist/index.js
CHANGED
|
@@ -7170,7 +7170,7 @@ import {
|
|
|
7170
7170
|
// src/rules/_zod.ts
|
|
7171
7171
|
var ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;
|
|
7172
7172
|
function isZodModule(source) {
|
|
7173
|
-
return
|
|
7173
|
+
return source === "zod" || source.startsWith("zod/");
|
|
7174
7174
|
}
|
|
7175
7175
|
|
|
7176
7176
|
// src/rules/no-impossible-zod-literal-bounds.ts
|
|
@@ -7562,6 +7562,7 @@ var NO_REDUNDANT_OPTIONAL_ARRAY_DEFAULT_DOCUMENTATION = {
|
|
|
7562
7562
|
autofix: "safe",
|
|
7563
7563
|
limitations: [
|
|
7564
7564
|
"Only syntactically local Zod array chains with adjacent `.optional().default(...)` calls are checked.",
|
|
7565
|
+
"Imports must name the official zod package or its subpaths; relative modules and unproven npm aliases are excluded.",
|
|
7565
7566
|
"String, scalar, tuple, set, record, aliased, composed, and dynamically constructed schemas are excluded.",
|
|
7566
7567
|
"The reversed `.default(...).optional()` order is preserved because its outer optional can return undefined instead of the default.",
|
|
7567
7568
|
"Defaults must be literal arrays or synchronous functions returning one literal array; dynamic or undefined fallbacks are excluded because Zod 3 reparses the fallback.",
|
|
@@ -7602,6 +7603,30 @@ var NO_REDUNDANT_OPTIONAL_ARRAY_DEFAULT_DOCUMENTATION = {
|
|
|
7602
7603
|
focusPath: "src/schema.ts",
|
|
7603
7604
|
expectedCount: 1,
|
|
7604
7605
|
public: true
|
|
7606
|
+
},
|
|
7607
|
+
{
|
|
7608
|
+
id: "unrelated-relative-builder",
|
|
7609
|
+
title: "Preserve an unrelated builder in a directory named zod",
|
|
7610
|
+
outcome: "no-match",
|
|
7611
|
+
files: [
|
|
7612
|
+
{ path: "src/my-zod/index.ts", source: 'export const z = { string: () => "string", array: (_element: string) => ({ optional: () => ({ default: (value: readonly string[]) => ({ value, optional: true }) }), default: (value: readonly string[]) => ({ value, optional: false }) }) };' },
|
|
7613
|
+
{ path: "src/schema.ts", source: 'import { z } from "./my-zod/index.js"; export const Items = z.array(z.string()).optional().default([]);' }
|
|
7614
|
+
],
|
|
7615
|
+
focusPath: "src/schema.ts",
|
|
7616
|
+
expectedCount: 0,
|
|
7617
|
+
public: true,
|
|
7618
|
+
scenarioId: "module-identity"
|
|
7619
|
+
},
|
|
7620
|
+
{
|
|
7621
|
+
id: "official-zod-subpath-array",
|
|
7622
|
+
title: "Official Zod subpath constructors retain the safe fix",
|
|
7623
|
+
outcome: "match",
|
|
7624
|
+
files: [{ path: "src/schema.ts", source: 'import { array, string } from "zod/v4"; const Items = array(string()).optional().default([]);' }],
|
|
7625
|
+
fixedFiles: [{ path: "src/schema.ts", source: 'import { array, string } from "zod/v4"; const Items = array(string()).default([]);' }],
|
|
7626
|
+
focusPath: "src/schema.ts",
|
|
7627
|
+
expectedCount: 1,
|
|
7628
|
+
public: true,
|
|
7629
|
+
scenarioId: "module-identity"
|
|
7605
7630
|
}
|
|
7606
7631
|
]
|
|
7607
7632
|
};
|
|
@@ -24313,7 +24338,7 @@ var RULES = {
|
|
|
24313
24338
|
};
|
|
24314
24339
|
var meta = {
|
|
24315
24340
|
name: "@sarj/eslint-plugin",
|
|
24316
|
-
version: "16.4.
|
|
24341
|
+
version: "16.4.6"
|
|
24317
24342
|
};
|
|
24318
24343
|
var APPLICATION_ONLY_RULES = [];
|
|
24319
24344
|
var LIBRARY_IMPORT_POLICY = ["error", {
|