diff options
| author | Leyla Jähnig <[email protected]> | 2022-06-18 11:16:48 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-18 11:16:48 +0200 |
| commit | 6d3f42e606f905657fd597b022a49baddce7d9f4 (patch) | |
| tree | 00515408cec154a35e2a0c191bf57521a7f8d00d /src/internal/deprecated.ts | |
| parent | c1cc1319373ab480b861c9cb372fa9e2ccf2982b (diff) | |
| download | faker-6d3f42e606f905657fd597b022a49baddce7d9f4.tar.xz faker-6d3f42e606f905657fd597b022a49baddce7d9f4.zip | |
docs: deprecation workflow (#1067)
Co-authored-by: Eric Cheng <[email protected]>
Diffstat (limited to 'src/internal/deprecated.ts')
| -rw-r--r-- | src/internal/deprecated.ts | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/internal/deprecated.ts b/src/internal/deprecated.ts index ab67b60a..f0668bc5 100644 --- a/src/internal/deprecated.ts +++ b/src/internal/deprecated.ts @@ -1,28 +1,47 @@ /* eslint-disable jsdoc/check-tag-names */ /* eslint-disable jsdoc/require-param */ +/** + * A deprecation should never be done in a patch. + */ +type DeprecationSemVer = `${number}.${number}`; + /** @internal */ export interface DeprecatedOptions { + /** + * The name of the function, following the syntax `faker.[module].[function]()`. + */ deprecated: string; + /** + * An alternative solution. + */ proposed?: string; - since?: string; - until?: string; + /** + * The semver since when this is deprecated. + */ + since?: DeprecationSemVer; + /** + * The semver when this will be removed. + */ + until?: DeprecationSemVer; } -/** @internal */ +/** + * @internal + */ export function deprecated(opts: DeprecatedOptions): void { let message = `[@faker-js/faker]: ${opts.deprecated} is deprecated`; if (opts.since) { - message += ` since ${opts.since}`; + message += ` since v${opts.since}`; } if (opts.until) { - message += ` and will be removed in ${opts.until}`; + message += ` and will be removed in v${opts.until}`; } if (opts.proposed) { - message += `. Please use ${opts.proposed} instead`; + message += `. Please use ${opts.proposed} instead.`; } console.warn(`${message}.`); |
