jsx-eslint/eslint-plugin-react

[Bug]: `prefer-read-only-props` rule doesn't work with namespaces

Open

#3786 aperta il 20 lug 2024

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (2797 fork)batch import
bughelp wantedtypescript

Metriche repository

Star
 (8630 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

prefer-read-only-props rule should work with namespace syntax

namespace ItemsListElementSkeleton {
  export interface Props {
    withArtists?: boolean
    withPlayedAt?: boolean
    position?: number
    positionSize?: ItemPosition.Props['size']
    positionClassName?: string
    withPlaysOrPlayTime?: boolean
  }
}

function ItemsListElementSkeleton({
  position,
  positionSize,
  positionClassName,
  withArtists,
  withPlayedAt,
  withPlaysOrPlayTime,
}: ItemsListElementSkeleton.Props) {
...
}

export { ItemsListElementSkeleton }

Should throw an error

Prop '...' should be read-only.

Expected Behavior

Should throw error if props are not readonly

eslint-plugin-react version

v7.35.0

eslint version

v8.57

node version

v20.10.0

Guida contributor