Skip to content

Commit

Permalink
Allow whitespace after jsdoc comments. Fixes eslint#6238
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyruppel committed May 20, 2016
1 parent 777941e commit 2321d2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/util/source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ function findJSDocComment(comments, line) {
if (comments) {
for (var i = comments.length - 1; i >= 0; i--) {
if (comments[i].type === "Block" && comments[i].value.charAt(0) === "*") {

if (line - comments[i].loc.end.line <= 1) {
if (comments[i].loc.end.line <= line) {
return comments[i];
} else {
break;
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/util/source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ describe("SourceCode", function() {
assert.isTrue(spy.calledOnce, "Event handler should be called.");
});

it("should not get JSDoc comment for function declaration when the function has blank lines on top", function() {
it("should get JSDoc comment for function declaration when the function has blank lines on top", function() {

var code = [
"/** Merges two objects together.*/",
Expand All @@ -857,7 +857,8 @@ describe("SourceCode", function() {
var sourceCode = eslint.getSourceCode();
var jsdoc = sourceCode.getJSDocComment(node);

assert.isNull(jsdoc);
assert.equal(jsdoc.type, "Block");
assert.equal(jsdoc.value, "* Merges two objects together.");
}

var spy = sandbox.spy(assertJSDoc);
Expand Down

0 comments on commit 2321d2a

Please sign in to comment.