diff --git a/lib/rules/boolean-prop-naming.js b/lib/rules/boolean-prop-naming.js
index fb8b204a3a..f65b8101f4 100644
--- a/lib/rules/boolean-prop-naming.js
+++ b/lib/rules/boolean-prop-naming.js
@@ -235,7 +235,14 @@ module.exports = {
list[component].node.params[0].typeAnnotation
) {
const typeNode = list[component].node.params[0].typeAnnotation;
- const propType = objectTypeAnnotations.get(typeNode.typeAnnotation.id.name);
+ const annotation = typeNode.typeAnnotation;
+
+ let propType;
+ if (annotation.type === 'GenericTypeAnnotation') {
+ propType = objectTypeAnnotations.get(annotation.id.name);
+ } else if (annotation.type === 'ObjectTypeAnnotation') {
+ propType = annotation;
+ }
if (propType) {
validatePropNaming(list[component].node, propType.properties);
}
diff --git a/tests/lib/rules/boolean-prop-naming.js b/tests/lib/rules/boolean-prop-naming.js
index 384557ec65..16f000a7a6 100644
--- a/tests/lib/rules/boolean-prop-naming.js
+++ b/tests/lib/rules/boolean-prop-naming.js
@@ -358,6 +358,23 @@ ruleTester.run('boolean-prop-naming', rule, {
options: [{
rule: '^is[A-Z]([A-Za-z0-9]?)+'
}]
+ }, {
+ // inline Flow type
+ code: `
+ function SomeComponent({
+ isSomething,
+ }: {
+ isSomething: boolean,
+ }) {
+ return (
+ {isSomething}
+ );
+ }
+ `,
+ options: [{
+ rule: '^is[A-Z]([A-Za-z0-9]?)+'
+ }],
+ parser: 'babel-eslint'
}],
invalid: [{
@@ -772,5 +789,25 @@ ruleTester.run('boolean-prop-naming', rule, {
errors: [{
message: 'Prop name (something) doesn\'t match rule (^is[A-Z]([A-Za-z0-9]?)+)'
}]
+ }, {
+ // inline Flow type
+ code: `
+ function SomeComponent({
+ something,
+ }: {
+ something: boolean,
+ }) {
+ return (
+ {something}
+ );
+ }
+ `,
+ options: [{
+ rule: '^is[A-Z]([A-Za-z0-9]?)+'
+ }],
+ parser: 'babel-eslint',
+ errors: [{
+ message: 'Prop name (something) doesn\'t match rule (^is[A-Z]([A-Za-z0-9]?)+)'
+ }]
}]
});