array-callback-return incorrectly assumes an array
See original GitHub issueTell us about your environment
- ESLint Version: v4.0.0-alpha.0
- Node Version: v7.6.0
- npm Version: v4.1.2
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration: https://github.com/thelounge/lounge/blob/8c987e7a2812dcc9f01df639df3d7c68339ab742/.eslintrc.yml
Reduced test case:
require("event-stream").map(() => {});
var es = require("event-stream");
es.map(() => {});
This does not report an error on v3.19.0, probably due to array-callback-return
not being in the eslint:recommended
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
array-callback-return - ESLint - Pluggable JavaScript Linter
Known Limitations. This rule checks callback functions of methods with the given names, even if the object which has the method is not...
Read more >Expected to return a value at the end of this function array ...
TLDR: The simplest fix is to use Object.keys(this.props.ntn).forEach instead of .map and make all return rowLeft.push just rowLeft.push .
Read more >Array.prototype.reduce() - JavaScript - MDN Web Docs
The reduce() method executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value ...
Read more >Understand JavaScript Arrays and Common ... - Launch School
It returns a new array that includes all elements from the calling array for which the callback returns a truthy value. That's a...
Read more >5. Working with Arrays and Loops - JavaScript Cookbook [Book]
5.12. Applying a Function to Every Element in an Array and Returning a New Array. Problem.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh I see, here’s an example from the docs. Thanks for explaining.
So it has a method called
map
, but it doesn’t expect a value to be returned from the map function (it passes a callback instead).event-stream
is a very popular library, so I think we should probably removearray-callback-return
fromeslint:recommended
. We removedno-template-curly-in-string
in https://github.com/eslint/eslint/issues/8236 for much less.The TSC decided to remove
array-callback-return
fromeslint:recommended
in the 2017-04-13 meeting.