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

Added JSDoc to ESLint #3529

Merged
merged 4 commits into from
Aug 11, 2023
Merged

Conversation

Computroniks
Copy link
Contributor

@Computroniks Computroniks commented Aug 6, 2023

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

JSDoc has been added to the ESLint configuration and all errors have been corrected.

This is a follow up from the previous JSDoc PRs #2549 #1535 #1542 #1550 #1499. Hopefully adding JSDoc to ESLint should make this the last time anyone has to go through and fix JSDoc.

Type of change

  • Other

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings

Signed-off-by: Matthew Nickson <[email protected]>
Signed-off-by: Matthew Nickson <[email protected]>
@Computroniks
Copy link
Contributor Author

@louislam Given node 14 went EoL 3 months ago (https://endoflife.date/nodejs) it is probably worth updating the workflows. That would also fix the linter issue here as node 14 is no longer supported by eslint-plugin-jsdoc (gajus/eslint-plugin-jsdoc#1034)

@louislam
Copy link
Owner

louislam commented Aug 10, 2023

Other than packjson.json, .eslintrc.js and auto-test.yml, were the rest of the changes made by eslint-plugin-jsdoc? Since there are too many changes, I may be unable to review all files. If they were changed by tool, maybe I can trust directly.

@Computroniks
Copy link
Contributor Author

Computroniks commented Aug 10, 2023

Other than packjson.json, .eslintrc.js and auto-test.yml, were the rest of the changes made by eslint-plugin-jsdoc? Since there are too many changes, I may be unable to review all files. If they were changed by tool, maybe I can trust directly.

No, there were some automatic fixes but most were just me going to the lines which were marked as errors and manually adding in the missing docs. (It just felt like a lot when I was doing it 🤣)

Actually, just looking through again, it looks like about a quarter to a half are automatic changes (stuff like Object to object) and another quarter or so is adding @returns {void} The final bunch was adding some missing comments and adding descriptions to parameters and returns and throws.

@Computroniks
Copy link
Contributor Author

Computroniks commented Aug 10, 2023

Most of them were just adding in an @returns void or the odd comment here or there, or adding descriptions for parameters. If you like, I could split it up into multiple PRs like we did for the original batch.

@louislam louislam added this to the 2.0.0 milestone Aug 10, 2023
@louislam louislam changed the base branch from master to 2.0.X August 11, 2023 07:28
# Conflicts:
#	server/database.js
@louislam louislam merged commit 8a92054 into louislam:2.0.X Aug 11, 2023
@chakflying
Copy link
Collaborator

Do you know how to get the JSDoc errors to show natively in VS Code?

@Computroniks
Copy link
Contributor Author

Do you know how to get the JSDoc errors to show natively in VS Code?

Cant remember the exact steps (it was so long ago when I did it) but I have a feeling just installing the eslint plugin should do that

@louislam
Copy link
Owner

Do you know how to get the JSDoc errors to show natively in VS Code?

Checked on GitHub Codespace, it should work with the eslint plugin.

image

db3a7d6

Fyi, unlikely other rules, since some jsdoc rules cannot be fixed automatically by eslint, I change some rules to warn instead of error. As my IDE keeps saying that my code is wrong during development. It is a bit uncomfortable and too aggressive.

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.

3 participants