@shepherdjerred/helm-types 1.5.0 → 1.6.0-dev.7909

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/cli.js CHANGED
@@ -21309,7 +21309,7 @@ function isPartOfYAMLBlock(line, trimmed) {
21309
21309
  return line.startsWith(" ") || line.startsWith("\t") || trimmed.startsWith("-") || trimmed.startsWith("#");
21310
21310
  }
21311
21311
  function isSectionHeaderForCommentedBlock(nextLine) {
21312
- if (nextLine == null || nextLine === "") {
21312
+ if (nextLine === "" || nextLine == null) {
21313
21313
  return false;
21314
21314
  }
21315
21315
  const nextTrimmed = nextLine.trim();
@@ -21375,7 +21375,7 @@ function parseCommentsWithRegex(yamlContent) {
21375
21375
  lines.forEach((line, lineNum) => {
21376
21376
  const trimmed = line.trim();
21377
21377
  if (!trimmed) {
21378
- if (pendingComment.length > 0 && pendingCommentIndent === -1) {
21378
+ if (pendingCommentIndent === -1 && pendingComment.length > 0) {
21379
21379
  pendingDebugInfo.push(`Line ${String(lineNum)}: Blank line after commented-out key, resetting pending`);
21380
21380
  pendingComment = [];
21381
21381
  pendingDebugInfo = [];
@@ -21418,7 +21418,7 @@ function parseCommentsWithRegex(yamlContent) {
21418
21418
  const keyMatch = keyMatchRegex.exec(trimmed);
21419
21419
  if (keyMatch && pendingComment.length > 0) {
21420
21420
  const key = keyMatch[1];
21421
- if (key != null && key !== "") {
21421
+ if (key !== "" && key != null) {
21422
21422
  const keyIndent = line.search(/\S/);
21423
21423
  if (pendingCommentIndent === -1 || Math.abs(keyIndent - pendingCommentIndent) <= 2) {
21424
21424
  const commentText = pendingComment.join(`
@@ -21508,7 +21508,7 @@ function tryUncommentLine(line, lines, i, state) {
21508
21508
  return { uncommented: null, newConsecutive: 0 };
21509
21509
  }
21510
21510
  const [, indent, keyValue] = commentedKeyMatch;
21511
- if (keyValue == null || keyValue === "" || indent == null || indent === "") {
21511
+ if (keyValue === "" || indent === "" || keyValue == null || indent == null) {
21512
21512
  return {
21513
21513
  uncommented: null,
21514
21514
  newConsecutive: state.consecutiveCommentedKeys
@@ -21593,7 +21593,7 @@ function isSimpleYAMLValue(line) {
21593
21593
  return /^[\w.-]+:\s[^:]+$/.test(line) && !hasURL && !isRef;
21594
21594
  }
21595
21595
  function isSectionHeader(line, nextLine) {
21596
- if (nextLine == null || nextLine === "") {
21596
+ if (nextLine === "" || nextLine == null) {
21597
21597
  return false;
21598
21598
  }
21599
21599
  const isFollowedByYAMLKey = /^[\w.-]+:\s*\|/.test(nextLine) || /^[\w.-]+:\s*$/.test(nextLine) || /^[\w.-]+:\s+/.test(nextLine);
@@ -21622,7 +21622,7 @@ function looksLikeProse(line, wordCount) {
21622
21622
  const hasURL = line.includes("http://") || line.includes("https://");
21623
21623
  const startsWithCapital = /^[A-Z]/.test(line);
21624
21624
  const hasEndPunctuation = /[.!?:]$/.test(line);
21625
- const notYamlKey = !(isYAMLKey(line) && !hasURL && !/^ref:/i.test(line));
21625
+ const notYamlKey = !(!hasURL && isYAMLKey(line) && !/^ref:/i.test(line));
21626
21626
  const reasonableLength = line.length > 10;
21627
21627
  const hasMultipleWords = wordCount >= 3;
21628
21628
  const startsWithArticle = /^(?:This|The|A|An)\s/i.test(line);
@@ -21702,7 +21702,7 @@ function parseBitnamiParams(comment) {
21702
21702
  const paramMatch = /^@param\s+([\w.-]+)\s+(\S.*)$/.exec(trimmedLine);
21703
21703
  if (paramMatch) {
21704
21704
  const [, paramKey, description] = paramMatch;
21705
- if (paramKey != null && paramKey !== "" && description != null && description !== "") {
21705
+ if (paramKey !== "" && description !== "" && paramKey != null && description != null) {
21706
21706
  params.set(paramKey, description);
21707
21707
  }
21708
21708
  } else if (trimmedLine) {
@@ -21740,7 +21740,7 @@ ${comment}` : pairComment;
21740
21740
  comment = comment ? `${comment}
21741
21741
  ${inlineComment}` : inlineComment;
21742
21742
  }
21743
- if (context.index === 0 && !comment && context.mapComment) {
21743
+ if (!comment && context.index === 0 && context.mapComment) {
21744
21744
  comment = context.mapComment;
21745
21745
  }
21746
21746
  if (comment) {
@@ -22117,7 +22117,7 @@ function shouldAllowArbitraryProps(keyPath, chartName, propertyName, yamlComment
22117
22117
  if (lowerPath.includes("persistence") || lowerPath.includes("storage")) {
22118
22118
  return true;
22119
22119
  }
22120
- if (yamlComment != null && yamlComment !== "") {
22120
+ if (yamlComment !== "" && yamlComment != null) {
22121
22121
  const commentLower = yamlComment.toLowerCase();
22122
22122
  if (/\b(?:arbitrary|custom|additional|extra|any)\s+(?:keys?|properties?|fields?|values?)\b/i.test(commentLower) || /\bkey[\s-]?value\s+pairs?\b/i.test(commentLower)) {
22123
22123
  return true;
@@ -22178,10 +22178,10 @@ function capitalizeFirst(str) {
22178
22178
 
22179
22179
  // src/type-converter-helpers.ts
22180
22180
  function mergeDescriptions(schemaDescription, yamlComment) {
22181
- if (yamlComment == null || yamlComment === "") {
22181
+ if (yamlComment === "" || yamlComment == null) {
22182
22182
  return schemaDescription;
22183
22183
  }
22184
- return schemaDescription != null && schemaDescription !== "" ? `${yamlComment}
22184
+ return schemaDescription !== "" && schemaDescription != null ? `${yamlComment}
22185
22185
 
22186
22186
  ${schemaDescription}` : yamlComment;
22187
22187
  }
@@ -22346,21 +22346,21 @@ function typesAreCompatible(inferredType, schemaType) {
22346
22346
  const schemaTypes = schemaType.split("|").map((t) => t.trim().replaceAll(/^["']|["']$/g, ""));
22347
22347
  if (schemaTypes.length > 1) {
22348
22348
  for (const st of schemaTypes) {
22349
- if (st.startsWith('"') && st.endsWith('"') && inferredType === "string") {
22349
+ if (inferredType === "string" && st.startsWith('"') && st.endsWith('"')) {
22350
22350
  return true;
22351
22351
  }
22352
22352
  if (st === inferredType) {
22353
22353
  return true;
22354
22354
  }
22355
- if (st.endsWith("[]") && inferredType === "array") {
22355
+ if (inferredType === "array" && st.endsWith("[]")) {
22356
22356
  return true;
22357
22357
  }
22358
22358
  }
22359
22359
  }
22360
- if (schemaType.endsWith("[]") && inferredType === "array") {
22360
+ if (inferredType === "array" && schemaType.endsWith("[]")) {
22361
22361
  return true;
22362
22362
  }
22363
- if (schemaType.includes('"') && inferredType === "string") {
22363
+ if (inferredType === "string" && schemaType.includes('"')) {
22364
22364
  return true;
22365
22365
  }
22366
22366
  if (schemaType === "unknown" || inferredType === "unknown") {
@@ -22409,8 +22409,8 @@ function convertWithSchema(ctx) {
22409
22409
  } = ctx;
22410
22410
  const inferredType = inferTypeFromValue(value);
22411
22411
  const schemaType = jsonSchemaToTypeScript(schema);
22412
- if (inferredType != null && inferredType !== "" && !typesAreCompatible(inferredType, schemaType)) {
22413
- const propName = propertyName != null && propertyName !== "" ? `'${propertyName}': ` : "";
22412
+ if (inferredType !== "" && inferredType != null && !typesAreCompatible(inferredType, schemaType)) {
22413
+ const propName = propertyName !== "" && propertyName != null ? `'${propertyName}': ` : "";
22414
22414
  console.warn(` ⚠️ Type mismatch for ${propName}Schema says '${schemaType}' but value suggests '${inferredType}' (value: ${String(value).slice(0, 50)})`);
22415
22415
  }
22416
22416
  const description = mergeDescriptions(schema.description, yamlComment);
@@ -22486,12 +22486,12 @@ function inferUniformArrayType(ctx, elementTypes, elementTypeProps) {
22486
22486
  const { nestedTypeName, chartName, fullKey, propertyName, yamlComment } = ctx;
22487
22487
  const elementType = [...elementTypes][0];
22488
22488
  const elementProp = elementTypeProps[0];
22489
- if (elementType == null || elementType === "" || !elementProp) {
22489
+ if (elementType === "" || !elementProp || elementType == null) {
22490
22490
  return { type: "unknown[]", optional: true };
22491
22491
  }
22492
22492
  if (elementProp.nested) {
22493
22493
  const arrayElementTypeName = `${nestedTypeName}Element`;
22494
- const allowArbitraryProps = chartName != null && chartName !== "" && fullKey != null && fullKey !== "" ? shouldAllowArbitraryProps(fullKey, chartName, propertyName ?? "", yamlComment) : false;
22494
+ const allowArbitraryProps = chartName !== "" && fullKey !== "" && chartName != null && fullKey != null ? shouldAllowArbitraryProps(fullKey, chartName, propertyName ?? "", yamlComment) : false;
22495
22495
  const arrayElementInterface = {
22496
22496
  name: arrayElementTypeName,
22497
22497
  properties: elementProp.nested.properties,
@@ -22522,7 +22522,7 @@ function convertValueToProperty(opts) {
22522
22522
  if (NullSchema.safeParse(value).success || UndefinedSchema.safeParse(value).success) {
22523
22523
  return { type: "unknown", optional: true };
22524
22524
  }
22525
- if (propertyName != null && propertyName !== "") {
22525
+ if (propertyName !== "" && propertyName != null) {
22526
22526
  const wellKnown = getWellKnownK8sFieldType(propertyName, value);
22527
22527
  if (wellKnown) {
22528
22528
  return {
@@ -22626,11 +22626,11 @@ function generateInterfaceCode(iface) {
22626
22626
  if (prop.default !== undefined) {
22627
22627
  const defaultStr = formatDefaultValue(prop.default);
22628
22628
  const hasDescription = prop.description != null && prop.description !== "";
22629
- if (defaultStr != null && defaultStr !== "" && hasDescription) {
22629
+ if (defaultStr !== "" && hasDescription && defaultStr != null) {
22630
22630
  code += ` *
22631
22631
  `;
22632
22632
  }
22633
- if (defaultStr != null && defaultStr !== "") {
22633
+ if (defaultStr !== "" && defaultStr != null) {
22634
22634
  code += ` * @default ${defaultStr}
22635
22635
  `;
22636
22636
  }
@@ -22793,7 +22793,7 @@ function parseCliArgs(args) {
22793
22793
  const result = {};
22794
22794
  for (let i = 0;i < args.length; i++) {
22795
22795
  const arg = args[i];
22796
- if (arg == null || arg === "") {
22796
+ if (arg === "" || arg == null) {
22797
22797
  continue;
22798
22798
  }
22799
22799
  if (HELP_FLAGS.has(arg)) {
@@ -22803,7 +22803,7 @@ function parseCliArgs(args) {
22803
22803
  const key = FLAG_MAP[arg];
22804
22804
  if (key != null) {
22805
22805
  const value = args[i + 1];
22806
- if (value != null && value !== "") {
22806
+ if (value !== "" && value != null) {
22807
22807
  result[key] = value;
22808
22808
  i += 1;
22809
22809
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shepherdjerred/helm-types",
3
- "version": "1.5.0",
3
+ "version": "1.6.0-dev.7909",
4
4
  "description": "Generate TypeScript types from Helm chart values.yaml and values.schema.json",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,10 +27,12 @@
27
27
  "test:cli": "bun test src/cli.test.ts",
28
28
  "lint": "bunx eslint .",
29
29
  "lint:fix": "bunx eslint . --fix",
30
- "typecheck": "bunx tsc --noEmit",
30
+ "typecheck": "PATH=node_modules/@typescript/native/bin:$PATH tsc --noEmit",
31
31
  "prepublishOnly": "bun run build",
32
32
  "generate:live": "bun run src/cli.ts",
33
- "publish:npm": "bun ../../../../scripts/publish-npm.ts ."
33
+ "publish:npm": "bun ../../../../scripts/publish-npm.ts .",
34
+ "test:ci": "bun ../../../../scripts/run-ci-test.ts",
35
+ "test:report": "CI_TEST_COVERAGE=1 bun ../../../../scripts/run-ci-test.ts"
34
36
  },
35
37
  "keywords": [
36
38
  "helm",
@@ -65,6 +67,7 @@
65
67
  "@shepherdjerred/eslint-config": "0.3.0",
66
68
  "@types/bun": "^1.3.13",
67
69
  "eslint": "^10.3.0",
68
- "jiti": "^2.7.0"
70
+ "jiti": "^2.7.0",
71
+ "@typescript/native": "npm:typescript@7.0.2"
69
72
  }
70
73
  }
@@ -7,7 +7,7 @@ image:
7
7
  # -- Image pull policy.
8
8
  pullPolicy: IfNotPresent
9
9
  # -- Image tag; defaults to the chart appVersion when empty.
10
- tag: "@sha256:ec4ed8b5299e5e90694af7750eb6dffd2627317d30544d056b0371f8082f7bce"
10
+ tag: "@sha256:5a88c9c45479443d7be2eadc894b4ed0a9801bae03d97a5760ae13b5c2005942"
11
11
 
12
12
  # -- Whether the service is enabled.
13
13
  serviceEnabled: true
@@ -16,10 +16,10 @@ export async function parseChartInfoFromVersions(
16
16
 
17
17
  // Look for renovate comments that indicate Helm charts
18
18
  if (
19
+ nextLine === "" ||
19
20
  line == null ||
20
21
  !line.includes("renovate: datasource=helm") ||
21
- nextLine == null ||
22
- nextLine === ""
22
+ nextLine == null
23
23
  ) {
24
24
  continue;
25
25
  }
@@ -33,10 +33,10 @@ export async function parseChartInfoFromVersions(
33
33
  const repoUrl = repoUrlMatch[1];
34
34
  const versionKey = versionKeyMatch[1];
35
35
  if (
36
- repoUrl == null ||
37
36
  repoUrl === "" ||
38
- versionKey == null ||
39
- versionKey === ""
37
+ versionKey === "" ||
38
+ repoUrl == null ||
39
+ versionKey == null
40
40
  ) {
41
41
  continue;
42
42
  }
@@ -48,23 +48,15 @@ export async function parseChartInfoFromVersions(
48
48
  }
49
49
 
50
50
  const version = versionMatch[1];
51
- if (version == null || version === "") {
51
+ if (version === "" || version == null) {
52
52
  continue;
53
53
  }
54
54
 
55
- // Try to determine chart name from the version key or URL
56
- let chartName = versionKey;
57
-
58
- // Handle special cases like "argo-cd" vs "argocd"
59
- if (versionKey === "argo-cd") {
60
- chartName = "argo-cd";
61
- }
62
-
63
55
  charts.push({
64
56
  name: versionKey,
65
57
  repoUrl: repoUrl.replace(/\/$/, ""), // Remove trailing slash
66
58
  version,
67
- chartName,
59
+ chartName: versionKey,
68
60
  });
69
61
  }
70
62
 
package/src/cli.ts CHANGED
@@ -92,7 +92,7 @@ function parseCliArgs(args: string[]): CliArgs {
92
92
 
93
93
  for (let i = 0; i < args.length; i++) {
94
94
  const arg = args[i];
95
- if (arg == null || arg === "") {
95
+ if (arg === "" || arg == null) {
96
96
  continue;
97
97
  }
98
98
 
@@ -104,7 +104,7 @@ function parseCliArgs(args: string[]): CliArgs {
104
104
  const key = FLAG_MAP[arg];
105
105
  if (key != null) {
106
106
  const value = args[i + 1];
107
- if (value != null && value !== "") {
107
+ if (value !== "" && value != null) {
108
108
  result[key] = value;
109
109
  i += 1;
110
110
  }
@@ -95,10 +95,10 @@ function generateInterfaceCode(iface: TypeScriptInterface): string {
95
95
  const defaultStr = formatDefaultValue(prop.default);
96
96
  const hasDescription =
97
97
  prop.description != null && prop.description !== "";
98
- if (defaultStr != null && defaultStr !== "" && hasDescription) {
98
+ if (defaultStr !== "" && hasDescription && defaultStr != null) {
99
99
  code += ` *\n`;
100
100
  }
101
- if (defaultStr != null && defaultStr !== "") {
101
+ if (defaultStr !== "" && defaultStr != null) {
102
102
  code += ` * @default ${defaultStr}\n`;
103
103
  }
104
104
  }
@@ -121,15 +121,15 @@ export function parseYAMLComments(yamlContent: string): Map<string, string> {
121
121
  if (keyMatch) {
122
122
  const indent = keyMatch[1]?.length ?? 0;
123
123
  const key = keyMatch[2];
124
- if (key == null || key === "") {
124
+ if (key === "" || key == null) {
125
125
  continue;
126
126
  }
127
127
 
128
128
  // Update indent stack
129
129
  const lastIndent = indentStack.at(-1);
130
130
  while (
131
- indentStack.length > 0 &&
132
131
  lastIndent &&
132
+ indentStack.length > 0 &&
133
133
  lastIndent.indent >= indent
134
134
  ) {
135
135
  indentStack.pop();
package/src/config.ts CHANGED
@@ -179,7 +179,7 @@ export function shouldAllowArbitraryProps(
179
179
  }
180
180
 
181
181
  // Check YAML comments for hints
182
- if (yamlComment != null && yamlComment !== "") {
182
+ if (yamlComment !== "" && yamlComment != null) {
183
183
  const commentLower = yamlComment.toLowerCase();
184
184
  if (
185
185
  /\b(?:arbitrary|custom|additional|extra|any)\s+(?:keys?|properties?|fields?|values?)\b/i.test(
@@ -103,10 +103,10 @@ function generateInterfaceCode(iface: TypeScriptInterface): string {
103
103
  const defaultStr = formatDefaultValue(prop.default);
104
104
  const hasDescription =
105
105
  prop.description != null && prop.description !== "";
106
- if (defaultStr != null && defaultStr !== "" && hasDescription) {
106
+ if (defaultStr !== "" && hasDescription && defaultStr != null) {
107
107
  code += ` *\n`;
108
108
  }
109
- if (defaultStr != null && defaultStr !== "") {
109
+ if (defaultStr !== "" && defaultStr != null) {
110
110
  code += ` * @default ${defaultStr}\n`;
111
111
  }
112
112
  }
@@ -24,10 +24,10 @@ export function mergeDescriptions(
24
24
  schemaDescription: string | undefined,
25
25
  yamlComment: string | undefined,
26
26
  ): string | undefined {
27
- if (yamlComment == null || yamlComment === "") {
27
+ if (yamlComment === "" || yamlComment == null) {
28
28
  return schemaDescription;
29
29
  }
30
- return schemaDescription != null && schemaDescription !== ""
30
+ return schemaDescription !== "" && schemaDescription != null
31
31
  ? `${yamlComment}\n\n${schemaDescription}`
32
32
  : yamlComment;
33
33
  }
@@ -195,26 +195,26 @@ export function typesAreCompatible(
195
195
  if (schemaTypes.length > 1) {
196
196
  for (const st of schemaTypes) {
197
197
  // Handle quoted strings in unions (like "default")
198
- if (st.startsWith('"') && st.endsWith('"') && inferredType === "string") {
198
+ if (inferredType === "string" && st.startsWith('"') && st.endsWith('"')) {
199
199
  return true;
200
200
  }
201
201
  if (st === inferredType) {
202
202
  return true;
203
203
  }
204
204
  // Arrays
205
- if (st.endsWith("[]") && inferredType === "array") {
205
+ if (inferredType === "array" && st.endsWith("[]")) {
206
206
  return true;
207
207
  }
208
208
  }
209
209
  }
210
210
 
211
211
  // Handle array types
212
- if (schemaType.endsWith("[]") && inferredType === "array") {
212
+ if (inferredType === "array" && schemaType.endsWith("[]")) {
213
213
  return true;
214
214
  }
215
215
 
216
216
  // Handle specific string literals - if schema expects specific strings and value is a string
217
- if (schemaType.includes('"') && inferredType === "string") {
217
+ if (inferredType === "string" && schemaType.includes('"')) {
218
218
  return true;
219
219
  }
220
220
 
@@ -301,12 +301,12 @@ function convertWithSchema(
301
301
 
302
302
  // Warn about type mismatches
303
303
  if (
304
- inferredType != null &&
305
304
  inferredType !== "" &&
305
+ inferredType != null &&
306
306
  !typesAreCompatible(inferredType, schemaType)
307
307
  ) {
308
308
  const propName =
309
- propertyName != null && propertyName !== "" ? `'${propertyName}': ` : "";
309
+ propertyName !== "" && propertyName != null ? `'${propertyName}': ` : "";
310
310
  console.warn(
311
311
  ` ⚠️ Type mismatch for ${propName}Schema says '${schemaType}' but value suggests '${inferredType}' (value: ${String(value).slice(0, 50)})`,
312
312
  );
@@ -417,14 +417,14 @@ function inferUniformArrayType(
417
417
  const { nestedTypeName, chartName, fullKey, propertyName, yamlComment } = ctx;
418
418
  const elementType = [...elementTypes][0];
419
419
  const elementProp = elementTypeProps[0];
420
- if (elementType == null || elementType === "" || !elementProp) {
420
+ if (elementType === "" || !elementProp || elementType == null) {
421
421
  return { type: "unknown[]", optional: true };
422
422
  }
423
423
 
424
424
  if (elementProp.nested) {
425
425
  const arrayElementTypeName = `${nestedTypeName}Element`;
426
426
  const allowArbitraryProps =
427
- chartName != null && chartName !== "" && fullKey != null && fullKey !== ""
427
+ chartName !== "" && fullKey !== "" && chartName != null && fullKey != null
428
428
  ? shouldAllowArbitraryProps(
429
429
  fullKey,
430
430
  chartName,
@@ -478,7 +478,7 @@ function convertValueToProperty(opts: PropertyConversionContext): TypeProperty {
478
478
  // only allow cpu). Emit the canonical permissive type instead — but only
479
479
  // when the default value's shape is compatible, so RBAC `resources:
480
480
  // ["secrets"]` arrays stay arrays.
481
- if (propertyName != null && propertyName !== "") {
481
+ if (propertyName !== "" && propertyName != null) {
482
482
  const wellKnown = getWellKnownK8sFieldType(propertyName, value);
483
483
  if (wellKnown) {
484
484
  return {
@@ -186,26 +186,26 @@ export function typesAreCompatible(
186
186
  if (schemaTypes.length > 1) {
187
187
  for (const st of schemaTypes) {
188
188
  // Handle quoted strings in unions (like "default")
189
- if (st.startsWith('"') && st.endsWith('"') && inferredType === "string") {
189
+ if (inferredType === "string" && st.startsWith('"') && st.endsWith('"')) {
190
190
  return true;
191
191
  }
192
192
  if (st === inferredType) {
193
193
  return true;
194
194
  }
195
195
  // Arrays
196
- if (st.endsWith("[]") && inferredType === "array") {
196
+ if (inferredType === "array" && st.endsWith("[]")) {
197
197
  return true;
198
198
  }
199
199
  }
200
200
  }
201
201
 
202
202
  // Handle array types
203
- if (schemaType.endsWith("[]") && inferredType === "array") {
203
+ if (inferredType === "array" && schemaType.endsWith("[]")) {
204
204
  return true;
205
205
  }
206
206
 
207
207
  // Handle specific string literals - if schema expects specific strings and value is a string
208
- if (schemaType.includes('"') && inferredType === "string") {
208
+ if (inferredType === "string" && schemaType.includes('"')) {
209
209
  return true;
210
210
  }
211
211
 
@@ -272,10 +272,10 @@ function mergeDescriptions(
272
272
  schemaDescription: string | undefined,
273
273
  yamlComment: string | undefined,
274
274
  ): string | undefined {
275
- if (yamlComment == null || yamlComment === "") {
275
+ if (yamlComment === "" || yamlComment == null) {
276
276
  return schemaDescription;
277
277
  }
278
- return schemaDescription != null && schemaDescription !== ""
278
+ return schemaDescription !== "" && schemaDescription != null
279
279
  ? `${yamlComment}\n\n${schemaDescription}`
280
280
  : yamlComment;
281
281
  }
@@ -300,12 +300,12 @@ function convertWithSchema(
300
300
  const schemaType = jsonSchemaToTypeScript(schema);
301
301
 
302
302
  if (
303
- inferredType != null &&
304
303
  inferredType !== "" &&
304
+ inferredType != null &&
305
305
  !typesAreCompatible(inferredType, schemaType)
306
306
  ) {
307
307
  const propName =
308
- propertyName != null && propertyName !== "" ? `'${propertyName}': ` : "";
308
+ propertyName !== "" && propertyName != null ? `'${propertyName}': ` : "";
309
309
  console.warn(
310
310
  ` ⚠️ Type mismatch for ${propName}Schema says '${schemaType}' but value suggests '${inferredType}' (value: ${String(value).slice(0, 50)})`,
311
311
  );
@@ -412,7 +412,7 @@ function inferUniformArrayType(
412
412
  ): TypeProperty {
413
413
  const elementType = [...elementTypes][0];
414
414
  const elementProp = elementTypeProps[0];
415
- if (elementType == null || elementType === "" || !elementProp) {
415
+ if (elementType === "" || !elementProp || elementType == null) {
416
416
  return { type: "unknown[]", optional: true };
417
417
  }
418
418
 
@@ -18,7 +18,7 @@ function isPartOfYAMLBlock(line: string, trimmed: string): boolean {
18
18
  function isSectionHeaderForCommentedBlock(
19
19
  nextLine: string | undefined,
20
20
  ): boolean {
21
- if (nextLine == null || nextLine === "") {
21
+ if (nextLine === "" || nextLine == null) {
22
22
  return false;
23
23
  }
24
24
  const nextTrimmed = nextLine.trim();
@@ -22,7 +22,7 @@ export function parseCommentsWithRegex(
22
22
  if (!trimmed) {
23
23
  // Only reset if we had a commented-out key (pendingCommentIndent === -1)
24
24
  // This allows multi-line comments for real keys to work
25
- if (pendingComment.length > 0 && pendingCommentIndent === -1) {
25
+ if (pendingCommentIndent === -1 && pendingComment.length > 0) {
26
26
  pendingDebugInfo.push(
27
27
  `Line ${String(lineNum)}: Blank line after commented-out key, resetting pending`,
28
28
  );
@@ -98,7 +98,7 @@ export function parseCommentsWithRegex(
98
98
  const keyMatch = keyMatchRegex.exec(trimmed);
99
99
  if (keyMatch && pendingComment.length > 0) {
100
100
  const key = keyMatch[1];
101
- if (key != null && key !== "") {
101
+ if (key !== "" && key != null) {
102
102
  const keyIndent = line.search(/\S/);
103
103
 
104
104
  // Only associate comment if indentation matches closely
@@ -45,7 +45,7 @@ export function isSimpleYAMLValue(line: string): boolean {
45
45
  * Exported for testing purposes
46
46
  */
47
47
  export function isSectionHeader(line: string, nextLine?: string): boolean {
48
- if (nextLine == null || nextLine === "") {
48
+ if (nextLine === "" || nextLine == null) {
49
49
  return false;
50
50
  }
51
51
 
@@ -119,7 +119,7 @@ export function looksLikeProse(line: string, wordCount: number): boolean {
119
119
  const hasURL = line.includes("http://") || line.includes("https://");
120
120
  const startsWithCapital = /^[A-Z]/.test(line);
121
121
  const hasEndPunctuation = /[.!?:]$/.test(line);
122
- const notYamlKey = !(isYAMLKey(line) && !hasURL && !/^ref:/i.test(line));
122
+ const notYamlKey = !(!hasURL && isYAMLKey(line) && !/^ref:/i.test(line));
123
123
  const reasonableLength = line.length > 10;
124
124
  const hasMultipleWords = wordCount >= 3;
125
125
  const startsWithArticle = /^(?:This|The|A|An)\s/i.test(line);
@@ -257,10 +257,10 @@ export function parseBitnamiParams(comment: string): {
257
257
  if (paramMatch) {
258
258
  const [, paramKey, description] = paramMatch;
259
259
  if (
260
- paramKey != null &&
261
260
  paramKey !== "" &&
262
- description != null &&
263
- description !== ""
261
+ description !== "" &&
262
+ paramKey != null &&
263
+ description != null
264
264
  ) {
265
265
  params.set(paramKey, description);
266
266
  }
@@ -343,7 +343,7 @@ export function parseYAMLCommentsWithMetadata(
343
343
  comment = comment ? `${comment}\n${inlineComment}` : inlineComment;
344
344
  }
345
345
  // First item inherits map comment if it has none
346
- if (context.index === 0 && !comment && context.mapComment) {
346
+ if (!comment && context.index === 0 && context.mapComment) {
347
347
  comment = context.mapComment;
348
348
  }
349
349
  if (comment) {
@@ -128,7 +128,7 @@ function tryUncommentLine(
128
128
  }
129
129
 
130
130
  const [, indent, keyValue] = commentedKeyMatch;
131
- if (keyValue == null || keyValue === "" || indent == null || indent === "") {
131
+ if (keyValue === "" || indent === "" || keyValue == null || indent == null) {
132
132
  return {
133
133
  uncommented: null,
134
134
  newConsecutive: state.consecutiveCommentedKeys,