Repository: jscs-dev/node-jscs

Issue #2244: Issues with validateNewlineAfterArrayElements
Created: 2016-05-09T20:59:55Z
When running jscs v3.0.3 against this file:
foo.js:
var bar = [1, 2, 3, 4, 5, 6]
With this configuration:
.jshintrc:
{
    "validateNewlineAfterArrayElements": {
        "maximum": 4
    }
}
I get the following error in the output:
TypeError: Cannot read property 'replace' of undefined
    at renderLine (C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\errors.js:266:16)
    at Object.Errors.explainError (C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\errors.js:197:13)
    at C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\reporters\console.js:16:36
    at Array.forEach (native)
    at C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\reporters\console.js:14:35
    at Array.forEach (native)
    at Object.module.exports [as writer] (C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\reporters\console.js:9:22)
    at C:\Temp\github\linter-jscs_GH239\node_modules\jscs\lib\cli.js:149:18
    at Array.<anonymous> (C:\Temp\github\linter-jscs_GH239\node_modules\vow\lib\vow.js:712:56)
    at Immediate.callFns [as _onImmediate] (C:\Temp\github\linter-jscs_GH239\node_modules\vow\lib\vow.js:23:35)

If the reporter is changed to JSON, it seems to be incrementing the line value for every element?
{".\\foo.js":[{"line":1,"column":12,"message":"validateNewlineAfterArrayElements: First element should be placed on new line"},{"line":2,"column":3,"message":"validateNewlineAfterArrayElements: Multiple elements at a single line in multiline array"},{"line":3,"column":4,"message":"validateNewlineAfterArrayElements: Multiple elements at a single line in multiline array"},{"line":4,"column":4,"message":"validateNewlineAfterArrayElements: Multiple elements at a single line in multiline array"},{"line":5,"column":4,"message":"validateNewlineAfterArrayElements: Multiple elements at a single line in multiline array"},{"line":6,"column":4,"message":"validateNewlineAfterArrayElements: Multiple elements at a single line in multiline array"},{"line":7,"column":3,"message":"validateNewlineAfterArrayElements: Closing bracket should be placed on new line"}]}

Using the Node API (Inside the linter-jscs Atom package) returns results similar to the JSON output. Note that this was initially filed here
A folder with a minimal reproduction case is included here: linter-jscs_GH239.zip
If there is any further information you need just let me know.

Duplicate issue #2245: requireSemicolons and requirePaddingNewLinesAfterBlocks combined report wrong line
Created: 2016-05-11T18:53:12Z
When running jscs v3.0.3 against this file:
example2.js:
{}
console.log(false)
With this configuration:
.jshintrc:
{
  "requirePaddingNewLinesAfterBlocks": true,
  "requireSemicolons": true
}

JSCS is reporting the requireSemicolons error on line 3 instead of line 2. I get the same results when running on the CLI with the default and JSON reporters, as well as when using the Node API (Inside the linter-jscs Atom package).

Note that this was initially filed as AtomLinter/linter-jscs#241.
A folder with a minimal reproduction case is included here: linter-jscs_GH241.zip
If there is any further information you need just let me know.

Closing comment (2016-05-13T17:50:28Z): Same as #2244