sindresorhus/eslint-plugin-unicorn
Use singular array element variable name for `no-fn-reference-in-iterator` rule if possible
クローズ
#754 opened on 2020/05/28
enhancementhelp wanted
Repository metrics
- Stars
- (5,022 個のスター)
- PR merge metrics
- (平均マージ 1d 16h) (30d で 399 merged PRs)
説明
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