indent rule with array of objects
See original GitHub issueThought 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:
- Created 8 years ago
- Reactions:1
- Comments:54 (25 by maintainers)
Top 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 >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
@jadengore we need to leave it open so someone can express interest in addressing it.
@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.