dotansimha / dotansimha/graphql-code-generator

Use fenced code blocks in TSDoc `@example` tags

Open
#8,572 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Is your feature request related to a problem? Please describe.**

Our generated code currently contains TSDoc `@example` tags with unfenced source code, for example:

````ts
/**
* __useCartQuery__
*
* @example
* const { data, loading, error } = useCartQuery({
* variables: {
* sellerId: // value for 'sellerId'
* },
* });
*/
````

**Describe the solution you'd like**

These should be fenced code blocks per the docs (https://tsdoc.org/pages/tags/example/), like this:

````ts
/**
* __useCartQuery__
*
* @example
* ```ts
* const { data, loading, error } = useCartQuery({
* variables: {
* sellerId: // value for 'sellerId'
* },
* });
* ```
*/
````

**Describe alternatives you've considered**

Leaving it the way it is, but this confuses `prettier-plugin-jsdoc`, which we use to format our files. Because of this, our examples are broken.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.