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.

Use case where newline-per-chained-call doesn't work well

See original GitHub issue

What rule do you want to change? newline-per-chained-call

Does this change cause the rule to produce more or fewer warnings? Fewer

How will the change be implemented? (New option, new default behavior, etc.)? My guess would be an option for it

Please provide some example code that this change will affect:


According to the rule the code should be like this:


Which doesn’t make logical sense, since the calledWith and mockReturnValue are linked (logically).

What does the rule currently do for this code? Error for the last and second last mockReturnValue

What will the rule do after it’s changed? No error

Are you willing to submit a pull request to implement this change? I’m not sure how this will be implemented. But yes I would if I had some guidance/feedback.

What does everyone think/suggest for this use-case?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

eslint-deprecated[bot]commented, Dec 19, 2019

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Aequitas737commented, Nov 18, 2019

I’ve got no idea of the inner workings of eslint. I was thinking of using some regex to get the name and then as long as it’s used previously it should be allowed.

However this wouldn’t handle the below case:

            .mockReturnValue(mockSync) // just a contrived example

So yeh I’m not really sure there’s a possible solution. I’ll be disabling this rule most likely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

newline-per-chained-call not working as expected #12970
It used to require newlines before all elements of the chain if the total depth is greater than ignoreChainWithDepth . We even have...
Read more >
newline-per-chained-call - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
eslint/eslint - Gitter
If I add a "no-unused-vars" rule I can see the effect, but not for semi (have also tried enforcing single quotes and that...
Read more >
How to correctly use Eslint rule newline-per-chained-call with ...
can't use newline-per-chained-call with prettier because prettier not allow that behavior... the only can do is remove ...
Read more >
ValidateJavaScript - Online Tool to Find & Fix JavaScript Errors
default-case ... newline-per-chained-call ... ValidateJavaScript has been built using ESLint, the open-source JavaScript linting utility created by Nicholas ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found