Skip to content

Commit b77b420

Browse files
authored
Update: Improve report location for max-len (refs #12334) (#13458)
1 parent 095194c commit b77b420

File tree

2 files changed

+178
-57
lines changed

2 files changed

+178
-57
lines changed

lib/rules/max-len.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,22 @@ module.exports = {
383383
return;
384384
}
385385

386+
const loc = {
387+
start: {
388+
line: lineNumber,
389+
column: 0
390+
},
391+
end: {
392+
line: lineNumber,
393+
column: textToMeasure.length
394+
}
395+
};
396+
386397
if (commentLengthApplies) {
387398
if (lineLength > maxCommentLength) {
388399
context.report({
389400
node,
390-
loc: { line: lineNumber, column: 0 },
401+
loc,
391402
messageId: "maxComment",
392403
data: {
393404
lineLength,
@@ -398,7 +409,7 @@ module.exports = {
398409
} else if (lineLength > maxLength) {
399410
context.report({
400411
node,
401-
loc: { line: lineNumber, column: 0 },
412+
loc,
402413
messageId: "max",
403414
data: {
404415
lineLength,

0 commit comments

Comments
 (0)