javascriptjshintgrunt-contrib-jshint

JSHint: Multiple Indents?


I'm using D3 in my project. I'd love to enforce a specific indentation pattern, but due to the multiple chaining I'd like to organize my code using multiple instances of indentation. JSHint throws an error when I have something like this:

var svgContainer = d3.select(location).append('svg')
    .attr()
    .attr();

    var xAxisGroup = svgContainer.append('g') // throws error here
        .attr()
        .call();

Is there any possible way I can enforce 4 indents, but ignore multiple indentations in .jshintrc? i.e. var AxisGroup stems from svgContainer, would like the nesting without warnings from JSHint.


Solution

  • Through research I've definitively found that "white" is deprecated and shouldn't be used.

    It turns out I was using grunt's grunt-contrib-jshint at an older version before version 2.5.0 where JSHint allows multiple indentation.

    Changing the package.json I had for grunt to "grunt-contrib-jshint": "^0.10.0", fixed this problem.