@twin.org/validate-locales 0.0.3-next.1 → 0.0.3-next.2

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/es/cli.js CHANGED
@@ -20,7 +20,7 @@ export class CLI extends CLIBase {
20
20
  return this.execute({
21
21
  title: "TWIN Validate Locales",
22
22
  appName: "validate-locales",
23
- version: "0.0.3-next.1", // x-release-please-version
23
+ version: "0.0.3-next.2", // x-release-please-version
24
24
  icon: "⚙️ ",
25
25
  supportsEnvFiles: false,
26
26
  overrideOutputWidth: options?.overrideOutputWidth
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAA0C;QAE1C,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,kBAAkB;YAC3B,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandValidateLocales } from \"./commands/validateLocales.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Validate Locales\",\n\t\t\t\tappName: \"validate-locales\",\n\t\t\t\tversion: \"0.0.3-next.1\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: false,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandValidateLocales(program);\n\t}\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAA0C;QAE1C,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,kBAAkB;YAC3B,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandValidateLocales } from \"./commands/validateLocales.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Validate Locales\",\n\t\t\t\tappName: \"validate-locales\",\n\t\t\t\tversion: \"0.0.3-next.2\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: false,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandValidateLocales(program);\n\t}\n}\n"]}
@@ -392,6 +392,14 @@ function processCallExpression(sourceFile, node, localeEntries, failures, captur
392
392
  });
393
393
  }
394
394
  }
395
+ else {
396
+ failures.push({
397
+ type: "key",
398
+ key: message?.getText() ?? "",
399
+ source: path.resolve(sourceFile.fileName),
400
+ ...getSourcePosition(sourceFile, node)
401
+ });
402
+ }
395
403
  return true;
396
404
  }
397
405
  else if (functionName === "formatMessage" &&
@@ -1 +1 @@
1
- {"version":3,"file":"validateLocales.js","sourceRoot":"","sources":["../../../src/commands/validateLocales.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,MAAM,WAAW,GAAG;IACnB,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC,EAAE;IACjD,EAAE,IAAI,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC,CAAC,EAAE;IACh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,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAE/B,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC5B,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;gBAED,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { GeneralError, I18n, Is, StringHelper, type ILocaleDictionary } from \"@twin.org/core\";\nimport { manual } from \"@twin.org/nameof-transformer\";\nimport type { Command } from \"commander\";\nimport * as glob from \"glob\";\nimport * as ts from \"typescript\";\nimport type { ILocaleDictionaryEntry } from \"../models/ILocaleDictionaryEntry.js\";\nimport type { ILocaleFailure } from \"../models/ILocaleFailure.js\";\n\nconst ERROR_TYPES = [\n\t{ name: \"GeneralError\", dynamicPropertyIndex: 2 },\n\t{ name: \"GuardError\", dynamicPropertyIndex: -1 },\n\t{ name: \"ValidationError\", dynamicPropertyIndex: -1 },\n\t{ name: \"FetchError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"httpStatus\"] },\n\t{ name: \"NotFoundError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"notFoundId\"] },\n\t{ name: \"AlreadyExistsError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"existingId\"] },\n\t{ name: \"UnauthorizedError\", dynamicPropertyIndex: 2 },\n\t{ name: \"NotSupportedError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"methodName\"] },\n\t{ name: \"UnprocessableError\", dynamicPropertyIndex: 2 },\n\t{ name: \"ConflictError\", dynamicPropertyIndex: 4, inbuiltProperties: [\"conflictId\", \"conflicts\"] }\n];\n\nconst SKIP_FILES = [\"**/models/**/*.ts\"];\n\nconst SKIP_LITERALS = [\n\t/^\\d+\\.\\d+\\.\\d+(-\\w+(\\.\\w+)*)?(-\\d)?$/, // Version string\n\t/^[^@]+@[^@]+\\.[^@]+$/, // Email string\n\t/\\.json$/i, // ending in .json\n\t/\\.js$/i, // ending in .js\n\t/\\.ts$/i, // ending in .ts\n\t/\\.env$/i, // ending in .env\n\t/\\.png$/i, // ending in .png\n\t/\\.lock$/i, // ending in .lock\n\t/\\.toml$/i, // ending in .toml\n\t/\\.{3}/i, // ...\n\t/@twin\\.org/, // starting with @twin.org\n\t/^console.log/i // console.log\n];\n\nconst SKIP_METHODS = [/^generateRest/, /^generateSocket/];\n\nconst CAPTURE_VARIABLES = [/ROUTES_SOURCE/];\n\n/**\n * Build the root command to be consumed by the CLI.\n * @param program The command to build on.\n */\nexport function buildCommandValidateLocales(program: Command): void {\n\tprogram\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.source.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.source.description\"),\n\t\t\t\"src/**/*.ts\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.locales.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.locales.description\"),\n\t\t\t\"locales/**/*.json\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.ignoreFile.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.ignoreFile.description\"),\n\t\t\t\"locales/.validate-ignore\"\n\t\t)\n\t\t.action(async opts => {\n\t\t\tawait actionCommandValidateLocales(opts);\n\t\t});\n}\n\n/**\n * Action the root command.\n * @param opts The options for the command.\n * @param opts.source The source glob.\n * @param opts.locales The locales glob.\n * @param opts.ignoreFile The ignore file path.\n */\nexport async function actionCommandValidateLocales(opts: {\n\tsource: string;\n\tlocales: string;\n\tignoreFile: string;\n}): Promise<void> {\n\topts.source = path.resolve(opts.source);\n\topts.locales = path.resolve(opts.locales);\n\topts.ignoreFile = path.resolve(opts.ignoreFile);\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.validate-locales.labels.source\"), opts.source);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.validate-locales.labels.locales\"), opts.locales);\n\tlet ignore: string[] = [];\n\n\tif (await CLIUtils.fileExists(opts.ignoreFile)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.ignoreFile\"),\n\t\t\topts.ignoreFile\n\t\t);\n\t\tignore = (await CLIUtils.readLinesFile(opts.ignoreFile)) ?? [];\n\t}\n\n\tCLIDisplay.break();\n\n\tconst sources = glob.sync(opts.source.replace(/\\\\/g, \"/\"), { ignore: SKIP_FILES });\n\tconst locales = glob.sync(opts.locales.replace(/\\\\/g, \"/\"));\n\n\tif (sources.length === 0) {\n\t\tCLIDisplay.warning(I18n.formatMessage(\"commands.validate-locales.warnings.noSourceFiles\"));\n\t} else if (locales.length === 0) {\n\t\tCLIDisplay.warning(I18n.formatMessage(\"commands.validate-locales.warnings.noLocaleFiles\"));\n\t} else {\n\t\tawait validateLocales(\n\t\t\tsources,\n\t\t\tlocales,\n\t\t\tignore.filter(i => Is.stringValue(i) && !i.startsWith(\"#\")).map(i => new RegExp(i))\n\t\t);\n\t}\n\n\tCLIDisplay.break();\n\tCLIDisplay.done();\n}\n\n/**\n * Validate the locales.\n * @param sourceFiles The source files.\n * @param localeFiles The locale files.\n * @param ignore The ignore list.\n */\nasync function validateLocales(\n\tsourceFiles: string[],\n\tlocaleFiles: string[],\n\tignore: RegExp[]\n): Promise<void> {\n\tconst localeEntries: ILocaleDictionaryEntry[] = [];\n\n\tlet hasQuoteError = false;\n\tlet hasUnused = false;\n\tlet hasFailures = false;\n\n\tfor (const localeFile of localeFiles) {\n\t\tconst dictionary = await CLIUtils.readJsonFile<ILocaleDictionary>(localeFile);\n\t\tconst locale = path.basename(localeFile, path.extname(localeFile));\n\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.progress.validatingLocale\", { localeFile })\n\t\t);\n\t\tCLIDisplay.break();\n\n\t\tif (Is.object<ILocaleDictionary>(dictionary)) {\n\t\t\tconst mergedKeys: { [key: string]: string } = {};\n\t\t\tI18n.flattenTranslationKeys(dictionary, \"\", mergedKeys);\n\n\t\t\tfor (const flatKey of Object.keys(mergedKeys)) {\n\t\t\t\tif (/'{.*?}'/.test(mergedKeys[flatKey])) {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.usesSingleQuotes\", {\n\t\t\t\t\t\t\tkey: flatKey\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\thasQuoteError = true;\n\t\t\t\t}\n\n\t\t\t\tlocaleEntries.push({\n\t\t\t\t\tlocale,\n\t\t\t\t\tkey: flatKey,\n\t\t\t\t\tvalue: mergedKeys[flatKey],\n\t\t\t\t\tpropertyNames: I18n.getPropertyNames(mergedKeys[flatKey]),\n\t\t\t\t\treferenced: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tlet failures: ILocaleFailure[] = [];\n\t\tconst captureVariables: { [name: string]: ts.Node } = {};\n\n\t\tfor (const sourceFile of sourceFiles) {\n\t\t\tconst source = await readFile(sourceFile, \"utf8\");\n\n\t\t\tconst sourceTs = ts.createSourceFile(\n\t\t\t\tsourceFile,\n\t\t\t\tsource,\n\t\t\t\tts.ScriptTarget.ESNext,\n\t\t\t\ttrue,\n\t\t\t\tts.ScriptKind.TS\n\t\t\t);\n\n\t\t\tvisit(sourceTs, sourceTs, localeEntries, failures, captureVariables);\n\t\t}\n\n\t\tfailures = failures.filter(mr => !ignore.some(pattern => pattern.test(mr.key)));\n\n\t\tif (failures.length === 0) {\n\t\t\tCLIDisplay.write(\n\t\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.noMissingLocaleEntries\")\n\t\t\t);\n\t\t\tCLIDisplay.break();\n\t\t} else {\n\t\t\thasFailures = true;\n\t\t\tfor (const failureRef of failures) {\n\t\t\t\tif (failureRef.type === \"key\") {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.missingLocaleEntry\", {\n\t\t\t\t\t\t\tkey: failureRef.key,\n\t\t\t\t\t\t\tsource: failureRef.source,\n\t\t\t\t\t\t\tline: failureRef.line,\n\t\t\t\t\t\t\tcolumn: failureRef.column\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tCLIDisplay.break();\n\n\t\tfor (const localeEntry of localeEntries) {\n\t\t\tif (ignore.some(pattern => pattern.test(localeEntry.key))) {\n\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t}\n\t\t}\n\n\t\tif (localeEntries.filter(le => !le.referenced).length === 0) {\n\t\t\tCLIDisplay.write(\n\t\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.noUnusedLocaleEntries\")\n\t\t\t);\n\t\t\tCLIDisplay.break();\n\t\t} else {\n\t\t\thasUnused = true;\n\t\t\tfor (const localeEntry of localeEntries) {\n\t\t\t\tif (!localeEntry.referenced) {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.unusedLocaleEntry\", {\n\t\t\t\t\t\t\tkey: localeEntry.key\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (hasFailures || hasUnused || hasQuoteError) {\n\t\tthrow new GeneralError(\"validateLocales\", \"validationFailed\");\n\t}\n}\n\n/**\n * Visit the node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to visit.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n */\nfunction visit(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.Node,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): void {\n\tlet handled = false;\n\tif (\n\t\tts.isNewExpression(node) &&\n\t\tts.isIdentifier(node.expression) &&\n\t\tERROR_TYPES.some(errorType => errorType.name === node.expression.getText())\n\t) {\n\t\tprocessErrorType(sourceFile, node, node.expression.text, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isStringLiteral(node)) {\n\t\tprocessStringLiteral(sourceFile, node, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isTemplateExpression(node)) {\n\t\tprocessTemplateExpression(sourceFile, node, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isCallExpression(node)) {\n\t\thandled = processCallExpression(sourceFile, node, localeEntries, failures, captureVariables);\n\t} else if (ts.isFunctionDeclaration(node)) {\n\t\thandled = processFunctionDeclaration(sourceFile, node, localeEntries, failures);\n\t} else if (ts.isVariableDeclaration(node)) {\n\t\thandled = processVariableDeclaration(\n\t\t\tsourceFile,\n\t\t\tnode,\n\t\t\tlocaleEntries,\n\t\t\tfailures,\n\t\t\tcaptureVariables\n\t\t);\n\t} else if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {\n\t\t// Don't care about string in imports/exports\n\t\thandled = true;\n\t} else if (ts.isPropertyAssignment(node)) {\n\t\thandled = processPropertyAssignment(sourceFile, node, localeEntries, failures);\n\t}\n\n\tif (!handled) {\n\t\tts.forEachChild(node, child =>\n\t\t\tvisit(sourceFile, child, localeEntries, failures, captureVariables)\n\t\t);\n\t}\n}\n\n/**\n * Process an error type node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param errorType The error type.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processErrorType(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.NewExpression,\n\terrorType: string,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\tconst errType = ERROR_TYPES.find(e => e.name === errorType);\n\n\tif (Is.object(errType)) {\n\t\tconst localeKey = localeFromClassAndMessage(\n\t\t\tsourceFile,\n\t\t\tnode.arguments?.[0],\n\t\t\tnode.arguments?.[1],\n\t\t\t\"error\",\n\t\t\tfailures\n\t\t);\n\n\t\tif (Is.stringValue(localeKey)) {\n\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\tif (errType.dynamicPropertyIndex !== -1 || Is.arrayValue(errType.inbuiltProperties)) {\n\t\t\t\t\tconst usedProperties = errType.inbuiltProperties?.slice() ?? [];\n\n\t\t\t\t\tif (errType.dynamicPropertyIndex !== -1) {\n\t\t\t\t\t\tusedProperties.push(\n\t\t\t\t\t\t\t...getPropertiesFromNode(node.arguments?.[errType.dynamicPropertyIndex])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, usedProperties, failures);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: localeKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tCLIDisplay.errorMessage(\n\t\tI18n.formatMessage(\"error.validateLocales.unableToProcessContent\", { content: node.getText() })\n\t);\n}\n\n/**\n * Find the locale entry if it exists.\n * @param localeEntries The locale entries.\n * @param entryToMatch The full key to check.\n * @returns The item if found, undefined otherwise.\n */\nfunction findAndReferenceLocale(\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tentryToMatch: string\n): ILocaleDictionaryEntry | undefined {\n\tif (Is.stringValue(entryToMatch)) {\n\t\tconst found = localeEntries.find(le => le.key === entryToMatch);\n\t\tif (found) {\n\t\t\tfound.referenced = true;\n\t\t\treturn found;\n\t\t}\n\t}\n}\n\n/**\n * Process a string literal node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processStringLiteral(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.StringLiteral,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\tif (\n\t\tnode.text.length > 3 &&\n\t\tnode.text.includes(\".\") &&\n\t\t!/[ ()/]/.test(node.text) &&\n\t\t!/^\\.|\\.$/.test(node.text) &&\n\t\t!isSkipLiteral(node.text)\n\t) {\n\t\tconst parts = node.text.split(\".\");\n\t\tif (parts.length > 1) {\n\t\t\t// First try and match the string as-is\n\t\t\tlet localeEntry = findAndReferenceLocale(localeEntries, node.text);\n\t\t\tif (localeEntry) {\n\t\t\t\tlocaleEntry.referenced = true;\n\n\t\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, node.text, usedProperties, failures);\n\t\t\t}\n\n\t\t\tif (!localeEntry && [\"validation.\", \"common.\"].some(t => node.text.startsWith(t))) {\n\t\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${node.text}`);\n\t\t\t\tif (localeEntry) {\n\t\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\t\t\tcheckPropertyUsage(\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tlocaleEntry,\n\t\t\t\t\t\t`error.${node.text}`,\n\t\t\t\t\t\tusedProperties,\n\t\t\t\t\t\tfailures\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!localeEntry) {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: node.text,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Process a template expression node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processTemplateExpression(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.TemplateExpression,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\t// This case handles templates like `error.${nameof(Class)}.message`\n\tconst templateParts = extractTemplatePartsWithExpressions(node);\n\n\t// Join all literal text parts to form a potential locale key\n\tif (hasValidTemplateContent(templateParts)) {\n\t\tconst key = expandTemplateParts(templateParts);\n\n\t\tlet localeEntry = findAndReferenceLocale(localeEntries, key);\n\t\tif (localeEntry) {\n\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeEntry.key, usedProperties, failures);\n\t\t} else if ([\"validation.\", \"common.\"].some(t => key.startsWith(t))) {\n\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${key}`);\n\n\t\t\tif (localeEntry) {\n\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t\tconst usedProperties = getPropertiesFromNode(node.parent.parent);\n\n\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, `error.${key}`, usedProperties, failures);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Process a call expression node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n * @returns True if processed, false otherwise.\n */\nfunction processCallExpression(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.CallExpression,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): boolean {\n\tif (ts.isPropertyAccessExpression(node.expression)) {\n\t\tconst functionName = node.expression.name.getText();\n\t\tif (node.expression.getText() === \"console.log\") {\n\t\t\treturn true;\n\t\t} else if (\n\t\t\tfunctionName === \"log\" &&\n\t\t\tnode.arguments.length === 1 &&\n\t\t\tts.isObjectLiteralExpression(node.arguments[0])\n\t\t) {\n\t\t\tlet level;\n\t\t\tlet source;\n\t\t\tlet message;\n\t\t\tlet dataNames;\n\t\t\tfor (const prop of node.arguments[0].properties) {\n\t\t\t\tif (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n\t\t\t\t\tif (prop.name.text === \"source\") {\n\t\t\t\t\t\tif (ts.isIdentifier(prop.initializer) && captureVariables[prop.initializer.text]) {\n\t\t\t\t\t\t\tsource = captureVariables[prop.initializer.text];\n\t\t\t\t\t\t} else if (ts.isStringLiteral(prop.initializer)) {\n\t\t\t\t\t\t\tsource = prop.initializer;\n\t\t\t\t\t\t} else if (ts.isPropertyAccessExpression(prop.initializer)) {\n\t\t\t\t\t\t\tsource = prop.initializer;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (prop.name.text === \"message\") {\n\t\t\t\t\t\tmessage = prop.initializer;\n\t\t\t\t\t} else if (prop.name.text === \"data\") {\n\t\t\t\t\t\tdataNames = getPropertiesFromNode(prop.initializer);\n\t\t\t\t\t} else if (prop.name.text === \"level\") {\n\t\t\t\t\t\tlevel = getExpandedText(prop.initializer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst localeKey = localeFromClassAndMessage(sourceFile, source, message, level, failures);\n\n\t\t\tif (Is.stringValue(localeKey)) {\n\t\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, dataNames ?? [], failures);\n\t\t\t\t} else {\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"key\",\n\t\t\t\t\t\tkey: localeKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else if (\n\t\t\tfunctionName === \"formatMessage\" &&\n\t\t\tnode.arguments.length === 2 &&\n\t\t\tts.isTemplateExpression(node.arguments[0]) &&\n\t\t\tts.isObjectLiteralExpression(node.arguments[1])\n\t\t) {\n\t\t\tconst localeKey = getExpandedText(node.arguments[0]);\n\n\t\t\tif (Is.stringValue(localeKey)) {\n\t\t\t\tconst dataNames = getPropertiesFromNode(node.arguments[1]);\n\t\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, dataNames ?? [], failures);\n\t\t\t\t} else {\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"key\",\n\t\t\t\t\t\tkey: localeKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Process a function declaration node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @returns True if processed, false otherwise.\n */\nfunction processFunctionDeclaration(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.FunctionDeclaration,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): boolean {\n\tif (\n\t\tIs.object(node.name) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tSKIP_METHODS.some(re => re.test(node.name?.text ?? \"\"))\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Process a variable statement declaration node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n * @returns True if processed, false otherwise.\n */\nfunction processVariableDeclaration(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.VariableDeclaration,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): boolean {\n\tif (\n\t\tIs.object(node.name) &&\n\t\tIs.object(node.initializer) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tts.isStringLiteral(node.initializer) &&\n\t\tCAPTURE_VARIABLES.some(re => re.test(node.name.getText()))\n\t) {\n\t\tcaptureVariables[node.name.getText()] = node.initializer;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Process a property assignment node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @returns True if processed, false otherwise.\n */\nfunction processPropertyAssignment(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.PropertyAssignment,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): boolean {\n\tif (Is.object(node.name) && ts.isIdentifier(node.name) && node.name.getText() === \"message\") {\n\t\tconst localeKey = getExpandedText(node.initializer);\n\n\t\tif (Is.stringValue(localeKey)) {\n\t\t\tlet localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\tif (!Is.object(localeEntry)) {\n\t\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${localeKey}`);\n\t\t\t}\n\n\t\t\tif (!Is.object(localeEntry)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: localeKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Get the expanded text from a node.\n * @param node The node to get the text from.\n * @returns The expanded text.\n */\nfunction getExpandedText(node: ts.Node): string {\n\tif (ts.isTemplateExpression(node)) {\n\t\tconst templateParts = extractTemplatePartsWithExpressions(node);\n\t\tif (hasValidTemplateContent(templateParts)) {\n\t\t\treturn expandTemplateParts(templateParts);\n\t\t}\n\t} else if (ts.isStringLiteral(node)) {\n\t\tif (hasValidTemplateContent([node.text])) {\n\t\t\treturn node.text;\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Extract parts from a template literal, splitting by ${} expressions.\n * @param node The template expression node.\n * @returns Array of parts including expressions and literal text.\n */\nfunction extractTemplatePartsWithExpressions(node: ts.TemplateExpression): string[] {\n\tconst parts: string[] = [];\n\n\t// Start with the head (text before first ${})\n\tif (node.head.text) {\n\t\tparts.push(node.head.text);\n\t}\n\n\t// Process each template span (${expression}text)\n\tfor (const span of node.templateSpans) {\n\t\t// Add the expression part as text\n\t\tparts.push(span.expression.getText());\n\n\t\t// Add the literal text after the expression\n\t\tif (span.literal.text) {\n\t\t\tparts.push(span.literal.text);\n\t\t}\n\t}\n\n\treturn parts.filter(part => part.length > 0);\n}\n\n/**\n * Check if the content has any parts which contain elements which determine is is not an locale key.\n * @param templateParts The template parts to check.\n * @returns True if the template parts are valid, false otherwise.\n */\nfunction hasValidTemplateContent(templateParts: string[]): boolean {\n\treturn !templateParts.some(part => /[#,/:=?|]/.test(part));\n}\n\n/**\n * Expand template parts into a single string, processing nameof expressions.\n * @param templateParts The template parts to expand.\n * @returns The expanded template string.\n */\nfunction expandTemplateParts(templateParts: string[]): string {\n\tfor (let i = 0; i < templateParts.length; i++) {\n\t\ttemplateParts[i] = expandTemplatePart(templateParts[i]);\n\t}\n\n\treturn templateParts.join(\"\");\n}\n\n/**\n * Expand template part into a single string, processing nameof expressions.\n * @param templatePart The template part to expand.\n * @returns The expanded template string.\n */\nfunction expandTemplatePart(templatePart: string): string {\n\tif (templatePart.startsWith(\"nameof\")) {\n\t\tconst stripped = manual(templatePart).replace(/[\"']/g, \"\");\n\t\ttemplatePart = StringHelper.camelCase(stripped, true);\n\t} else if (templatePart.startsWith(\"StringHelper.\")) {\n\t\ttemplatePart = templatePart.replace(/\\.CLASS_NAME/g, \"\");\n\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.camelCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.camelCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.titleCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.titleCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.pascalCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.pascalCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.kebabCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.kebabCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.snakeCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.snakeCase(i)\n\t\t);\n\t} else if (templatePart.includes(\".CLASS_NAME\")) {\n\t\ttemplatePart = StringHelper.camelCase(templatePart.replace(/\\.CLASS_NAME/g, \"\"));\n\t}\n\ttemplatePart = templatePart.replace(/[\"'`]/g, \"\"); // Remove quotes\n\n\treturn templatePart;\n}\n\n/**\n * Check the property usage in a locale entry against the used properties.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to check.\n * @param localeEntry The locale entry to check against.\n * @param key The key in the locale entry.\n * @param usedProperties The properties used in the code.\n * @param failures The failure entries.\n */\nfunction checkPropertyUsage(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.Node,\n\tlocaleEntry: ILocaleDictionaryEntry,\n\tkey: string,\n\tusedProperties: string[],\n\tfailures: ILocaleFailure[]\n): void {\n\tfor (const propName of localeEntry.propertyNames) {\n\t\tconst propIndex = usedProperties.indexOf(propName);\n\t\tif (propIndex === -1) {\n\t\t\tconst position = getSourcePosition(sourceFile, node);\n\t\t\tCLIDisplay.errorMessage(\n\t\t\t\tI18n.formatMessage(\"error.validateLocales.missingPropertyInLocale\", {\n\t\t\t\t\tkey,\n\t\t\t\t\tproperty: propName,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\tline: position.line,\n\t\t\t\t\tcolumn: position.column\n\t\t\t\t})\n\t\t\t);\n\t\t\tfailures.push({\n\t\t\t\ttype: \"property\",\n\t\t\t\tkey: localeEntry.key,\n\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t...position\n\t\t\t});\n\t\t}\n\t}\n\n\t// We often pass additional properties in the error details to better inform the logging\n\t// so we don't want to perform the opposite check for parameters in the call but not in the locale entry\n}\n\n/**\n * Helper to get line and column position from a node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param n The node to get position for.\n * @returns Line and column (1-based).\n */\nfunction getSourcePosition(\n\tsourceFile: ts.SourceFile,\n\tn: ts.Node\n): { line: number; column: number } {\n\tconst { line, character } = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n\treturn { line: line + 1, column: character + 1 };\n}\n\n/**\n * Get property names from a node.\n * @param node The node to get property names from.\n * @returns The property names.\n */\nfunction getPropertiesFromNode(node?: ts.Node): string[] {\n\tif (!node) {\n\t\treturn [];\n\t}\n\n\tconst props: string[] = [];\n\n\t// If this is an object literal then we can get the property names\n\tif (ts.isObjectLiteralExpression(node)) {\n\t\t// Get the properties of the object literal\n\t\tconst properties = node.properties;\n\t\tfor (const prop of properties) {\n\t\t\tif (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n\t\t\t\t// { property: value }\n\t\t\t\tprops.push(prop.name.text);\n\n\t\t\t\t// { property: { nestedProperty: value } }\n\t\t\t\tif (ts.isObjectLiteralExpression(prop.initializer)) {\n\t\t\t\t\t// Recursively get properties from nested object literals\n\t\t\t\t\tconst nestedProps = getPropertiesFromNode(prop.initializer);\n\t\t\t\t\tprops.push(...nestedProps);\n\t\t\t\t}\n\t\t\t} else if (ts.isShorthandPropertyAssignment(prop)) {\n\t\t\t\t// { property }\n\t\t\t\tprops.push(prop.getText());\n\t\t\t}\n\t\t}\n\t} else if (ts.isStringLiteral(node)) {\n\t\t// If this is a string literal then there are no properties\n\t\t// so we need to look in the surrounding context\n\t\tconst parent = node.parent;\n\t\tif (ts.isCallExpression(parent) || ts.isNewExpression(parent)) {\n\t\t\t// Let's see if they are the next argument in the call\n\t\t\tconst args = parent.arguments;\n\t\t\tif (args && args.length > 0) {\n\t\t\t\tconst index = args.findIndex(a => a === node);\n\t\t\t\tif (index !== -1 && index + 1 < args.length) {\n\t\t\t\t\treturn getPropertiesFromNode(args[index + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ts.isPropertyAssignment(parent)) {\n\t\t\t// This is part of a property assignment in an object\n\t\t\t// so we can check the parent object for other properties\n\t\t\tif (ts.isObjectLiteralExpression(parent.parent)) {\n\t\t\t\treturn getPropertiesFromNode(parent.parent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n\n/**\n * Check if a value is a file operation.\n * @param value The value to check.\n * @returns True if the value is a file operation.\n */\nfunction isSkipLiteral(value: string): boolean {\n\treturn SKIP_LITERALS.some(regex => regex.test(value));\n}\n\n/**\n * Get the locale from the class and message nodes.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param classNode The class node.\n * @param messageNode The message node.\n * @param prefix The prefix for the locale key.\n * @param failures The failure entries.\n * @returns The locale entry or undefined.\n */\nfunction localeFromClassAndMessage(\n\tsourceFile: ts.SourceFile,\n\tclassNode: ts.Node | undefined,\n\tmessageNode: ts.Node | undefined,\n\tprefix: string | undefined,\n\tfailures: ILocaleFailure[]\n): string | undefined {\n\tif (!classNode || !messageNode) {\n\t\treturn undefined;\n\t}\n\n\tconst classNameParam = classNode.getText();\n\tconst classNameParamParts = classNameParam?.split(\".\");\n\n\tif (Is.array(classNameParamParts)) {\n\t\tconst messageKey = getExpandedText(messageNode);\n\n\t\tif (Is.stringValue(messageKey)) {\n\t\t\tif (messageKey.includes(\" \")) {\n\t\t\t\t// If the message contains spaces then it is not a key\n\t\t\t\t// but should be replaced by one\n\t\t\t\tconst position = getSourcePosition(sourceFile, messageNode);\n\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.shouldBeKey\", {\n\t\t\t\t\t\tvalue: messageKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\tline: position.line,\n\t\t\t\t\t\tcolumn: position.column\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"noKey\",\n\t\t\t\t\tkey: messageKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...position\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst finalKeyParts = [];\n\n\t\t\t\tconst classNameExpanded = expandTemplatePart(classNameParam);\n\t\t\t\tconst messageKeyParts = messageKey.split(\".\");\n\n\t\t\t\tif (messageKeyParts.length === 2 && classNameExpanded === messageKeyParts[0]) {\n\t\t\t\t\t// But if it is fully qualified with exactly two segments and starts with the class name\n\t\t\t\t\t// then the class name is redundant and should be removed in the source\n\t\t\t\t\tconst position = getSourcePosition(sourceFile, messageNode);\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.noNeedToQualify\", {\n\t\t\t\t\t\t\tkey: messageKey,\n\t\t\t\t\t\t\tproperty: classNameParam,\n\t\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t\tline: position.line,\n\t\t\t\t\t\t\tcolumn: position.column\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"qualify\",\n\t\t\t\t\t\tkey: messageKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...position\n\t\t\t\t\t});\n\t\t\t\t} else if (!messageKey.includes(\".\")) {\n\t\t\t\t\t// If the key is not fully qualified then add the class name\n\t\t\t\t\t// to the final key\n\t\t\t\t\tfinalKeyParts.push(classNameExpanded);\n\t\t\t\t}\n\n\t\t\t\tfinalKeyParts.push(messageKey);\n\n\t\t\t\tif (Is.stringValue(prefix)) {\n\t\t\t\t\tfinalKeyParts.unshift(prefix);\n\t\t\t\t}\n\n\t\t\t\treturn finalKeyParts.join(\".\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
1
+ {"version":3,"file":"validateLocales.js","sourceRoot":"","sources":["../../../src/commands/validateLocales.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,MAAM,WAAW,GAAG;IACnB,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC,EAAE;IACjD,EAAE,IAAI,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC,CAAC,EAAE;IAChD,EAAE,IAAI,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC,CAAC,EAAE;IACrD,EAAE,IAAI,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,YAAY,CAAC,EAAE;IAClF,EAAE,IAAI,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,YAAY,CAAC,EAAE;IACrF,EAAE,IAAI,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAA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AAM,CAAC,EAAE,CAAC;oBAC5B,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;gBAED,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { GeneralError, I18n, Is, StringHelper, type ILocaleDictionary } from \"@twin.org/core\";\nimport { manual } from \"@twin.org/nameof-transformer\";\nimport type { Command } from \"commander\";\nimport * as glob from \"glob\";\nimport * as ts from \"typescript\";\nimport type { ILocaleDictionaryEntry } from \"../models/ILocaleDictionaryEntry.js\";\nimport type { ILocaleFailure } from \"../models/ILocaleFailure.js\";\n\nconst ERROR_TYPES = [\n\t{ name: \"GeneralError\", dynamicPropertyIndex: 2 },\n\t{ name: \"GuardError\", dynamicPropertyIndex: -1 },\n\t{ name: \"ValidationError\", dynamicPropertyIndex: -1 },\n\t{ name: \"FetchError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"httpStatus\"] },\n\t{ name: \"NotFoundError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"notFoundId\"] },\n\t{ name: \"AlreadyExistsError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"existingId\"] },\n\t{ name: \"UnauthorizedError\", dynamicPropertyIndex: 2 },\n\t{ name: \"NotSupportedError\", dynamicPropertyIndex: 3, inbuiltProperties: [\"methodName\"] },\n\t{ name: \"UnprocessableError\", dynamicPropertyIndex: 2 },\n\t{ name: \"ConflictError\", dynamicPropertyIndex: 4, inbuiltProperties: [\"conflictId\", \"conflicts\"] }\n];\n\nconst SKIP_FILES = [\"**/models/**/*.ts\"];\n\nconst SKIP_LITERALS = [\n\t/^\\d+\\.\\d+\\.\\d+(-\\w+(\\.\\w+)*)?(-\\d)?$/, // Version string\n\t/^[^@]+@[^@]+\\.[^@]+$/, // Email string\n\t/\\.json$/i, // ending in .json\n\t/\\.js$/i, // ending in .js\n\t/\\.ts$/i, // ending in .ts\n\t/\\.env$/i, // ending in .env\n\t/\\.png$/i, // ending in .png\n\t/\\.lock$/i, // ending in .lock\n\t/\\.toml$/i, // ending in .toml\n\t/\\.{3}/i, // ...\n\t/@twin\\.org/, // starting with @twin.org\n\t/^console.log/i // console.log\n];\n\nconst SKIP_METHODS = [/^generateRest/, /^generateSocket/];\n\nconst CAPTURE_VARIABLES = [/ROUTES_SOURCE/];\n\n/**\n * Build the root command to be consumed by the CLI.\n * @param program The command to build on.\n */\nexport function buildCommandValidateLocales(program: Command): void {\n\tprogram\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.source.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.source.description\"),\n\t\t\t\"src/**/*.ts\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.locales.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.locales.description\"),\n\t\t\t\"locales/**/*.json\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.ignoreFile.param\"),\n\t\t\tI18n.formatMessage(\"commands.validate-locales.options.ignoreFile.description\"),\n\t\t\t\"locales/.validate-ignore\"\n\t\t)\n\t\t.action(async opts => {\n\t\t\tawait actionCommandValidateLocales(opts);\n\t\t});\n}\n\n/**\n * Action the root command.\n * @param opts The options for the command.\n * @param opts.source The source glob.\n * @param opts.locales The locales glob.\n * @param opts.ignoreFile The ignore file path.\n */\nexport async function actionCommandValidateLocales(opts: {\n\tsource: string;\n\tlocales: string;\n\tignoreFile: string;\n}): Promise<void> {\n\topts.source = path.resolve(opts.source);\n\topts.locales = path.resolve(opts.locales);\n\topts.ignoreFile = path.resolve(opts.ignoreFile);\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.validate-locales.labels.source\"), opts.source);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.validate-locales.labels.locales\"), opts.locales);\n\tlet ignore: string[] = [];\n\n\tif (await CLIUtils.fileExists(opts.ignoreFile)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.ignoreFile\"),\n\t\t\topts.ignoreFile\n\t\t);\n\t\tignore = (await CLIUtils.readLinesFile(opts.ignoreFile)) ?? [];\n\t}\n\n\tCLIDisplay.break();\n\n\tconst sources = glob.sync(opts.source.replace(/\\\\/g, \"/\"), { ignore: SKIP_FILES });\n\tconst locales = glob.sync(opts.locales.replace(/\\\\/g, \"/\"));\n\n\tif (sources.length === 0) {\n\t\tCLIDisplay.warning(I18n.formatMessage(\"commands.validate-locales.warnings.noSourceFiles\"));\n\t} else if (locales.length === 0) {\n\t\tCLIDisplay.warning(I18n.formatMessage(\"commands.validate-locales.warnings.noLocaleFiles\"));\n\t} else {\n\t\tawait validateLocales(\n\t\t\tsources,\n\t\t\tlocales,\n\t\t\tignore.filter(i => Is.stringValue(i) && !i.startsWith(\"#\")).map(i => new RegExp(i))\n\t\t);\n\t}\n\n\tCLIDisplay.break();\n\tCLIDisplay.done();\n}\n\n/**\n * Validate the locales.\n * @param sourceFiles The source files.\n * @param localeFiles The locale files.\n * @param ignore The ignore list.\n */\nasync function validateLocales(\n\tsourceFiles: string[],\n\tlocaleFiles: string[],\n\tignore: RegExp[]\n): Promise<void> {\n\tconst localeEntries: ILocaleDictionaryEntry[] = [];\n\n\tlet hasQuoteError = false;\n\tlet hasUnused = false;\n\tlet hasFailures = false;\n\n\tfor (const localeFile of localeFiles) {\n\t\tconst dictionary = await CLIUtils.readJsonFile<ILocaleDictionary>(localeFile);\n\t\tconst locale = path.basename(localeFile, path.extname(localeFile));\n\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"commands.validate-locales.progress.validatingLocale\", { localeFile })\n\t\t);\n\t\tCLIDisplay.break();\n\n\t\tif (Is.object<ILocaleDictionary>(dictionary)) {\n\t\t\tconst mergedKeys: { [key: string]: string } = {};\n\t\t\tI18n.flattenTranslationKeys(dictionary, \"\", mergedKeys);\n\n\t\t\tfor (const flatKey of Object.keys(mergedKeys)) {\n\t\t\t\tif (/'{.*?}'/.test(mergedKeys[flatKey])) {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.usesSingleQuotes\", {\n\t\t\t\t\t\t\tkey: flatKey\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\thasQuoteError = true;\n\t\t\t\t}\n\n\t\t\t\tlocaleEntries.push({\n\t\t\t\t\tlocale,\n\t\t\t\t\tkey: flatKey,\n\t\t\t\t\tvalue: mergedKeys[flatKey],\n\t\t\t\t\tpropertyNames: I18n.getPropertyNames(mergedKeys[flatKey]),\n\t\t\t\t\treferenced: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tlet failures: ILocaleFailure[] = [];\n\t\tconst captureVariables: { [name: string]: ts.Node } = {};\n\n\t\tfor (const sourceFile of sourceFiles) {\n\t\t\tconst source = await readFile(sourceFile, \"utf8\");\n\n\t\t\tconst sourceTs = ts.createSourceFile(\n\t\t\t\tsourceFile,\n\t\t\t\tsource,\n\t\t\t\tts.ScriptTarget.ESNext,\n\t\t\t\ttrue,\n\t\t\t\tts.ScriptKind.TS\n\t\t\t);\n\n\t\t\tvisit(sourceTs, sourceTs, localeEntries, failures, captureVariables);\n\t\t}\n\n\t\tfailures = failures.filter(mr => !ignore.some(pattern => pattern.test(mr.key)));\n\n\t\tif (failures.length === 0) {\n\t\t\tCLIDisplay.write(\n\t\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.noMissingLocaleEntries\")\n\t\t\t);\n\t\t\tCLIDisplay.break();\n\t\t} else {\n\t\t\thasFailures = true;\n\t\t\tfor (const failureRef of failures) {\n\t\t\t\tif (failureRef.type === \"key\") {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.missingLocaleEntry\", {\n\t\t\t\t\t\t\tkey: failureRef.key,\n\t\t\t\t\t\t\tsource: failureRef.source,\n\t\t\t\t\t\t\tline: failureRef.line,\n\t\t\t\t\t\t\tcolumn: failureRef.column\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tCLIDisplay.break();\n\n\t\tfor (const localeEntry of localeEntries) {\n\t\t\tif (ignore.some(pattern => pattern.test(localeEntry.key))) {\n\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t}\n\t\t}\n\n\t\tif (localeEntries.filter(le => !le.referenced).length === 0) {\n\t\t\tCLIDisplay.write(\n\t\t\t\tI18n.formatMessage(\"commands.validate-locales.labels.noUnusedLocaleEntries\")\n\t\t\t);\n\t\t\tCLIDisplay.break();\n\t\t} else {\n\t\t\thasUnused = true;\n\t\t\tfor (const localeEntry of localeEntries) {\n\t\t\t\tif (!localeEntry.referenced) {\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.unusedLocaleEntry\", {\n\t\t\t\t\t\t\tkey: localeEntry.key\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (hasFailures || hasUnused || hasQuoteError) {\n\t\tthrow new GeneralError(\"validateLocales\", \"validationFailed\");\n\t}\n}\n\n/**\n * Visit the node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to visit.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n */\nfunction visit(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.Node,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): void {\n\tlet handled = false;\n\tif (\n\t\tts.isNewExpression(node) &&\n\t\tts.isIdentifier(node.expression) &&\n\t\tERROR_TYPES.some(errorType => errorType.name === node.expression.getText())\n\t) {\n\t\tprocessErrorType(sourceFile, node, node.expression.text, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isStringLiteral(node)) {\n\t\tprocessStringLiteral(sourceFile, node, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isTemplateExpression(node)) {\n\t\tprocessTemplateExpression(sourceFile, node, localeEntries, failures);\n\t\thandled = true;\n\t} else if (ts.isCallExpression(node)) {\n\t\thandled = processCallExpression(sourceFile, node, localeEntries, failures, captureVariables);\n\t} else if (ts.isFunctionDeclaration(node)) {\n\t\thandled = processFunctionDeclaration(sourceFile, node, localeEntries, failures);\n\t} else if (ts.isVariableDeclaration(node)) {\n\t\thandled = processVariableDeclaration(\n\t\t\tsourceFile,\n\t\t\tnode,\n\t\t\tlocaleEntries,\n\t\t\tfailures,\n\t\t\tcaptureVariables\n\t\t);\n\t} else if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {\n\t\t// Don't care about string in imports/exports\n\t\thandled = true;\n\t} else if (ts.isPropertyAssignment(node)) {\n\t\thandled = processPropertyAssignment(sourceFile, node, localeEntries, failures);\n\t}\n\n\tif (!handled) {\n\t\tts.forEachChild(node, child =>\n\t\t\tvisit(sourceFile, child, localeEntries, failures, captureVariables)\n\t\t);\n\t}\n}\n\n/**\n * Process an error type node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param errorType The error type.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processErrorType(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.NewExpression,\n\terrorType: string,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\tconst errType = ERROR_TYPES.find(e => e.name === errorType);\n\n\tif (Is.object(errType)) {\n\t\tconst localeKey = localeFromClassAndMessage(\n\t\t\tsourceFile,\n\t\t\tnode.arguments?.[0],\n\t\t\tnode.arguments?.[1],\n\t\t\t\"error\",\n\t\t\tfailures\n\t\t);\n\n\t\tif (Is.stringValue(localeKey)) {\n\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\tif (errType.dynamicPropertyIndex !== -1 || Is.arrayValue(errType.inbuiltProperties)) {\n\t\t\t\t\tconst usedProperties = errType.inbuiltProperties?.slice() ?? [];\n\n\t\t\t\t\tif (errType.dynamicPropertyIndex !== -1) {\n\t\t\t\t\t\tusedProperties.push(\n\t\t\t\t\t\t\t...getPropertiesFromNode(node.arguments?.[errType.dynamicPropertyIndex])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, usedProperties, failures);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: localeKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tCLIDisplay.errorMessage(\n\t\tI18n.formatMessage(\"error.validateLocales.unableToProcessContent\", { content: node.getText() })\n\t);\n}\n\n/**\n * Find the locale entry if it exists.\n * @param localeEntries The locale entries.\n * @param entryToMatch The full key to check.\n * @returns The item if found, undefined otherwise.\n */\nfunction findAndReferenceLocale(\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tentryToMatch: string\n): ILocaleDictionaryEntry | undefined {\n\tif (Is.stringValue(entryToMatch)) {\n\t\tconst found = localeEntries.find(le => le.key === entryToMatch);\n\t\tif (found) {\n\t\t\tfound.referenced = true;\n\t\t\treturn found;\n\t\t}\n\t}\n}\n\n/**\n * Process a string literal node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processStringLiteral(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.StringLiteral,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\tif (\n\t\tnode.text.length > 3 &&\n\t\tnode.text.includes(\".\") &&\n\t\t!/[ ()/]/.test(node.text) &&\n\t\t!/^\\.|\\.$/.test(node.text) &&\n\t\t!isSkipLiteral(node.text)\n\t) {\n\t\tconst parts = node.text.split(\".\");\n\t\tif (parts.length > 1) {\n\t\t\t// First try and match the string as-is\n\t\t\tlet localeEntry = findAndReferenceLocale(localeEntries, node.text);\n\t\t\tif (localeEntry) {\n\t\t\t\tlocaleEntry.referenced = true;\n\n\t\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, node.text, usedProperties, failures);\n\t\t\t}\n\n\t\t\tif (!localeEntry && [\"validation.\", \"common.\"].some(t => node.text.startsWith(t))) {\n\t\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${node.text}`);\n\t\t\t\tif (localeEntry) {\n\t\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\t\t\tcheckPropertyUsage(\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tlocaleEntry,\n\t\t\t\t\t\t`error.${node.text}`,\n\t\t\t\t\t\tusedProperties,\n\t\t\t\t\t\tfailures\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!localeEntry) {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: node.text,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Process a template expression node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n */\nfunction processTemplateExpression(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.TemplateExpression,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): void {\n\t// This case handles templates like `error.${nameof(Class)}.message`\n\tconst templateParts = extractTemplatePartsWithExpressions(node);\n\n\t// Join all literal text parts to form a potential locale key\n\tif (hasValidTemplateContent(templateParts)) {\n\t\tconst key = expandTemplateParts(templateParts);\n\n\t\tlet localeEntry = findAndReferenceLocale(localeEntries, key);\n\t\tif (localeEntry) {\n\t\t\tconst usedProperties = getPropertiesFromNode(node);\n\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeEntry.key, usedProperties, failures);\n\t\t} else if ([\"validation.\", \"common.\"].some(t => key.startsWith(t))) {\n\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${key}`);\n\n\t\t\tif (localeEntry) {\n\t\t\t\tlocaleEntry.referenced = true;\n\t\t\t\tconst usedProperties = getPropertiesFromNode(node.parent.parent);\n\n\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, `error.${key}`, usedProperties, failures);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Process a call expression node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n * @returns True if processed, false otherwise.\n */\nfunction processCallExpression(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.CallExpression,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): boolean {\n\tif (ts.isPropertyAccessExpression(node.expression)) {\n\t\tconst functionName = node.expression.name.getText();\n\t\tif (node.expression.getText() === \"console.log\") {\n\t\t\treturn true;\n\t\t} else if (\n\t\t\tfunctionName === \"log\" &&\n\t\t\tnode.arguments.length === 1 &&\n\t\t\tts.isObjectLiteralExpression(node.arguments[0])\n\t\t) {\n\t\t\tlet level;\n\t\t\tlet source;\n\t\t\tlet message;\n\t\t\tlet dataNames;\n\t\t\tfor (const prop of node.arguments[0].properties) {\n\t\t\t\tif (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n\t\t\t\t\tif (prop.name.text === \"source\") {\n\t\t\t\t\t\tif (ts.isIdentifier(prop.initializer) && captureVariables[prop.initializer.text]) {\n\t\t\t\t\t\t\tsource = captureVariables[prop.initializer.text];\n\t\t\t\t\t\t} else if (ts.isStringLiteral(prop.initializer)) {\n\t\t\t\t\t\t\tsource = prop.initializer;\n\t\t\t\t\t\t} else if (ts.isPropertyAccessExpression(prop.initializer)) {\n\t\t\t\t\t\t\tsource = prop.initializer;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (prop.name.text === \"message\") {\n\t\t\t\t\t\tmessage = prop.initializer;\n\t\t\t\t\t} else if (prop.name.text === \"data\") {\n\t\t\t\t\t\tdataNames = getPropertiesFromNode(prop.initializer);\n\t\t\t\t\t} else if (prop.name.text === \"level\") {\n\t\t\t\t\t\tlevel = getExpandedText(prop.initializer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst localeKey = localeFromClassAndMessage(sourceFile, source, message, level, failures);\n\n\t\t\tif (Is.stringValue(localeKey)) {\n\t\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, dataNames ?? [], failures);\n\t\t\t\t} else {\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"key\",\n\t\t\t\t\t\tkey: localeKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: message?.getText() ?? \"\",\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn true;\n\t\t} else if (\n\t\t\tfunctionName === \"formatMessage\" &&\n\t\t\tnode.arguments.length === 2 &&\n\t\t\tts.isTemplateExpression(node.arguments[0]) &&\n\t\t\tts.isObjectLiteralExpression(node.arguments[1])\n\t\t) {\n\t\t\tconst localeKey = getExpandedText(node.arguments[0]);\n\n\t\t\tif (Is.stringValue(localeKey)) {\n\t\t\t\tconst dataNames = getPropertiesFromNode(node.arguments[1]);\n\t\t\t\tconst localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\t\tif (Is.object(localeEntry)) {\n\t\t\t\t\tcheckPropertyUsage(sourceFile, node, localeEntry, localeKey, dataNames ?? [], failures);\n\t\t\t\t} else {\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"key\",\n\t\t\t\t\t\tkey: localeKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Process a function declaration node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @returns True if processed, false otherwise.\n */\nfunction processFunctionDeclaration(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.FunctionDeclaration,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): boolean {\n\tif (\n\t\tIs.object(node.name) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tSKIP_METHODS.some(re => re.test(node.name?.text ?? \"\"))\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Process a variable statement declaration node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @param captureVariables The capture variables.\n * @returns True if processed, false otherwise.\n */\nfunction processVariableDeclaration(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.VariableDeclaration,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[],\n\tcaptureVariables: { [name: string]: ts.Node }\n): boolean {\n\tif (\n\t\tIs.object(node.name) &&\n\t\tIs.object(node.initializer) &&\n\t\tts.isIdentifier(node.name) &&\n\t\tts.isStringLiteral(node.initializer) &&\n\t\tCAPTURE_VARIABLES.some(re => re.test(node.name.getText()))\n\t) {\n\t\tcaptureVariables[node.name.getText()] = node.initializer;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Process a property assignment node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to process.\n * @param localeEntries The locale entries.\n * @param failures The failure entries.\n * @returns True if processed, false otherwise.\n */\nfunction processPropertyAssignment(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.PropertyAssignment,\n\tlocaleEntries: ILocaleDictionaryEntry[],\n\tfailures: ILocaleFailure[]\n): boolean {\n\tif (Is.object(node.name) && ts.isIdentifier(node.name) && node.name.getText() === \"message\") {\n\t\tconst localeKey = getExpandedText(node.initializer);\n\n\t\tif (Is.stringValue(localeKey)) {\n\t\t\tlet localeEntry = findAndReferenceLocale(localeEntries, localeKey);\n\n\t\t\tif (!Is.object(localeEntry)) {\n\t\t\t\tlocaleEntry = findAndReferenceLocale(localeEntries, `error.${localeKey}`);\n\t\t\t}\n\n\t\t\tif (!Is.object(localeEntry)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"key\",\n\t\t\t\t\tkey: localeKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...getSourcePosition(sourceFile, node)\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Get the expanded text from a node.\n * @param node The node to get the text from.\n * @returns The expanded text.\n */\nfunction getExpandedText(node: ts.Node): string {\n\tif (ts.isTemplateExpression(node)) {\n\t\tconst templateParts = extractTemplatePartsWithExpressions(node);\n\t\tif (hasValidTemplateContent(templateParts)) {\n\t\t\treturn expandTemplateParts(templateParts);\n\t\t}\n\t} else if (ts.isStringLiteral(node)) {\n\t\tif (hasValidTemplateContent([node.text])) {\n\t\t\treturn node.text;\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Extract parts from a template literal, splitting by ${} expressions.\n * @param node The template expression node.\n * @returns Array of parts including expressions and literal text.\n */\nfunction extractTemplatePartsWithExpressions(node: ts.TemplateExpression): string[] {\n\tconst parts: string[] = [];\n\n\t// Start with the head (text before first ${})\n\tif (node.head.text) {\n\t\tparts.push(node.head.text);\n\t}\n\n\t// Process each template span (${expression}text)\n\tfor (const span of node.templateSpans) {\n\t\t// Add the expression part as text\n\t\tparts.push(span.expression.getText());\n\n\t\t// Add the literal text after the expression\n\t\tif (span.literal.text) {\n\t\t\tparts.push(span.literal.text);\n\t\t}\n\t}\n\n\treturn parts.filter(part => part.length > 0);\n}\n\n/**\n * Check if the content has any parts which contain elements which determine is is not an locale key.\n * @param templateParts The template parts to check.\n * @returns True if the template parts are valid, false otherwise.\n */\nfunction hasValidTemplateContent(templateParts: string[]): boolean {\n\treturn !templateParts.some(part => /[#,/:=?|]/.test(part));\n}\n\n/**\n * Expand template parts into a single string, processing nameof expressions.\n * @param templateParts The template parts to expand.\n * @returns The expanded template string.\n */\nfunction expandTemplateParts(templateParts: string[]): string {\n\tfor (let i = 0; i < templateParts.length; i++) {\n\t\ttemplateParts[i] = expandTemplatePart(templateParts[i]);\n\t}\n\n\treturn templateParts.join(\"\");\n}\n\n/**\n * Expand template part into a single string, processing nameof expressions.\n * @param templatePart The template part to expand.\n * @returns The expanded template string.\n */\nfunction expandTemplatePart(templatePart: string): string {\n\tif (templatePart.startsWith(\"nameof\")) {\n\t\tconst stripped = manual(templatePart).replace(/[\"']/g, \"\");\n\t\ttemplatePart = StringHelper.camelCase(stripped, true);\n\t} else if (templatePart.startsWith(\"StringHelper.\")) {\n\t\ttemplatePart = templatePart.replace(/\\.CLASS_NAME/g, \"\");\n\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.camelCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.camelCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.titleCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.titleCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.pascalCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.pascalCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.kebabCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.kebabCase(i)\n\t\t);\n\t\ttemplatePart = templatePart.replace(/StringHelper\\.snakeCase\\((.*?)\\)/, (_, i) =>\n\t\t\tStringHelper.snakeCase(i)\n\t\t);\n\t} else if (templatePart.includes(\".CLASS_NAME\")) {\n\t\ttemplatePart = StringHelper.camelCase(templatePart.replace(/\\.CLASS_NAME/g, \"\"));\n\t}\n\ttemplatePart = templatePart.replace(/[\"'`]/g, \"\"); // Remove quotes\n\n\treturn templatePart;\n}\n\n/**\n * Check the property usage in a locale entry against the used properties.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param node The node to check.\n * @param localeEntry The locale entry to check against.\n * @param key The key in the locale entry.\n * @param usedProperties The properties used in the code.\n * @param failures The failure entries.\n */\nfunction checkPropertyUsage(\n\tsourceFile: ts.SourceFile,\n\tnode: ts.Node,\n\tlocaleEntry: ILocaleDictionaryEntry,\n\tkey: string,\n\tusedProperties: string[],\n\tfailures: ILocaleFailure[]\n): void {\n\tfor (const propName of localeEntry.propertyNames) {\n\t\tconst propIndex = usedProperties.indexOf(propName);\n\t\tif (propIndex === -1) {\n\t\t\tconst position = getSourcePosition(sourceFile, node);\n\t\t\tCLIDisplay.errorMessage(\n\t\t\t\tI18n.formatMessage(\"error.validateLocales.missingPropertyInLocale\", {\n\t\t\t\t\tkey,\n\t\t\t\t\tproperty: propName,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\tline: position.line,\n\t\t\t\t\tcolumn: position.column\n\t\t\t\t})\n\t\t\t);\n\t\t\tfailures.push({\n\t\t\t\ttype: \"property\",\n\t\t\t\tkey: localeEntry.key,\n\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t...position\n\t\t\t});\n\t\t}\n\t}\n\n\t// We often pass additional properties in the error details to better inform the logging\n\t// so we don't want to perform the opposite check for parameters in the call but not in the locale entry\n}\n\n/**\n * Helper to get line and column position from a node.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param n The node to get position for.\n * @returns Line and column (1-based).\n */\nfunction getSourcePosition(\n\tsourceFile: ts.SourceFile,\n\tn: ts.Node\n): { line: number; column: number } {\n\tconst { line, character } = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));\n\treturn { line: line + 1, column: character + 1 };\n}\n\n/**\n * Get property names from a node.\n * @param node The node to get property names from.\n * @returns The property names.\n */\nfunction getPropertiesFromNode(node?: ts.Node): string[] {\n\tif (!node) {\n\t\treturn [];\n\t}\n\n\tconst props: string[] = [];\n\n\t// If this is an object literal then we can get the property names\n\tif (ts.isObjectLiteralExpression(node)) {\n\t\t// Get the properties of the object literal\n\t\tconst properties = node.properties;\n\t\tfor (const prop of properties) {\n\t\t\tif (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n\t\t\t\t// { property: value }\n\t\t\t\tprops.push(prop.name.text);\n\n\t\t\t\t// { property: { nestedProperty: value } }\n\t\t\t\tif (ts.isObjectLiteralExpression(prop.initializer)) {\n\t\t\t\t\t// Recursively get properties from nested object literals\n\t\t\t\t\tconst nestedProps = getPropertiesFromNode(prop.initializer);\n\t\t\t\t\tprops.push(...nestedProps);\n\t\t\t\t}\n\t\t\t} else if (ts.isShorthandPropertyAssignment(prop)) {\n\t\t\t\t// { property }\n\t\t\t\tprops.push(prop.getText());\n\t\t\t}\n\t\t}\n\t} else if (ts.isStringLiteral(node)) {\n\t\t// If this is a string literal then there are no properties\n\t\t// so we need to look in the surrounding context\n\t\tconst parent = node.parent;\n\t\tif (ts.isCallExpression(parent) || ts.isNewExpression(parent)) {\n\t\t\t// Let's see if they are the next argument in the call\n\t\t\tconst args = parent.arguments;\n\t\t\tif (args && args.length > 0) {\n\t\t\t\tconst index = args.findIndex(a => a === node);\n\t\t\t\tif (index !== -1 && index + 1 < args.length) {\n\t\t\t\t\treturn getPropertiesFromNode(args[index + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ts.isPropertyAssignment(parent)) {\n\t\t\t// This is part of a property assignment in an object\n\t\t\t// so we can check the parent object for other properties\n\t\t\tif (ts.isObjectLiteralExpression(parent.parent)) {\n\t\t\t\treturn getPropertiesFromNode(parent.parent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n\n/**\n * Check if a value is a file operation.\n * @param value The value to check.\n * @returns True if the value is a file operation.\n */\nfunction isSkipLiteral(value: string): boolean {\n\treturn SKIP_LITERALS.some(regex => regex.test(value));\n}\n\n/**\n * Get the locale from the class and message nodes.\n * @param sourceFile The TypeScript source file for position calculations.\n * @param classNode The class node.\n * @param messageNode The message node.\n * @param prefix The prefix for the locale key.\n * @param failures The failure entries.\n * @returns The locale entry or undefined.\n */\nfunction localeFromClassAndMessage(\n\tsourceFile: ts.SourceFile,\n\tclassNode: ts.Node | undefined,\n\tmessageNode: ts.Node | undefined,\n\tprefix: string | undefined,\n\tfailures: ILocaleFailure[]\n): string | undefined {\n\tif (!classNode || !messageNode) {\n\t\treturn undefined;\n\t}\n\n\tconst classNameParam = classNode.getText();\n\tconst classNameParamParts = classNameParam?.split(\".\");\n\n\tif (Is.array(classNameParamParts)) {\n\t\tconst messageKey = getExpandedText(messageNode);\n\n\t\tif (Is.stringValue(messageKey)) {\n\t\t\tif (messageKey.includes(\" \")) {\n\t\t\t\t// If the message contains spaces then it is not a key\n\t\t\t\t// but should be replaced by one\n\t\t\t\tconst position = getSourcePosition(sourceFile, messageNode);\n\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.shouldBeKey\", {\n\t\t\t\t\t\tvalue: messageKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\tline: position.line,\n\t\t\t\t\t\tcolumn: position.column\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\tfailures.push({\n\t\t\t\t\ttype: \"noKey\",\n\t\t\t\t\tkey: messageKey,\n\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t...position\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst finalKeyParts = [];\n\n\t\t\t\tconst classNameExpanded = expandTemplatePart(classNameParam);\n\t\t\t\tconst messageKeyParts = messageKey.split(\".\");\n\n\t\t\t\tif (messageKeyParts.length === 2 && classNameExpanded === messageKeyParts[0]) {\n\t\t\t\t\t// But if it is fully qualified with exactly two segments and starts with the class name\n\t\t\t\t\t// then the class name is redundant and should be removed in the source\n\t\t\t\t\tconst position = getSourcePosition(sourceFile, messageNode);\n\t\t\t\t\tCLIDisplay.errorMessage(\n\t\t\t\t\t\tI18n.formatMessage(\"error.validateLocales.noNeedToQualify\", {\n\t\t\t\t\t\t\tkey: messageKey,\n\t\t\t\t\t\t\tproperty: classNameParam,\n\t\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t\tline: position.line,\n\t\t\t\t\t\t\tcolumn: position.column\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tfailures.push({\n\t\t\t\t\t\ttype: \"qualify\",\n\t\t\t\t\t\tkey: messageKey,\n\t\t\t\t\t\tsource: path.resolve(sourceFile.fileName),\n\t\t\t\t\t\t...position\n\t\t\t\t\t});\n\t\t\t\t} else if (!messageKey.includes(\".\")) {\n\t\t\t\t\t// If the key is not fully qualified then add the class name\n\t\t\t\t\t// to the final key\n\t\t\t\t\tfinalKeyParts.push(classNameExpanded);\n\t\t\t\t}\n\n\t\t\t\tfinalKeyParts.push(messageKey);\n\n\t\t\t\tif (Is.stringValue(prefix)) {\n\t\t\t\t\tfinalKeyParts.unshift(prefix);\n\t\t\t\t}\n\n\t\t\t\treturn finalKeyParts.join(\".\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
package/docs/changelog.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.2](https://github.com/twinfoundation/framework/compare/validate-locales-v0.0.3-next.1...validate-locales-v0.0.3-next.2) (2025-11-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * validate locales missing log key ([14a649e](https://github.com/twinfoundation/framework/commit/14a649e569c0509bef045a76edf1818f3eca6ded))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/cli-core bumped from 0.0.3-next.1 to 0.0.3-next.2
16
+ * @twin.org/core bumped from 0.0.3-next.1 to 0.0.3-next.2
17
+ * @twin.org/nameof bumped from 0.0.3-next.1 to 0.0.3-next.2
18
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.1 to 0.0.3-next.2
19
+ * devDependencies
20
+ * @twin.org/merge-locales bumped from 0.0.3-next.1 to 0.0.3-next.2
21
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.1 to 0.0.3-next.2
22
+
3
23
  ## [0.0.3-next.1](https://github.com/twinfoundation/framework/compare/validate-locales-v0.0.3-next.0...validate-locales-v0.0.3-next.1) (2025-11-10)
4
24
 
5
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/validate-locales",
3
- "version": "0.0.3-next.1",
3
+ "version": "0.0.3-next.2",
4
4
  "description": "Tool to validate source files against the locales",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,10 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/cli-core": "0.0.3-next.1",
18
- "@twin.org/core": "0.0.3-next.1",
19
- "@twin.org/nameof": "0.0.3-next.1",
20
- "@twin.org/nameof-transformer": "0.0.3-next.1",
17
+ "@twin.org/cli-core": "0.0.3-next.2",
18
+ "@twin.org/core": "0.0.3-next.2",
19
+ "@twin.org/nameof": "0.0.3-next.2",
20
+ "@twin.org/nameof-transformer": "0.0.3-next.2",
21
21
  "commander": "14.0.2",
22
22
  "glob": "11.0.3",
23
23
  "typescript": "5.9.3"