jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

Indentation problems with arrays #2192

Closed brupelo closed 8 years ago

brupelo commented 8 years ago

Hi,

I'm trying to create .jscsrc following standard conventions and i'm having some issue with jscs 2.11.0 and arrays, here's my .jscsrc file:

{
    "preset": "node-style-guide",
    "disallowSemicolons": true,
    "disallowSpacesInFunction": null,
    "requireSpaceAfterComma": true,
    "requireTrailingComma": null,
    "requireCamelCaseOrUpperCaseIdentifiers": null,
    "validateLineBreaks": null,
    "maximumLineLength": null,
    "validateQuoteMarks": "'",
    "requireSpacesInFunction": {
        "beforeOpeningRoundBrace": true,
        "beforeOpeningCurlyBrace": true
    },
    "disallowMultipleSpaces": true,
    "requireCapitalizedComments": null,
    "disallowQuotedKeysInObjects": null,
    "disallowTrailingWhitespace": null,
    "validateIndentation": 2,
    "disallowMultipleLineBreaks": true
}

For instance, in this function i'd expect Sublime-Linter + SublimeLinter-jscs to notify me about the 4 spaces in that array, it's not saying anything though:

  initBuffers: function () {
    var gl = this.gl
    var triangleVertexPositionBuffer = this.triangleVertexPositionBuffer = gl.createBuffer()
    gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer)
    var vertices = [
        0.0, 1.0, 0.0,
        -1.0, -1.0, 0.0,
        1.0, -1.0, 0.0
    ]

Is this a well known issue, any recommendation to fix it?

PS: I'd prefer using jscs to check my code against standard convention instead standard itself, don't ask me why :-)

markelog commented 8 years ago

From http://jscs.info/rule/validateIndentation

Validates indentation for switch statements and block statements

brupelo commented 8 years ago

@markelog : So, what does that mean? Did you see the .jscsrc i've pasted? I'm already using "validateIndentation": 2 .

When you say "Validates indentation for switch statements and block statements" you mean this is a jscs limitation won't be fixed? It'd be cool if arrays were indented properly, that way i could use jscs fix and standard wouldn't complain.

markelog commented 8 years ago

When you say "Validates indentation for switch statements and block statements" you mean this is a jscs limitation won't be fixed?

We have tickets about this - https://github.com/jscs-dev/node-jscs/issues/1866, so if anyone has the time to implement this, it would be most appreciated.