@objectstack/lint 15.0.0 → 15.1.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.js CHANGED
@@ -1037,6 +1037,7 @@ function validateRecordTitle(stack) {
1037
1037
  // src/validate-semantic-roles.ts
1038
1038
  var FIELD_GROUP_UNDECLARED = "field-group-undeclared";
1039
1039
  var FIELD_GROUP_EMPTY = "field-group-empty";
1040
+ var FIELD_GROUP_SHADOWED = "field-group-shadowed";
1040
1041
  var SEMANTIC_ROLE_FIELD_UNKNOWN = "semantic-role-field-unknown";
1041
1042
  function asArray10(v) {
1042
1043
  if (Array.isArray(v)) return v;
@@ -1110,6 +1111,31 @@ function validateSemanticRoles(stack) {
1110
1111
  hint: `Fix the field name (highlightFields drives default columns, cards, previews and the detail highlight strip, in order).`
1111
1112
  });
1112
1113
  }
1114
+ const declaredStrings = highlights.filter(
1115
+ (h) => typeof h === "string" && h.length > 0
1116
+ );
1117
+ if (declaredStrings.length > 0 && declaredGroups.size > 0) {
1118
+ const declaredTitle = [obj.nameField, obj.primaryField, obj.displayNameField].find((v) => typeof v === "string" && v.length > 0 && fieldNames.has(v));
1119
+ const titleField = declaredTitle ?? ["name", "full_name", "title", "subject", "display_name"].find((c) => fieldNames.has(c));
1120
+ const stripSet = new Set(
1121
+ declaredStrings.filter((h) => h !== titleField).slice(0, 4)
1122
+ );
1123
+ const hiddenFromBody = new Set(stripSet);
1124
+ if (titleField) hiddenFromBody.add(titleField);
1125
+ for (const key of declaredGroups) {
1126
+ const members = Object.entries(fields).filter(([, f]) => f?.group === key && f?.hidden !== true).map(([fname]) => fname);
1127
+ if (members.length === 0) continue;
1128
+ if (!members.every((m) => hiddenFromBody.has(m))) continue;
1129
+ findings.push({
1130
+ severity: "warning",
1131
+ rule: FIELD_GROUP_SHADOWED,
1132
+ where,
1133
+ path: `${path}.fieldGroups`,
1134
+ message: `${objName}: every field in group "${key}" (${members.join(", ")}) is hoisted into the detail highlight strip (or is the record title) \u2014 the group renders on forms but never on detail pages`,
1135
+ hint: `Keep at least one non-highlighted field in "${key}", or remove the group if the strip already covers it. (Detail pages show the first 4 highlightFields as the top strip and hide them from the body.)`
1136
+ });
1137
+ }
1138
+ }
1113
1139
  }
1114
1140
  return findings;
1115
1141
  }