Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] prefer-read-only-props: Add TypeScript Support #3593

Conversation

HenryBrown0
Copy link
Contributor

Fixes #3535

Adds TypeScript support to prefer-read-only-props rule.

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #3593 (7f084b1) into master (57bb8d1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 7f084b1 differs from pull request most recent head 9c5ac98. Consider uploading reports for the commit 9c5ac98 to get more accurate results

@@           Coverage Diff           @@
##           master    #3593   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files         132      132           
  Lines        9288     9295    +7     
  Branches     3391     3397    +6     
=======================================
+ Hits         9067     9074    +7     
  Misses        221      221           
Impacted Files Coverage Δ
lib/rules/prefer-read-only-props.js 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

@ljharb ljharb merged commit 9c5ac98 into jsx-eslint:master Jul 19, 2023
291 checks passed
@mmckenziedev
Copy link

@HenryBrown0 Thank you so much for this! You're a legend!

@greypants
Copy link

Just curious - what real life scenario does this protect against when using TypeScript? Props already come through as const. This adds a TON of verbosity to almost every file in our library and apps. Just weight the pros/cons of ignoring this rule.

@ljharb
Copy link
Member

ljharb commented Jul 26, 2023

@greypants const is about reassignment; this is about mutation.

@HenryBrown0 HenryBrown0 deleted the 3535-bug-react-prefer-read-only-props-for-typescript branch July 29, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: react/prefer-read-only-props for Typescript
4 participants