-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enhancement: [array-type] Detect Readonly<string[]>
#7755
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
Comments
Is this a common pattern you've seen around your codebase? |
Yes, we had a few of them. This is because we have another linter rule that enforces immutability on certain types. I guess this is why people started adding I have now used |
Enforcing If folks have already started adding Thanks for filing! |
@JoshuaKGoldberg To clarify: this issue asks for the rule to check that readonly array types are declared consistently, not that they are marked as readonly. Do those rules cover this use case? |
Yeah I think this rule shouldn't cover that case because |
This rule already checks between |
I think the difference (for me at least) is that |
I would say that we can easily include this case because it's syntactically simple to detect the case of I'm in favour of this, personally! |
Well, I guess I'm being outvoted on this one 😄 |
I just stumbled upon this in one of our projects and was very confused that it's not caught by the |
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/array-type
Description
The rule should also turn
Readonly<string[]>
intoreadonly string[]
.Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: