Skip to content

Commit

Permalink
Update: Improve report location for max-len (refs #12334) (#13458)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Jul 7, 2020
1 parent 095194c commit b77b420
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 57 deletions.
15 changes: 13 additions & 2 deletions lib/rules/max-len.js
Expand Up @@ -383,11 +383,22 @@ module.exports = {
return;
}

const loc = {
start: {
line: lineNumber,
column: 0
},
end: {
line: lineNumber,
column: textToMeasure.length
}
};

if (commentLengthApplies) {
if (lineLength > maxCommentLength) {
context.report({
node,
loc: { line: lineNumber, column: 0 },
loc,
messageId: "maxComment",
data: {
lineLength,
Expand All @@ -398,7 +409,7 @@ module.exports = {
} else if (lineLength > maxLength) {
context.report({
node,
loc: { line: lineNumber, column: 0 },
loc,
messageId: "max",
data: {
lineLength,
Expand Down

0 comments on commit b77b420

Please sign in to comment.