You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+57Lines changed: 57 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,63 @@ For more info checkout [jsdoc.app](https://jsdoc.app/about-getting-started.html)
78
78
79
79
JSDoc will be read and automatically processed by `generate:api-docs` and therefore need to follow some project conventions. Other standards are in place because we think they increase the code quality.
80
80
81
+
> We have a small set of JSDoc tags that all methods should have.
82
+
83
+
- Description
84
+
-`@param` - If the method has parameters
85
+
-`@see` - If there are other important methods
86
+
-`@example` - Example calls without and with parameters, including a sample result of each call
87
+
-`@since` - The version this method was added (or is likely to be added)
88
+
-`@deprecated` - If the method is deprecated, with additional information about replacements
89
+
90
+
<table>
91
+
<tr>
92
+
<th>Do</th>
93
+
<th>Dont</th>
94
+
</tr>
95
+
<tr>
96
+
<td>
97
+
98
+
```ts
99
+
/**
100
+
* This is a good JSDoc description for a method that generates foos.
101
+
*
102
+
* @paramoptions The optional options to use.
103
+
* @paramoptions.test The parameter to configure test. Defaults to `'bar'`.
104
+
*
105
+
* @seefaker.helper.fake
106
+
*
107
+
* @example
108
+
* faker.bar.foo() // 'foo'
109
+
* faker.bar.foo({ test: 'oof' }) // 'of'
110
+
*
111
+
* @since 7.5.0
112
+
*
113
+
* @deprecated Use faker.cat.random() instead.
114
+
*/
115
+
function foo(options: { test:string } = {}):string {
116
+
// implementation
117
+
}
118
+
```
119
+
120
+
</td>
121
+
<td>
122
+
123
+
```ts
124
+
/**
125
+
* This is a bad JSDoc description.
126
+
*
127
+
* @return foo
128
+
*/
129
+
function foo(options: { test:string }) {
130
+
// implementation
131
+
}
132
+
```
133
+
134
+
</td>
135
+
</tr>
136
+
</table>
137
+
81
138
> We use eslint-plugin-jsdoc to test for basic styling and sorting of doc-tags.
82
139
83
140
This is in place so all JSDoc tags will get sorted automatically, so you don't have to bother with it. This also means that most rules in this section can get auto fixed by the eslint formatter.
0 commit comments