Skip to content

Commit

Permalink
Merge pull request #4150 from eslint/issue4142
Browse files Browse the repository at this point in the history
Fix: `indent` arrow function check fix (fixes #4142)
  • Loading branch information
nzakas committed Oct 16, 2015
2 parents 2d7ece2 + f655635 commit 98fd9e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ module.exports = function(context) {
if (calleeNode.parent.type === "CallExpression") {
var calleeParent = calleeNode.parent;

if (calleeNode.type !== "FunctionExpression") {
if (calleeNode.type !== "FunctionExpression" && calleeNode.type !== "ArrowFunctionExpression") {
if (calleeParent && calleeParent.loc.start.line < node.loc.start.line) {
indent = getNodeIndent(calleeParent);
}
Expand Down
12 changes: 12 additions & 0 deletions tests/lib/rules/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ var ruleTester = new RuleTester();
ruleTester.run("indent", rule, {

valid: [
{
code:
"let foo = somethingList\n" +
" .filter(x => {\n" +
" return x;\n" +
" })\n" +
" .map(x => {\n" +
" return 100 * x;\n" +
" });\n",
options: [4],
ecmaFeatures: {arrowFunctions: true, blockBindings: true}
},
{
code:
"require('http').request({hostname: 'localhost',\n" +
Expand Down

0 comments on commit 98fd9e6

Please sign in to comment.