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

docs: Refactor documented functions to be methods rather than properties #2096

Closed
Tracked by #2081
maschad opened this issue Sep 30, 2023 · 9 comments
Closed
Tracked by #2081
Assignees
Labels
topic/docs Documentation

Comments

@maschad
Copy link
Member

maschad commented Sep 30, 2023

In order for methods to not be rendered as properties on the API docs e.g. the Libp2p Event Docs they should be refactored as such.

e.g.

/**
 * @packageDocumentation
 *
 * Exports a `Libp2p` type for modules to use as a type argument.
 *
 * @example
 *
 * ```typescript
 * import type { Libp2p } from '@libp2p/interface'
 *
 * function doSomethingWithLibp2p (node: Libp2p) {
 *   // ...
 * }
 * ```
 */
interface MyInterface {
  /**
   * This is a method description.
   */
  myMethod(arg1: string, arg2: number): boolean
}

as opposed to

interface MyInterface {
  /**
   * This is a method description.
   */
  myMethod: (arg1: string, arg2: number) => boolean
}
@maschad maschad added need/triage Needs initial labeling and prioritization help wanted Seeking public contribution on this issue good first issue Good issue for new contributors exp/beginner Can be confidently tackled by newcomers topic/docs Documentation and removed need/triage Needs initial labeling and prioritization labels Sep 30, 2023
@wemeetagain
Copy link
Member

This should be enforced when we upgrade aegir.
I have a local branch, but got distracted with #2095

@DarhkVoyd
Copy link

@maschad Hey, is this issue still valid? I'm eager to help with this, I'm new to this project so please let me know how I can get started. Thanks!

@wemeetagain
Copy link
Member

@DarhkVoyd feel free to take on this issue.
You should be able to resolve this in an automated way via a new linter rule introduced in aegir v41.0.0
(After you update the aegir dependency across the monorepo, you should be able to run npm run lint -- -- --fix from the project root to apply linter fixes everywhere)

@DarhkVoyd
Copy link

@wemeetagain Hey, after updating aegir to 41.0.0 and running npm run lint -- -- --fix, the terminal keeps on throwing linting error one after fixing another all over the codebase such as @typescript-eslint/strict-boolean-expressions and @typescript-eslint/await-thenable. So, should I keep on resolving all these errors along the way until the lint runs smoothly or am I doing something wrong?

@wemeetagain
Copy link
Member

Yup, keep resolving all the errors you run into. You may have to resolve the linter errors manually.

@maschad
Copy link
Member Author

maschad commented Oct 2, 2023

@DarhkVoyd the latest master should help make things a bit easier in your code editor since the tsconfig is now adapted for the monorepo

@maschad maschad removed the need/triage Needs initial labeling and prioritization label Oct 2, 2023
@DarhkVoyd
Copy link

DarhkVoyd commented Oct 4, 2023

@wemeetagain @maschad Kindly help me, I am stuck here, I get error that isStarted is not a method on pubsub. Also, is there an IRC where I can connect?

@DarhkVoyd
Copy link

@wemeetagain @maschad I might need some help as I am unable to understand if I am doing it right and working in the right direction. Kindly review my changes in the PR.

@achingbrain achingbrain removed exp/beginner Can be confidently tackled by newcomers good first issue Good issue for new contributors help wanted Seeking public contribution on this issue labels Oct 6, 2023
@achingbrain
Copy link
Member

Fixed by #2132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/docs Documentation
Projects
Archived in project
4 participants