Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-20049 Add eslint-jsdoc plugin and fix errors #1890

Merged
merged 7 commits into from
Jun 13, 2023

Conversation

khelif96
Copy link
Contributor

@khelif96 khelif96 commented Jun 9, 2023

EVG-20049

Description

Adds the eslint-jsdoc plugin to the spruce repo.
Ran into the following issue because some of our props were named readonly for now I disabled the jsdoc/valid-types rule on files that are affected.
jsdoc-type-pratt-parser/jsdoc-type-pratt-parser#104

@khelif96 khelif96 requested a review from a team June 9, 2023 21:39
@cypress
Copy link

cypress bot commented Jun 9, 2023

Passing run #10644 ↗︎

0 554 7 0 Flakiness 0

Details:

Merge branch 'main' into EVG-20049
Project: Spruce Commit: 4b6b90bbed
Status: Passed Duration: 14:38 💡
Started: Jun 13, 2023 3:17 PM Ended: Jun 13, 2023 3:32 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

.eslintrc.js Outdated
Comment on lines 28 to 29
"plugin:prettier/recommended", // Note: prettier must ALWAYS be the last extension.
"plugin:jsdoc/recommended-typescript-error",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"plugin:prettier/recommended", // Note: prettier must ALWAYS be the last extension.
"plugin:jsdoc/recommended-typescript-error",
"plugin:jsdoc/recommended-typescript-error",
"plugin:prettier/recommended", // Note: prettier must ALWAYS be the last extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😓

src/utils/validators/index.ts Show resolved Hide resolved
@@ -33,6 +33,11 @@ export const shortenString = (
return valueSubstring + (tail || " …");
};
Copy link
Contributor

Choose a reason for hiding this comment

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

shortenString in this file is missing a doc comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it entirely since it isn't used in the codebase and is dead code.

*/
const formatZeroIndexForDisplay = (value: number): number => value + 1;

/**
* roundDecimal rounds a decimal number to include a certain number of decimal places. It does not add trailing
* `roundDecimal` rounds a decimal number to include a certain number of sig figs. It does not add trailing
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] I would prefer going back to the original description

e.g. the result below has 4 significant figures, and 2 decimal places

Screenshot 2023-06-12 at 10 43 39 AM

@@ -1,3 +1,4 @@
/* eslint-disable jsdoc/valid-types */
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to just disable it for that comment block rather than for the whole file? Someone in the GitHub issue thread seemed to have a solution for that

Copy link
Contributor Author

@khelif96 khelif96 Jun 12, 2023

Choose a reason for hiding this comment

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

Unfortunately, I couldn't get this to pass the pre-commit hook check.

@@ -1,3 +1,4 @@
/* eslint-disable jsdoc/valid-types */
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment

Comment on lines +27 to +31
* @param props.stopPolling - Function from useQuery that is called when offline or not visible
* @param props.refetch - Optional function from useQuery that can be used to refetch data.
* @param props.shouldPollFaster - Optional boolean to enable increased poll rate.
* @param props.initialPollingState - Optional boolean to indicate the initial polling state.
* @param props.startPolling - Function from useQuery that is called when online and visible
Copy link
Contributor

Choose a reason for hiding this comment

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

do you know why whenever the props comes in as an object, its individual fields are always typed as any? I see any when I hover over these fields, but I get proper types when the props isn't an object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure tbh. I think vscode intellisense is just having a tough time parsing these object fields.

@khelif96 khelif96 requested a review from minnakt June 12, 2023 19:40
Copy link
Contributor

@minnakt minnakt left a comment

Choose a reason for hiding this comment

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

yeaaay! i left a bunch of comments but it's all just small edits 🥳

src/components/HistoryTable/hooks/useTestResults.test.tsx Outdated Show resolved Hide resolved
src/pages/commits/InactiveCommits/index.tsx Outdated Show resolved Hide resolved
src/pages/commits/utils.ts Outdated Show resolved Hide resolved
src/utils/array/index.ts Outdated Show resolved Hide resolved
src/utils/array/index.ts Outdated Show resolved Hide resolved
src/utils/validators/index.ts Outdated Show resolved Hide resolved
src/utils/validators/index.ts Outdated Show resolved Hide resolved
src/pages/commits/ActiveCommits/utils.ts Outdated Show resolved Hide resolved
src/hooks/useQueryParam/index.ts Outdated Show resolved Hide resolved
src/hooks/useStatusesFilter.ts Outdated Show resolved Hide resolved
Co-authored-by: minnakt <47064971+minnakt@users.noreply.github.com>
@khelif96 khelif96 changed the title EVG-20049 Add eslint-jsdoc plugin to spruce and fix errors EVG-20049 Add eslint-jsdoc plugin and fix errors Jun 13, 2023
khelif96 and others added 3 commits June 13, 2023 11:11
Co-authored-by: minnakt <47064971+minnakt@users.noreply.github.com>
Co-authored-by: minnakt <47064971+minnakt@users.noreply.github.com>
@khelif96 khelif96 merged commit 44f9dc9 into evergreen-ci:main Jun 13, 2023
5 checks passed
@khelif96 khelif96 deleted the EVG-20049 branch June 13, 2023 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants