Skip to content

Commit

Permalink
fix: fix reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Jul 16, 2023
1 parent c1534b4 commit 3aaf810
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/validateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export const validateKey = async (node: TranslationNode, options: OptionsWithDef

const sourceVariables = value.match(/{{(?<var>.*?)}}/g)?.map((variable) => variable.slice(2, -2)) ?? [];

const missingVariables = variables.filter((variable) => !sourceVariables.includes(variable));
const missingVariables = sourceVariables.filter((variable) => !variables.includes(variable));

if (missingVariables.length > 0) {
log(new ValidationError(`Missing variables: ${missingVariables.join(', ')}`, node.path, node.positions), 'error', options);
return false;
}

const unusedVariables = sourceVariables.filter((variable) => !variables.includes(variable));
const unusedVariables = variables.filter((variable) => !sourceVariables.includes(variable));

if (unusedVariables.length > 0) {
log(new ValidationError(`Unused variables: ${unusedVariables.join(', ')}`, node.path, node.positions), 'error', options);
Expand Down

0 comments on commit 3aaf810

Please sign in to comment.