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

Require JsDoc on validators #44893

Closed
anonrig opened this issue Oct 4, 2022 · 3 comments · Fixed by #44896
Closed

Require JsDoc on validators #44893

anonrig opened this issue Oct 4, 2022 · 3 comments · Fixed by #44896
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@anonrig
Copy link
Member

anonrig commented Oct 4, 2022

What is the problem this feature will solve?

This change will enforce the use of JSDocs in internal validators and make it easier for developers to contribute the validators with correct parameters (and auto-completion)

What is the feature you are proposing to solve the problem?

Using an eslint rule to enforce jsdoc for lib/validators.js

What alternatives have you considered?

Nothing

@anonrig anonrig added the feature request Issues that request new features to be added to Node.js. label Oct 4, 2022
@Trott
Copy link
Member

Trott commented Oct 5, 2022

We already use eslint-plugin-jsdoc for JSDoc linting. We turn on the recommended rules for it:

node/.eslintrc.js

Lines 41 to 42 in e84e2e6

extends: ['eslint:recommended', 'plugin:jsdoc/recommended'],
plugins: ['jsdoc', 'markdown', 'node-core'],

But then we turn a bunch of them off:

node/.eslintrc.js

Lines 304 to 314 in e84e2e6

// JSDoc recommended rules that we disable
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/newline-after-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/valid-types': 'off',
'jsdoc/no-undefined-types': 'off',
'jsdoc/require-param': 'off',
'jsdoc/check-tag-names': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-property-description': 'off',

So maybe enabling one of those disabled rules will accomplish what you are looking for?

Trott added a commit to Trott/io.js that referenced this issue Oct 5, 2022
Trott added a commit to Trott/io.js that referenced this issue Oct 5, 2022
@Trott
Copy link
Member

Trott commented Oct 5, 2022

Does #44896 do what you are looking for? Or are there validators in other files that you are looking to apply JSDoc comments to?

@anonrig
Copy link
Member Author

anonrig commented Oct 5, 2022

Yes this was what I was looking for. Thanks @Trott

Trott added a commit to Trott/io.js that referenced this issue Oct 6, 2022
@Trott Trott closed this as completed in c50987e Oct 7, 2022
danielleadams pushed a commit that referenced this issue Oct 11, 2022
Closes: #44893
PR-URL: #44896
Fixes: #44893
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants