Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Indentation in objects with chained function call is not accepted #713

Closed
adrianheine opened this Issue Oct 25, 2012 · 4 comments

Comments

Projects
None yet
4 participants

The following code gives me indentation errors on the last two lines:

/*jshint indent: 2*/
/*jslint indent: 2*/
var x = {
  prop1: chainable
    .chaincall({
      foo: null
    }),

  prop2: null
};

Apparently JSHINT expects these two lines to be indented one step further. Note that this seems to be a minimal example, so the object literal parameter for chaincall seems to be part of the problem.

Contributor

Shutnik commented Feb 28, 2013

+1 for that!

Another test case:

/*jshint indent:4*/

this.one(
    this.two(
        this.three({
            four: true // Expected 'four' to have an indentation at 5 instead at 13. WTF?
        })
    )
);

@valueof valueof closed this in 30c0019 Mar 27, 2014

Contributor

Shutnik commented Mar 27, 2014

What an elegant solution :-)

Owner

valueof commented Mar 27, 2014

Contributor

gtanner commented Sep 16, 2014

I find the line breaking in the above examples a little weird: Changed to:

var x = {
  prop1: chainable.chaincall({
    foo: null
  }),
  prop2: null
};

/*jshint indent:4*/
this.one(this.two(this.three({
    four: true // Expected 'four' to have an indentation at 5 instead at 13. WTF?
})));

The both work fine (and pass lint with 2.4.4).

I only break lines (and indent) on { which serves me well

@jugglinmike jugglinmike added a commit to jugglinmike/jshint that referenced this issue Oct 21, 2014

@valueof @jugglinmike valueof + jugglinmike Remove code for enforcing indentation.
Option 'indent' still exists, though, for correct character reporting.

Closes #1583
Closes #999
Closes #1085
Closes #1467
Closes #1404
Closes #713
Closes #428
Closes #1369
Closes #1254
9de6786
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment