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 rule should be more lax on line comments on consecutive lines

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.1.0
  • Node Version: 7.9.0
  • npm Version: 4.2.0

What parser (default, Babel-ESLint, etc.) are you using?


Please show your full configuration:

			"indent": [ 2, "tab", {
				"MemberExpression": "off"

Full configuration here:

What did you do? Please include the actual source code causing the issue.

			var now = (|0); =;  // to trigger a security exception if user tried
						// to mod_delete a message of another room
			m.content = "!!deleted by:" + + ' on:'+ now + ' ' + m.content;
			return this.storeMessage(m, true)

code around:

What did you expect to happen?

I expected eslint to either

  • accept this comments formatting without triggering an error (as in previous eslint versions)
  • let me disable indent checks on comments
  • let me configure the indent rule to accept (not exclusively) this kind of comment formatting (self aligned on the first possible tab indent (which depends on the number of spaces per tab))

What actually happened? Please include the actual, raw output from ESLint.

I didn’t find any way to keep this comment as is without disabling the whole indent rule.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

platinumazurecommented, Jun 26, 2017

Edited the title to make it a little more clear (I interpreted “multi-line comments” as “block comments” on initial read).

Currently, comments are allowed to be indented in one of three ways:

  • Align with first token of previous line
  • Align with first token of next line
  • The “correct” location based on immediate previous tokens (i.e., the same location a statement would be expected to go)

The comment in your example is none of those.

It might be worth enhancing the rule (either by default, or via new option) to allow a line comment’s indentation to be the same location as the beginning of the previous line’s line comment (where there is one).

@not-an-aardvark Thoughts?

yairEOcommented, Jul 3, 2017

I want ESLIST to completely ignore comments. it’s pissing me off that I don’t have full control and then my stack shows a TON of warnings for my code comments in million files. so annoying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

comment indentation can break code indentation
I feel that single line comments that are ALONE on their line should be indented to match the start of the previous line....
Read more >
SQL Statement indentation good practice - Stack Overflow
If there many more columns on the select clause, I would indent the second and subsequent lines... I generally do NOT adhere to...
Read more >
Write better Markdown -
Blank lines between list items can be interpreted very differently between processors. Keep list items consecutive, but you can use blank lines ...
Read more >
indent - 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 >
R Packages (2e) - 10 DESCRIPTION
If your description spans multiple lines (and it should!), each line must be no more than 80 characters wide. Indent subsequent lines with...
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