Skip to content

Commit 647dab7

Browse files
address the comments
1 parent b1797a6 commit 647dab7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tools/spectral/ipa/rulesets/functions/IPA112BooleanFieldNamesAvoidIsPrefix.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ export default (input, options, { path, documentInventory }) => {
1414
return;
1515
}
1616

17-
if (property.type === 'boolean') {
18-
if (IS_PREFIX_REGEX.test(input)) {
19-
const suggestedName = input.charAt(2).toLowerCase() + input.slice(3);
20-
const errorMessage = `Boolean field "${input}" should not use the "is" prefix. Use "${suggestedName}" instead.`;
21-
return collectAndReturnViolation(path, RULE_NAME, errorMessage);
22-
}
17+
if (property.type !== 'boolean') {
18+
return;
19+
}
20+
21+
if (IS_PREFIX_REGEX.test(input)) {
22+
const suggestedName = input.charAt(2).toLowerCase() + input.slice(3);
23+
const errorMessage = `Boolean field "${input}" should not use the "is" prefix. Use "${suggestedName}" instead.`;
24+
return collectAndReturnViolation(path, RULE_NAME, errorMessage);
2325
}
2426

2527
collectAdoption(path, RULE_NAME);

0 commit comments

Comments
 (0)