jscs-dev / jscs-jsdoc

JsDoc validation rules for jscs
MIT License
99 stars 35 forks source link

Misc: find docblock separated by an extra newline #144

Closed lvivier closed 8 years ago

lvivier commented 9 years ago

On my team we habitually add an extra newline after docblocks. This pull request allows a docblock to be separated from the thing it documents by one or two newlines. It additionally requires a docblock to be indented at the same level as the thing it documents.

Both valid:

/**
 * Get a foo
 */
function foo () {}

/**
 * Get a bar
 */

function bar () {}

And this is not:

/**
 * Get a foo
 */
    function foo () {}
qfox commented 9 years ago

All your wishes seems valid.

Also there are situations like:

var SomeClass = _construct(function () {
  // ...
},
/** @lends SomeClass.prototype */ { // docblock should be attached to followed object
  // ...
});

And also would be great if we will check doc blocks related to file itself somehow. Not sure how to resolve this:

/**
 * Copyright blabla
 * @author Eugene Poorgen
 * @fileoverview Some overview
 */

export default class MyClass { // jsdoc-less class
  // ...
}

With this patch file jsdoc-block will be attached to class. But this is wrong behavior for sure. ;-)

Would be great if we will handle these cases too.

lvivier commented 9 years ago

@zxqfox thanks for this, I'll create some tests for these cases and try to resolve them.

qfox commented 9 years ago

@lvivier Sorry for a big time gap. Can you check this https://github.com/jscs-dev/jscs-jsdoc/compare/144?expand=1 ? Does this fits your needs?

qfox commented 8 years ago

Closed by 4548ecfe7aa669ff7ba136326b5b042f1d7881ff

Thank you!