question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[no-array-method-this-argument] - false positives, lodash map, foreach, filter and React.Chidlren.map

See original GitHub issue
          const files = _.filter(data, (file) => _.endsWith(file, '.pdf')); //  Do not use the `this` argument in `Array#filter()`  unicorn/no-array-method-this-argument
        
          {React.Children.map(children, (child) => // Do not use the `this` argument in `Array#map()`  unicorn/no-array-method-this-argument
            React.cloneElement(child, { className: classes.nested })
          )}
          
          

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:8

github_iconTop GitHub Comments

1reaction
jan-molakcommented, Jun 28, 2021

Also false positives with custom classes that happen to have a map method.

class Mapper {
  map(argument) {
    // ...
  }
}
0reactions
hi-rustincommented, Jun 30, 2021

Can you update to eslint-plugin-unicorn to v34.0.1 ? rust-lang/crates.io#3759

It’s fixed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[no-array-method-this-argument] - false positives, lodash map ...
no-array-method-this-argument] - false positives, lodash map, foreach, filter and React.Chidlren.map.
Read more >
Lodash: filter then map over an object - Stack Overflow
Basically, you can apply lodash#reduce to Object directly instead of getting all the keys first, and then iterating again.
Read more >
Why and when to use forEach, map, filter, reduce, and find in ...
find() on arrays in JavaScript. I thought it would be useful to provide an explanation of when to use the common array methods....
Read more >
Array Methods Explained : Filter vs Map vs Reduce vs Foreach
As a ReactJS developer I use map a lot inside my application UI. Map like filter & foreach takes a callback and run...
Read more >
The Beginner's Guide to forEach, map and filter in JavaScript
For every element in the array, the function will be called. The function should return either true or false, to tell JavaScript whether...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found