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

Use singular array element variable name for no-fn-reference-in-iterator rule if possible #754

Open
fisker opened this issue May 28, 2020 · 0 comments

Comments

@fisker
Copy link
Collaborator

fisker commented May 28, 2020

const foo = items.map(fn);

We are suggesting

const foo = items.map((element) => fn(element));
const foo = items.map((element, index) => fn(element, index));
const foo = items.map((element, index, array) => fn(element, index, array));

We can use better variable name

const foo = items.map((item) => fn(item));
const foo = items.map((item, index) => fn(item, index));
const foo = items.map((item, index, items) => fn(item, index, items));
//                                  ^^^^^ this is not related, but we can use this name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant