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 with only one object

See original GitHub issue

eslint version 1.1.0

Code example:

// Case 1
var object = { // Legal
  x: 2,
  y: 3
};

// Case 2  
var object2 = { // Not legal
      x: 2
    };

// Case 3   
var object3 = { // Legal
      x: 2
    },
    variable;

Rules:

"one-var": [2, "always"],
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": 2}]

eslint Output:

7:7  error  Expected indentation of 2 characters but found 6  indent

Case 2 should be legal

<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
  • Comments:29 (20 by maintainers)

github_iconTop GitHub Comments

3reactions
kethinovcommented, Jan 8, 2017

It’s an accepted bug though, so I wouldn’t say it’s working as intended.

2reactions
sstern6commented, Sep 16, 2016

@nzakas this seems related to an issue im trying to patch right now https://github.com/eslint/eslint/issues/4161. Waiting for feedback to proceed on the issue. Id be happy to take a swing at this one as well if the community would like. If you’d like them separate I can tackle this once the other PR is up and ready!

Thanks and let me know how you reccomend proceeding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to apply indenting serialization only to some properties?
Currently I'm using JSON.NET's JsonConvert.SerializeObject(object, Formatting, JsonSerializerSettings) method for serialization, but it seems I ...
Read more >
Indent the first line of a paragraph - Microsoft Support
To indent the first line of a paragraph, put your cursor at the beginning of the paragraph and press the tab key. When...
Read more >
How to indent just the second lines of citations in Google Docs?
To create one: Highlight the citation; Select "Format" in the top menu; Select "Align and Indent" in the drop down; Then click "Indentation...
Read more >
Operate on an Indented Block of Lines with vim-indent-object
vim-indent-object is a great Vim plugin that adds an i text object for an indented block of text, very useful in Python! vii...
Read more >
All About Indents and Other Paragraph Separators
Choosing the right method to create paragraph separations not only helps with ... line indents, except for the very first line, which does...
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