aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorShinigami <[email protected]>2024-02-18 23:56:40 +0100
committerGitHub <[email protected]>2024-02-18 23:56:40 +0100
commit52b8992cbf960e001336d59b83c610845ff35860 (patch)
treec71db76f3f955a74be4cbcbaa56df77375cb4531 /scripts
parentec5609b18c79ea9fc8183ae78e917801e6a8a3f4 (diff)
downloadfaker-52b8992cbf960e001336d59b83c610845ff35860.tar.xz
faker-52b8992cbf960e001336d59b83c610845ff35860.zip
infra(unicorn): prefer-string-replace-all (#2653)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc/markdown.ts14
-rw-r--r--scripts/apidoc/utils.ts4
-rw-r--r--scripts/apidoc/writer.ts2
-rw-r--r--scripts/generate-locales.ts2
4 files changed, 11 insertions, 11 deletions
diff --git a/scripts/apidoc/markdown.ts b/scripts/apidoc/markdown.ts
index 870b4201..0b1e3b40 100644
--- a/scripts/apidoc/markdown.ts
+++ b/scripts/apidoc/markdown.ts
@@ -39,15 +39,15 @@ const htmlSanitizeOptions: sanitizeHtml.IOptions = {
function comparableSanitizedHtml(html: string): string {
return html
- .replace(/&#x[0-9A-F]{2};/g, (x) =>
+ .replaceAll(/&#x[0-9A-F]{2};/g, (x) =>
String.fromCodePoint(Number.parseInt(x.slice(3, -1), 16))
)
- .replace(/&gt;/g, '>')
- .replace(/&lt;/g, '<')
- .replace(/&amp;/g, '&')
- .replace(/&quot;/g, '"')
- .replace(/=""/g, '')
- .replace(/ /g, '');
+ .replaceAll('&gt;', '>')
+ .replaceAll('&lt;', '<')
+ .replaceAll('&amp;', '&')
+ .replaceAll('&quot;', '"')
+ .replaceAll('=""', '')
+ .replaceAll(' ', '');
}
/**
diff --git a/scripts/apidoc/utils.ts b/scripts/apidoc/utils.ts
index f26c6cdd..b23f3568 100644
--- a/scripts/apidoc/utils.ts
+++ b/scripts/apidoc/utils.ts
@@ -45,7 +45,7 @@ export const pathOutputDir = resolve(pathDocsDir, 'api');
// Functions
export function adjustUrls(description: string): string {
- return description.replace(/https:\/\/(next.)?fakerjs.dev\//g, '/');
+ return description.replaceAll(/https:\/\/(next.)?fakerjs.dev\//g, '/');
}
export function mapByName<TInput extends { name: string }, TValue>(
@@ -65,7 +65,7 @@ export function mapByName<TInput extends { name: string }, TValue>(
export function methodDiffHash(method: Method): string {
return diffHash({
...method,
- sourcePath: method.sourcePath.replace(/#.*/g, ''),
+ sourcePath: method.sourcePath.replaceAll(/#.*/g, ''),
});
}
diff --git a/scripts/apidoc/writer.ts b/scripts/apidoc/writer.ts
index 67bf1d7a..b03cfe85 100644
--- a/scripts/apidoc/writer.ts
+++ b/scripts/apidoc/writer.ts
@@ -139,7 +139,7 @@ async function writeApiDocsModulePage(
`
)
.join('')}
- `.replace(/\n +/g, '\n');
+ `.replaceAll(/\n +/g, '\n');
content = vitePressInFileOptions + (await formatMarkdown(content));
diff --git a/scripts/generate-locales.ts b/scripts/generate-locales.ts
index c1aea203..bebfea5f 100644
--- a/scripts/generate-locales.ts
+++ b/scripts/generate-locales.ts
@@ -460,7 +460,7 @@ async function main(): Promise<void> {
localizationLocales = await formatMarkdown(localizationLocales);
let localizationContent = readFileSync(pathDocsGuideLocalization, 'utf8');
- localizationContent = localizationContent.replace(
+ localizationContent = localizationContent.replaceAll(
/(^<!-- LOCALES-AUTO-GENERATED-START -->$).*(^<!-- LOCALES-AUTO-GENERATED-END -->$)/gms,
`$1\n\n<!-- Run '${scriptCommand}' to update. -->\n\n${localizationLocales}\n$2`
);