Skip to content

Commit deb3b61

Browse files
committed
Add invalid test case for custom prop names
1 parent f767f68 commit deb3b61

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,6 +2975,25 @@ ruleTester.run('prop-types', rule, {
29752975
type: 'Identifier'
29762976
}],
29772977
parser: 'babel-eslint'
2978+
}, {
2979+
code: `
2980+
type FancyProps = {
2981+
foo: string,
2982+
};
2983+
2984+
class Bar extends React.Component<FancyProps> {
2985+
render() {
2986+
return <div>{this.props.bar}</div>
2987+
}
2988+
}
2989+
`,
2990+
errors: [{
2991+
message: '\'bar\' is missing in props validation',
2992+
line: 8,
2993+
column: 37,
2994+
type: 'Identifier'
2995+
}],
2996+
parser: 'babel-eslint'
29782997
}
29792998
]
29802999
});

0 commit comments

Comments
 (0)