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.

Allow MemberExpressions to bump indentation body by one indentation mark

See original GitHub issue

What rule do you want to change?

indent

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.)?

More permisive logic.

Please provide some example code that this change will affect:

Currently when I’m using "indent": [ "error", "tab" ] rule, it will complain about following code:

let x = new Promise( ( resolve, reject ) => {
		if ( window.abc ) {// ESLint expects one tab starting from here.
			resolve()
		} else {
			reject();
		}
	} )// all the way until thils line.
	.then(() => {
		return 2;
	} )
	.then(() => {
		return 1;
	} );

So the request here is to allow indentation to be bumped by one when MemberExpression is open.

This style makes more readable code in case when assigning to a variable, returning, throwing etc.

What does the rule currently do for this code?

With current ESLint logic it expects the following:

let x = new Promise( ( resolve, reject ) => {
	if ( window.abc ) {
		resolve()
	} else {
		reject();
	}
} )
	.then(() => {
		return 2;
	} )
	.then(() => {
		return 1;
	} );

What will the rule do after it’s changed?

Allowing following code:

let x = new Promise( ( resolve, reject ) => {
		if ( window.abc ) {
			resolve()
		} else {
			reject();
		}
	} )
	.then(() => {
		return 2;
	} )
	.then(() => {
		return 1;
	} );

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mlewandcommented, Apr 7, 2017

@not-an-aardvark done, thank you for the assistance! 🍺

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

I think editing the original issue would probably be the best thing to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indentation, indentation, indentation — Coding for Data - 2020 ...
an expression that gives sequence of values followed by. the character : followed by. an indented block of one or more statements. This...
Read more >
How to indent a few lines in Markdown markup?
One way to do it is to use bullet points, which allows you specify multiple levels of indentation. Bullet points are inserted using...
Read more >
De-indenting blocks of code when everything is ... - GitHub
I expect the whole block of code to first be deindented by 4 spaces, then by the 1 last remaining space. Instead, the...
Read more >
Indentation Without Dents - Vimways
Now say that we create a new MATLAB indent plugin in $HOME/.vim/indent/matlab.vim to replace the default one found at $VIMRUNTIME/indent/matlab.
Read more >
Circular indentations on leg - Dermstore
My husband has these weird circular indentation on his legs. For years (30 or more) he's had one. It's about 1/2 inch across,...
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