biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
15.52k stars 482 forks source link

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

Open Conaclos opened 1 month ago

Conaclos commented 1 month ago

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).

ematipico commented 1 month ago

What do you think about checkPublicAccessor?

Conaclos commented 1 month ago

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?