jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.86k stars 2.76k forks source link

[Fix] `boolean-prop-naming`: avoid a crash with a non-TSTypeReference type #3718

Closed developer-bandi closed 2 months ago

developer-bandi commented 3 months ago

related #3717

I think cause of bug is no concider below case

type Props = {
  enabled: boolean
}

const Hello = (props: Props & {
  semi: boolean
}) => <div />;

To explain in detail, if the type is not TSTypeReference (literal type, etc.), a reference error appears to have occurred because there is no typeName property.

Therefore, if it is not the corresponding type, the type has been modified to be used as is rather than taken from objectTypeAnnotations.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.71%. Comparing base (eea45bf) to head (4467db5). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3718 +/- ## ========================================== - Coverage 97.76% 97.71% -0.05% ========================================== Files 133 133 Lines 9467 9470 +3 Branches 3467 3469 +2 ========================================== - Hits 9255 9254 -1 - Misses 212 216 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.