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.

array-callback-return incorrectly assumes an array

See original GitHub issue

Tell 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:closed
  • Created 6 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Apr 8, 2017

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 remove array-callback-return from eslint:recommended. We removed no-template-curly-in-string in https://github.com/eslint/eslint/issues/8236 for much less.

0reactions
btmillscommented, Apr 13, 2017

The TSC decided to remove array-callback-return from eslint:recommended in the 2017-04-13 meeting.

Read more comments on GitHub >

github_iconTop 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 >

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