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.

indent: add option for multiline [assignment] statement

See original GitHub issue

What rule do you want to change? indent

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

How will the change be implemented? (New option, new default behavior, etc.)? New option (and hopefully default behavior 🤞)

Please provide some example code that this change will affect:

const getRepos = async (req, res) => {
  try {
    const fetchRes = await fetch(`https://api.github.com/users/${req.params.user}/repos`);
    const json = await fetchRes.json();
    res.json(json);
  }
  catch (err) {
    const statusCode = 500;
    res.status(statusCode).send(err.message);
  }
};

And line 3 is the specific one in question:

    const fetchRes = await fetch(`https://api.github.com/users/${req.params.user}/repos`);

Its length is greater than 80 characters, so I need to wrap the line. I can wrap it in any of the following ways without eslint complaining:

    const fetchRes =
      await fetch(`https://api.github.com/users/${req.params.user}/repos`);
    const fetchRes =
          await fetch(`https://api.github.com/users/${req.params.user}/repos`);
    const fetchRes =
await fetch(`https://api.github.com/users/${req.params.user}/repos`);

But I would only like to allow the first way to be valid.

Are you willing to submit a pull request to implement this change? Not no, but also not yes. I’ve never looked at this codebase.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
kaicataldocommented, Nov 1, 2019

I’ll champion this.

4reactions
kaicataldocommented, May 14, 2020

@eslint/eslint-team Would anyone else like to support this proposal? If not, I think it’s unfortunately time to close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Eclipse indent multi line variable assignments and class ...
1 Answer 1 · Set Default indention for wrapped lines to 1 · For both Class Declarations > 'extends' and 'implements' clause: Set...
Read more >
Python Statement, Expression & Indentation - TechBeamers
1. If you create another string with the same value, Python will create a new object and assign it to a different location...
Read more >
Proper Indentation for Python Multiline Strings - Finxter
In this article we are going to look at how to properly indent your code for Python multiline strings, so let's start by...
Read more >
Statement, Indentation and Comment in Python - GeeksforGeeks
Multi-line string as a comment: Python multi-line comment is a piece of text enclosed in a delimiter (“””) on each end of the...
Read more >
PSR12 multiline if statement formatting with assignment in ...
PhpStorm logic is the following, expression $test = "" && true == false is split so it should be continuation indent.
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