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

Rule proposal: prefer-destructuring-in-parameters #954

Closed
fisker opened this issue Dec 23, 2020 · 4 comments
Closed

Rule proposal: prefer-destructuring-in-parameters #954

fisker opened this issue Dec 23, 2020 · 4 comments

Comments

@fisker
Copy link
Collaborator

fisker commented Dec 23, 2020

I think it's nicer, especially in simple functions.

Fail

foo.map(element => element.id);
Object.entries(foo).filter(pair => pair[1]);

Pass

foo.map(({id}) => id);
Object.entries(foo).filter(([, value])=> value);

WDYT?

@sindresorhus
Copy link
Owner

This should fail though:

Object.entries(foo).filter(([,, value])=> value);

@fisker
Copy link
Collaborator Author

fisker commented Dec 23, 2020

Yes, it should not against no-unreadable-array-destructuring

@sindresorhus
Copy link
Owner

This is now accepted.

@fisker
Copy link
Collaborator Author

fisker commented Oct 29, 2023

Let's close this too, it reduces readability.

@fisker fisker closed this as completed Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants