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

[chore] add require-jsdoc #459

Closed
wants to merge 6 commits into from
Closed

[chore] add require-jsdoc #459

wants to merge 6 commits into from

Conversation

zekth
Copy link
Contributor

@zekth zekth commented May 27, 2019

As we want to make a robust API, we also need to have a robust documentation. Adding JsDoc check in the pipeline is necessary i think. We sometimes (me the first) forget about adding JsDoc. Then it would help for the PR review process.

I've added another eslint line for the pipeline because i don't want to flood the main one with all the warnings. Once the repo will be cleaned i think we can merge the two commands in one. Also there is some warning about _test files ignored because we don't need documentation for it. Note: only wait to disable those warns is to --quiet the eslint command.

To ignore private methods you have to do like this:
https://github.com/denoland/deno_std/compare/master...zekth:jsdo_proposal?expand=1#diff-3dabb7bf52bbca9c45474fe23c1d029bR122

For the moment only the rule of missing jsdoc is applied. Feel free to give you thoughts about adding rules.
Here is the doc: https://eslint.org/docs/rules/require-jsdoc

function arrayStart(line: string): boolean {
const reg = /.*=\s*\[/g;
return reg.test(line) && !(line[line.length - 1] === "]");
}

/** @private */
Copy link
Member

Choose a reason for hiding this comment

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

All of these @Private comments are superfluous. Either the method is public and exported or it's private. How can we adding these superfluous comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree with you and i've not found any workaround (for now) for this problem. There is only this in the doc: https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-settings-allow-private-to-disable-rules-for-that-comment-block

Problem is this is the reference plugin from eslint : https://eslint.org/blog/2018/11/jsdoc-end-of-life and it seems a bit incomplete for the private part.

Copy link

@j-f1 j-f1 May 28, 2019

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@zekth zekth May 28, 2019

Choose a reason for hiding this comment

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

GREAT
i'll delete the @private so and wait for the PR to be landed

@zekth
Copy link
Contributor Author

zekth commented Sep 29, 2019

@ry is it still revelant to add to the CI? I've seen the PR has been merged for eslint-plugin-jsdoc. I have a local branch working with it. Do you want me to push it?

@ry
Copy link
Member

ry commented Sep 29, 2019

It seems unreasonable to require jsdoc for everything. Can it be enforced for only exported functions?

@zekth
Copy link
Contributor Author

zekth commented Sep 29, 2019

It seems unreasonable to require jsdoc for everything. Can it be enforced for only exported functions?

Now with the merged PR it throws errors only on missing jsdoc on exported funcs. Using this argument:

    "rules": {
        "jsdoc/require-jsdoc": [
            "error",
            {
                "publicOnly": true
            }
        ]
    }

@zekth zekth mentioned this pull request Sep 29, 2019
@zekth
Copy link
Contributor Author

zekth commented Sep 29, 2019

Closing as a new one as been created.

@zekth zekth closed this Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants