Do | +Dont | +
---|---|
+ +```ts +/** + * This is a good JSDoc description for a method that generates foos. + * + * @param options The optional options to use. + * @param options.test The parameter to configure test. Defaults to `'bar'`. + * + * @see helper.fake + * + * @example + * foo() // 'foo' + * foo({ test: 'oof' }) // 'of' + * + * @since 7.5.0 + * + * @deprecated Use `random()` instead. + */ +function foo(options: { test: string } = {}): string { + // implementation +} +``` + + | ++ +```ts +/** + * This is a bad JSDoc description. + * + * @return foo + */ +function foo(options: { test: string }) { + // implementation +} +``` + + | +
Do | +Dont | +
---|---|
+ +```ts +/** + * This is a good JSDoc description. + */ +function foo() { + // implementation +} +``` + + | ++ +```ts +/** This is a bad JSDoc description. */ +function foo() { + // implementation +} +``` + + | +
Do | +Dont | +
---|---|
+ +```ts +/** + * This is a good JSDoc block, because it follows the our preferences. + * + * @param bar The first argument. + * @param baz The second argument. + * + * @example foo(1, 1) // [1, 1] + * @example foo(13, 56) // [13, 56] + */ +function foo(bar: number, baz: number): [number, number] { + // implementation +} +``` + + | ++ +```ts +/** + * This is a bad JSDoc block, because it has no linebreaks between sections. + * @param bar The first argument. + * @param baz The second argument. + * @example foo(1, 1) // [1, 1] + * @example foo(13, 56) // [13, 56] + */ +function foo(bar: number, baz: number): [number, number] { + // implementation +} +``` + + | +