Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
### Fixed
* [`prop-types`], `propTypes`: add support for exported type inference ([#3163][] @vedadeepta)
* [`no-invalid-html-attribute`]: allow 'shortcut icon' on `link` ([#3174][] @Primajin)
* [`prefer-exact-props`] improve performance for `Identifier` visitor ([#3190][] @meowtec)

### Changed
* [readme] change [`jsx-runtime`] link from branch to sha ([#3160][] @tatsushitoji)
Expand All @@ -20,6 +21,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
* [Docs] [`jsx-no-target-blank`]: Improve readme ([#3169][] @apepper)
* [Docs] [`display-name`]: improve examples ([#3189][] @golopot)

[#3190]: https://github.com/yannickcr/eslint-plugin-react/pull/3190
[#3189]: https://github.com/yannickcr/eslint-plugin-react/pull/3189
[#3186]: https://github.com/yannickcr/eslint-plugin-react/pull/3186
[#3174]: https://github.com/yannickcr/eslint-plugin-react/pull/3174
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-exact-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module.exports = {
},

Identifier(node) {
if (!utils.getParentStatelessComponent(node)) {
if (!utils.getStatelessComponent(node.parent)) {
return;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/lib/rules/prefer-exact-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ ruleTester.run('prefer-exact-props', rule, {
`,
features: ['flow'],
},
{
code: `
type Props = {|
foo: string
|}
function Component(props: Props) {
let someVar: { foo: string };
return <div />;
}
`,
features: ['flow'],
},
{
code: `
function Component(props: {| foo : string |}) {
Expand Down