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

Add more precise types in the JSDoc #818

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

stof
Copy link
Member

@stof stof commented Aug 3, 2020

These are the type improvements coming from my investigation in #816 (and then pushed until the end rather than stopping at a few methods for the experiment)

@stof
Copy link
Member Author

stof commented Aug 4, 2020

The failing tests seem unrelated to my PR. I'm changing only comments

@stof
Copy link
Member Author

stof commented Aug 4, 2020

hmm, looks like the jsdoc parser of eslint does not like the object types defining properties. And given that the valid-jsdoc rule is deprecated and the corresponding parser is unmaintained, it is unlikely to be fixed.

@Lyrkan @weaverryan should we disable that rule ?

@stof
Copy link
Member Author

stof commented Aug 4, 2020

Or maybe we should migrate to https://github.com/gajus/eslint-plugin-jsdoc

Copy link
Collaborator

@Lyrkan Lyrkan left a comment

Choose a reason for hiding this comment

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

Sorry for not looking at this sooner, those are some great changes :)

@Lyrkan @weaverryan should we disable that rule ?
Or maybe we should migrate to gajus/eslint-plugin-jsdoc

We could try gajus/eslint-plugin-jsdoc but I wouldn't mind disabling valid-jsdoc entirely either tbh.

@weaverryan weaverryan changed the base branch from master to main November 18, 2020 18:17
@weaverryan
Copy link
Member

My preference would be to remove our valid-jsdoc and try https://github.com/gajus/eslint-plugin-jsdoc - it looks high quality, and i do kinda like our very-complete (and validated with eslint) jsdoc.

@stof
Copy link
Member Author

stof commented Dec 3, 2020

@Lyrkan @weaverryan I made the migration to eslint-plugin-jsdoc (and I fixed all the extra things it reports, which were not detected by valid-jsdoc)

@stof
Copy link
Member Author

stof commented Dec 3, 2020

The failure for the job Lowest versions of the dependencies is unrelated to my change. that's also broken in the main branch.

This documents the value type for arrays of strings in arguments.
webpack provides type definitions for their whole API, so we can
reference their type rather than specifying a generic "object" type.
Referencing the webpack types was already done for the returned
configuration.
Most of them are documented as receiving an object and returning an
object or void. But some callbacks dealing with parts of the webpack
configuration itself have a more precise type for the options object.
This documents that they are used in such a way, with the type of the
values.
This brings the list of supported options in the type definitions with
their type, which lets IDEs provide autocompletion for them.
The deprecated valid-jsdoc rule of eslint does not support using
typescript syntax for types, while it allows being more precise about
types in a much more readable way than using the older jsdoc syntax with
separate typedef or callback definitions.
The plugin also implements more rules than what valid-jsdoc does.
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