Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
requireCapitalizedComments: do not use getLoc method
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Apr 12, 2016
1 parent a669086 commit 83a1647
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/rules/require-capitalized-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ module.exports.prototype = {
return comment.value.replace(/[\n\s\*]/g, '')[0];
},

_isTextBlock: function(comment, file) {
_isTextBlock: function(file, comment) {
var prevComment = file.getPrevToken(comment, {includeComments: true});

if (prevComment) {
return prevComment.type === 'CommentLine' &&
prevComment.getLoc().start.line + 1 === comment.getLoc().start.line &&
!file.isOnTheSameLine(comment, prevComment) &&
prevComment.value.trim().length > 0;
}

Expand All @@ -210,10 +210,10 @@ module.exports.prototype = {
return false;
}

var firstToken = file.getFirstNodeToken(comment);
var otherToken = file.getPrevToken(firstToken, { includeComments: true });
var firstToken = comment.getFirstToken();
var otherToken = firstToken.getPreviousNonWhitespaceToken();

return otherToken ? otherToken.getLoc().start.line === firstToken.getLoc().start.line : false;
return otherToken ? file.isOnTheSameLine(otherToken, firstToken) : false;
},

check: function(file, errors) {
Expand All @@ -240,7 +240,7 @@ module.exports.prototype = {
return;
}

if (_this._isTextBlock(comment, file)) {
if (_this._isTextBlock(file, comment)) {
return;
}

Expand Down

0 comments on commit 83a1647

Please sign in to comment.