Indent level for fat arrow functions
See original GitHub issueTell us about your environment
- ESLint Version: 3.19.0
- Node Version: 6.9.5
- npm Version: 3.10.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
{
"extends": "standard",
"plugins": [
"standard",
"promise"
]
}
What did you do? Please include the actual source code causing the issue.
describe('AuthenticationService', () => {
describe('login', () => {
it('should not be able to login with wrong credentials',
inject([AuthenticationService, MockBackend], () => {
failCheck(
() => service.login('admin', 'admin'),
);
},
));
it('should be able to login with correct credentials',
inject([AuthenticationService, SessionService, MockBackend],
() => {
successCheck(
() => service.login('admin', 'admin'),
);
}),
);
});
});
What did you expect to happen?
The successCheck
should be correctly indented.
It would be nice if the line break resets the indent to the value of inject
+ 2 instead of orientating at the indent level of the parameter.
What actually happened? Please include the actual, raw output from ESLint.
14:10 error Expected indentation of 16 spaces but found 9 indent
17:7 error Expected indentation of 14 spaces but found 6 indent
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
JavaScript Code Styling Best Practices — Arrow Functions ...
In this article, we'll look at how to return items from arrow functions implicitly and spacing and indentation to make our code easy...
Read more >Arrow function indent · Issue #8144 · eslint/eslint - GitHub
It seems that arrow functions use the base indent. eslint --fix. test.js. module.exports = (() ...
Read more >Which ESLint rule applies to Promise/Arrow function indent?
I suggest adding a new line before the fulfill handler. Since you give .then two handlers, doing so can keep them at the...
Read more >Arrow function expressions - JavaScript - MDN Web Docs
An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate ...
Read more >I Don't Hate Arrow Functions - David Walsh Blog
"You Don't Know JS: ES6 & Beyond", Ch2, "Arrow Functions" ... are what we value most, when we're level headed enough to make...
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 Free
Top 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
@CSchulz In theory, yes. However, we generally only add options to rules if they meet a set of guidelines, such as being generally applicable to many developers. (We can’t add options for every possible preference, because maintaining all the options would impose a large maintenance burden .) It’s possible that this option meets those criteria, but I’m not sure whether it does.
Could you elaborate on what the flag would do? How would it affect arrow function indentations in general? For example, would it affect arrow functions that are not function arguments?
Closing because this is working as intended, but feel free to create a new issue if you’d like to make a proposal for a new option.