Skip to content

Commit

Permalink
Fix: false negative of max-len (fixes #6564)
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark committed Jun 30, 2016
1 parent 4c05967 commit 48ddb51
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/max-len.js
Expand Up @@ -162,7 +162,7 @@ module.exports = {

return comment &&
(start.line < lineNumber || (start.line === lineNumber && isFirstTokenOnLine)) &&
(end.line > lineNumber || end.column === line.length);
(end.line > lineNumber || (end.line === lineNumber && end.column === line.length));
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/lib/rules/max-len.js
Expand Up @@ -394,6 +394,21 @@ ruleTester.run("max-len", rule, {
column: 1
}
]
},

// check comments with the same length as non-comments - https://github.com/eslint/eslint/issues/6564
{
code: "// This commented line has precisely 51 characters.\n" +
"var x = 'This line also has exactly 51 characters';",
options: [20, { ignoreComments: true }],
errors: [
{
message: "Line 2 exceeds the maximum line length of 20.",
type: "Program",
line: 2,
column: 1
}
]
}
]
});

0 comments on commit 48ddb51

Please sign in to comment.