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 rule with array of objects

See original GitHub issue

Thought I would file a separate issue instead of hijacking https://github.com/eslint/eslint/issues/3456. Using eslint 1.2.1. I expected the following to pass:

eslintrc:


---
rules:
  indent: [2, 2, {VariableDeclarator: 2}]

index.js:

var a = 1,
    b = 2;

var c = [
  {
    d: 1
  }
];
index.js
  5:3  error  Expected indentation of 4 space characters but found 2  indent
  6:5  error  Expected indentation of 6 space characters but found 4  indent
  7:4  error  Expected indentation of 4 space characters but found 2  indent

✖ 3 problems (3 errors, 0 warnings)

This will pass, but just looks weird:

var c = [
    {
      d: 1
    }
];

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:54 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, May 26, 2016

@jadengore we need to leave it open so someone can express interest in addressing it.

1reaction
ebramanticommented, Mar 17, 2016

@cowboy that is my typical issue as well, except I use the VariableDeclarator rule. Our entire codebase has had to change to your second example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom indentation rule for eslint in arrays and objects
I need aliment by identificators ( ignoring brackets ). For our code style this approach is more convinient. // default indent is 4...
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 >
enforce consistent indentation (indent-legacy) - ESLint
This rule enforces a consistent indentation style. The default style is 4 spaces . Options. This rule has a mixed option: For example,...
Read more >
jsonc/indent | eslint-plugin-jsonc
This rule enforces a consistent indentation style. The default style is 4 spaces . 1. 2.
Read more >
Rules - JavaScript Standard Style
Rules. Use 2 spaces for indentation. eslint: indent ... The statement has an unclosed paren, array literal, or object literal or ends in...
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