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: max-len will warn indented comment lines (fixes #6322) #6324

Merged
merged 1 commit into from Jun 10, 2016
Merged

Conversation

kaicataldo
Copy link
Member

No description provided.

@eslintbot
Copy link

LGTM

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @vitorbal, @bgw and @nevir to be potential reviewers

@@ -157,10 +157,12 @@ module.exports = {
*/
function isFullLineComment(line, lineNumber, comment) {
var start = comment.loc.start,
end = comment.loc.end;
end = comment.loc.end,
isFirstTokenOnLine = !line.slice(0, comment.loc.start.column).trim();
Copy link
Member Author

@kaicataldo kaicataldo Jun 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing this from the no-inline-comments rule

var preamble = startLine.slice(0, node.loc.start.column).trim();

@@ -157,11 +157,14 @@ module.exports = {
*/
function isFullLineComment(line, lineNumber, comment) {
var start = comment.loc.start,
end = comment.loc.end;
end = comment.loc.end,
isFirstTokenOnLine = !line.slice(0, comment.loc.start.column).trim(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing this from the no-inline-comments rule

var preamble = startLine.slice(0, node.loc.start.column).trim();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a pretty arcane bit of code- would it be worth extracting that to a place like ast-utils?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be - it's pretty niche (really only useful to see if the comment is the first thing on that line)

Copy link
Member Author

@kaicataldo kaicataldo Jun 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other rules (such as lines-around-comment) are able to use sourceCode.getTokenBefore and could check the location that way - in this rule I only had access to the line, so I thought this was a pretty elegant solution.

Not sure why my comments got all messed up - it's hiding the wrong one for some reason.

@eslintbot
Copy link

LGTM

@ilyavolodin
Copy link
Member

LGTM

@nzakas nzakas merged commit 2d63370 into master Jun 10, 2016
@kaicataldo kaicataldo deleted the fixes6322 branch June 19, 2016 03:56
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants