indent: add option for multiline [assignment] statement
See original GitHub issueWhat 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:
- Created 4 years ago
- Reactions:8
- Comments:15 (9 by maintainers)
Top 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 >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
I’ll champion this.
@eslint/eslint-team Would anyone else like to support this proposal? If not, I think it’s unfortunately time to close this issue.