Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: false negative of max-len (fixes #6564) #6565

Merged
merged 1 commit into from Jul 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}
]
}
]
});