@sarj/eslint-plugin 9.7.0 → 9.7.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/README.md CHANGED
@@ -138,7 +138,7 @@ Both distilled from two years of PR-review comments across ~1,065 PRs.
138
138
  | `prefer-zod-infer` | An `interface`/`type` that restates a Zod schema declared in the same module instead of deriving it with `z.infer`. Options: `ignoreTypeNames`, `requireIdenticalShape` (default `true`). | warn / error |
139
139
  | `prefer-module-level-constant` | A literal-only `const` collection (array, object, `Set`, `Map`, `Object.freeze`) or non-global regex declared inside a function body, never mutated and never escaping — hoist it to module scope. Options: `minElements` (default 3), `checkRegex`, `ignoreTestFiles`. | warn / error |
140
140
  | `prefer-module-level-schema` | A Zod schema built inside a function body that closes over nothing the function owns — hoist it to module scope instead of rebuilding it per call, per request, per render. Silent when it references a parameter, local, type parameter, local type, or `this` (that is a schema FACTORY), when it is already memoized, and inside `z.lazy`. Options: `factories` (default: the object-like composites), `minProperties` (default 1), `ignoreTestFiles`. | warn / error |
141
- | `prefer-non-nullable-collection` | An array type explicitly combined with `null`/`undefined`, creating two equivalent empty states. | warn / error |
141
+ | `prefer-non-nullable-collection` | A required array property or direct alias explicitly combined with `null`/`undefined`, creating two equivalent empty states. Optional API fields are excluded because omission can be meaningful. | warn / error |
142
142
 
143
143
  ## Options
144
144
 
package/dist/index.cjs CHANGED
@@ -7165,6 +7165,7 @@ var prefer_non_nullable_collection_default = createRule({
7165
7165
  return {};
7166
7166
  }
7167
7167
  function checkOptionalProperty(node) {
7168
+ if (node.optional) return;
7168
7169
  const annotation = node.typeAnnotation?.typeAnnotation;
7169
7170
  if (annotation === void 0) return;
7170
7171
  if (annotation.type !== import_utils48.AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {
@@ -9930,7 +9931,7 @@ var rules = {
9930
9931
  };
9931
9932
  var meta = {
9932
9933
  name: "@sarj/eslint-plugin",
9933
- version: "9.7.0"
9934
+ version: "9.7.1"
9934
9935
  };
9935
9936
  var recommendedRules = {
9936
9937
  "@sarj/enforce-file-structure": "warn",