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

📎 Implement useReadonlyClassProperties - typescript-eslint/prefer-readonly #4356

Open
Conaclos opened this issue Oct 21, 2024 · 2 comments
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@Conaclos
Copy link
Member

Description

Implement typescript-eslint/prefer-readonly.

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.

I suggested the name useReadonlyClassProperties because it is in line with some of our existing names such as noUnusedPrivateClassMembers.

See the related discussion for some context.

Options

I don't think we should implement the ESLint's option onlyInlineLambdas because it is very rarely used.

I propose adding an option checkPublic that extends the check on all properties (public and protected properties).

@Conaclos Conaclos added S-Help-wanted Status: you're familiar with the code base and want to help the project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 21, 2024
@ematipico
Copy link
Member

What do you think about checkPublicAccessor?

@Conaclos
Copy link
Member Author

What do you think about checkPublicAccessor?

This affects also protected. Also, Accessor seems related to the new modifier accessor, I could use accessibility instead (we already use it in the rule name useCOnsistentMemberAccessibility).

Thus: checkPublicLikeAccessibility? Looks over long... or checkAllProperties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

No branches or pull requests

2 participants