Skip to content

Commit 09d42f9

Browse files
nix6839ljharb
andcommitted
Apply suggestions from code review
Co-authored-by: Jordan Harband <ljharb@gmail.com>
1 parent b26ac62 commit 09d42f9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/rules/require-default-props.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ module.exports = {
156156

157157
values(list).filter((component) => {
158158
if (ignoreFunctionalComponents
159-
&& astUtil.isFunctionLike(component.node)) {
159+
&& astUtil.isFunctionLike(component.node)
160+
) {
160161
return false;
161162
}
162163
// If this defaultProps is "unresolved", then we should ignore this component and not report
@@ -166,8 +167,7 @@ module.exports = {
166167
}
167168
return component.declaredPropTypes !== undefined;
168169
}).forEach((component) => {
169-
if (forceDefaultPropArguments
170-
&& astUtil.isFunctionLike(component.node)) {
170+
if (forceDefaultPropArguments && astUtil.isFunctionLike(component.node)) {
171171
reportFunctionComponent(
172172
component.node,
173173
component.declaredPropTypes,

tests/lib/rules/require-default-props.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ ruleTester.run('require-default-props', rule, {
11151115
return <div>Hello {foo} and {bar}</div>;
11161116
}
11171117
`,
1118-
features: ['flow'],
1118+
features: ['types'],
11191119
options: [{ forceDefaultPropArguments: true }],
11201120
},
11211121
{
@@ -1128,7 +1128,7 @@ ruleTester.run('require-default-props', rule, {
11281128
return <div>Hello {foo} and {bar}</div>;
11291129
}
11301130
`,
1131-
features: ['flow'],
1131+
features: ['types'],
11321132
options: [{ forceDefaultPropArguments: true }],
11331133
},
11341134
{
@@ -1167,7 +1167,7 @@ ruleTester.run('require-default-props', rule, {
11671167
foo?: string,
11681168
bar?: string
11691169
}
1170-
const Hello: React.Fc<Props> = ({ foo = 'asdf', bar = 'qwer' }) => {
1170+
const Hello: React.FC<Props> = ({ foo = 'asdf', bar = 'qwer' }) => {
11711171
return <div>Hello {foo} and {bar}</div>;
11721172
}
11731173
`,

0 commit comments

Comments
 (0)