Skip to content

Commit

Permalink
Merge pull request #324 from hmnzr/update-settings-validation
Browse files Browse the repository at this point in the history
include element type in settings validation messages
  • Loading branch information
javierbrea authored Jan 13, 2024
2 parents e3e1f79 + 7270931 commit 537e171
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/helpers/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,20 @@ function validateElements(elements) {
}
if (element.mode && !VALID_MODES.includes(element.mode)) {
warnOnce(
`Invalid mode property in '${ELEMENTS}' setting. Should be one of ${VALID_MODES.join(
`Invalid mode property of type ${
element.type
} in '${ELEMENTS}' setting. Should be one of ${VALID_MODES.join(
",",
)}. Default value "${VALID_MODES[0]}" will be used instead`,
);
}
if (!element.pattern || !(isString(element.pattern) || isArray(element.pattern))) {
warnOnce(`Please provide a valid pattern in '${ELEMENTS}' setting`);
warnOnce(
`Please provide a valid pattern to type ${element.type} in '${ELEMENTS}' setting`,
);
}
if (element.capture && !isArray(element.capture)) {
warnOnce(`Invalid capture property in '${ELEMENTS}' setting`);
warnOnce(`Invalid capture property of type ${element.type} in '${ELEMENTS}' setting`);
}
});
}
Expand Down

0 comments on commit 537e171

Please sign in to comment.