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

Add ignoreMutableCollections option to prefer-readonly-type rule #157

Merged
merged 4 commits into from
Oct 7, 2020

Conversation

taylorc93
Copy link
Contributor

Hello! I'm currently migrating the main frontend repo for my company from a tslint / eslint hybrid to pure eslint. In our old config, we were using tslint-immutable's readonly-keyword to enforce use of readonly for our interfaces. However, we never enabled the readonly-array rule. Now that we're migrating to eslint-plugin-functional, we're getting a huge number of linting errors from the prefer-readonly-type rule since it appears to be a union of these two rules from tslint-immutable. While some of these are auto-fixable, many are not and fixing them manually would be too large of an undertaking for us right now.

To remedy this, I propose adding an ignoreMutableCollections option to this rule that allows users to disable checks against Arrays, Tuples, Maps, and Sets. This will make it much easier for users like us to migrate off of tslint and onto a more actively supported linting architecture. Happy to clarify the use case / expand on this PR as needed!

@RebeccaStevens
Copy link
Collaborator

Hey, thanks for the PR, I like it and can get behind it.
I'd just like to request one change before I merge this in. Could you change the name of the option from "ignoreMutableCollections" to simply "ignoreCollections"?

@RebeccaStevens RebeccaStevens added the Type: Enhancement Enhancement of the code, not introducing new features. label Oct 7, 2020
@RebeccaStevens
Copy link
Collaborator

Also, I should let you know that we are thinking about reworking this rule in future when I get some free time (see #153 for details).

@taylorc93
Copy link
Contributor Author

That name change sounds good to me, I changed it in my latest commit. Thanks for the heads up on the upcoming change, I'll keep an eye on it in the background!

@RebeccaStevens RebeccaStevens merged commit 626a459 into eslint-functional:master Oct 7, 2020
@RebeccaStevens
Copy link
Collaborator

Released in version 3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants