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
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,28 @@ You can view a generated code coverage report at `coverage/index.html`.
49
49
50
50
After adding new or updating existing locale data, you need to run `pnpm run generate:locales` to generate/update the related files.
51
51
52
+
## Deprecation workflow
53
+
54
+
If you ever find yourself deprecating something in the source code, you can follow these steps to save yourself (and the reviewers) some trouble.
55
+
56
+
If the code you want to deprecate is a property, convert it to a [getter](https://www.typescriptlang.org/docs/handbook/2/classes.html#getters--setters) first. Now that you have a function, the first thing you want to do is call the internal [`deprecated` function](src/internal/deprecated.ts). Afterwards, add a `@deprecated` parameter to the end of the JSDoc with a human readable description message with a suitable replacement for the deprecated function. Lastly, add a `@see` parameter to the JSDoc with a link to the replacement in the faker library (if it exists). The syntax for the link is `faker.[module].[function]`.
57
+
58
+
Example:
59
+
60
+
```ts
61
+
/**
62
+
* @seefaker.cat.random
63
+
*
64
+
* @deprecated Use faker.cat.random() instead.
65
+
*/
66
+
getcat() {
67
+
deprecated({
68
+
deprecated: 'faker.animal.cat',
69
+
});
70
+
return'cat';
71
+
}
72
+
```
73
+
52
74
## Developing the docs
53
75
54
76
Before running the docs, build the Faker dist, it's used inside of certain routes.
0 commit comments