diff --git a/.eslintrc.js b/.eslintrc.js index 26c86424233..1eb35bb529f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,6 +30,7 @@ module.exports = defineConfig({ 'no-useless-escape': 'off', 'deprecation/deprecation': 'error', eqeqeq: ['error', 'always', { null: 'ignore' }], + 'no-else-return': 'error', 'prefer-template': 'error', '@typescript-eslint/array-type': [ 'error', diff --git a/cypress/e2e/api.cy.ts b/cypress/e2e/api.cy.ts index e67ac2135be..be61f5dfc5b 100644 --- a/cypress/e2e/api.cy.ts +++ b/cypress/e2e/api.cy.ts @@ -43,7 +43,7 @@ describe('API Test', () => { cy.request({ method: 'HEAD', - url: `/api/${link}`, + url: link, failOnStatusCode: false, }) .should(({ status }) => { diff --git a/docs/.vitepress/api-pages.ts b/docs/.vitepress/api-pages.ts index dc62235786b..f0858635356 100644 --- a/docs/.vitepress/api-pages.ts +++ b/docs/.vitepress/api-pages.ts @@ -2,6 +2,7 @@ // Run 'pnpm run generate:api-docs' to update export const apiPages = [ { text: 'Overview', link: '/api/' }, + { text: 'Faker', link: '/api/faker.html' }, { text: 'Airline', link: '/api/airline.html' }, { text: 'Animal', link: '/api/animal.html' }, { text: 'Color', link: '/api/color.html' }, @@ -28,4 +29,5 @@ export const apiPages = [ { text: 'System', link: '/api/system.html' }, { text: 'Vehicle', link: '/api/vehicle.html' }, { text: 'Word', link: '/api/word.html' }, + { text: 'Utilities', link: '/api/utils.html' }, ]; diff --git a/docs/.vitepress/components/api-docs/method.ts b/docs/.vitepress/components/api-docs/method.ts index 562d1ecf8d9..6601a5ca047 100644 --- a/docs/.vitepress/components/api-docs/method.ts +++ b/docs/.vitepress/components/api-docs/method.ts @@ -1,6 +1,5 @@ export interface Method { readonly name: string; - readonly title: string; readonly description: string; // HTML readonly parameters: MethodParameter[]; readonly returns: string; diff --git a/docs/.vitepress/components/api-docs/method.vue b/docs/.vitepress/components/api-docs/method.vue index 6753cefd733..38d105868ce 100644 --- a/docs/.vitepress/components/api-docs/method.vue +++ b/docs/.vitepress/components/api-docs/method.vue @@ -8,6 +8,9 @@ const props = defineProps<{ method: Method }>(); function seeAlsoToUrl(see: string): string { const [, module, method] = see.replace(/\(.*/, '').split('\.'); + if (!method) { + return 'faker.html#' + slugify(module); + } return module + '.html#' + slugify(method); } diff --git a/docs/about/announcements/2022-01-14.md b/docs/about/announcements/2022-01-14.md index 5aef9d17449..7630b6a1706 100644 --- a/docs/about/announcements/2022-01-14.md +++ b/docs/about/announcements/2022-01-14.md @@ -107,7 +107,7 @@ We were closing issues every other hour. Discussing the `FUNDING.yml` was inevit When we became aware that this project was the most stable fork of Faker with the most community support, we realized that we needed to deal with the `FUNDING.yml` file and take a stance. -:::tip Short version, please +::: tip Short version, please Jess posted a [concise and thorough writeup](https://github.com/faker-js/faker/discussions/56#discussioncomment-1958057) of the logic behind our actions and decisions. This was backed by the support of all of the co-maintainers. It's a much less narrative version of this section, so if you want the TLDR and some photos of the transactions, give it a read. @@ -123,7 +123,7 @@ Ben said that simply, "The funding is attached to the project, not the current m Unanimously, we agreed that we **wanted absolutely no ability to touch the existing funding** and created a cut-over plan with the support of Open Collective. -:::tip Legacy collective +::: tip Legacy collective There is now a [fakerjs-legacy](https://opencollective.com/fakerjs-legacy) collective. Open Collective transferred all funds into the legacy account and invited Marak and the other maintainer, Brian, into the _legacy_ collective so that they could do whatever they wanted with the funds. ::: diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue index 55efaeca6c6..6500ae697e7 100644 --- a/docs/api/ApiIndex.vue +++ b/docs/api/ApiIndex.vue @@ -97,13 +97,11 @@ onUnmounted(() => window.removeEventListener('keydown', apiSearchFocusHandler));

- {{ item.text }} + {{ item.text }}

diff --git a/docs/guide/localization.md b/docs/guide/localization.md index e0f85de44ab..dcfd7ce35c7 100644 --- a/docs/guide/localization.md +++ b/docs/guide/localization.md @@ -10,7 +10,7 @@ However, we also provide pre-built instances for more than 50 other locales. See below for a list of available locales. -:::tip Note +::: tip Note You can also build your own Faker instances, with custom locales/overwrites. ::: @@ -33,7 +33,7 @@ The English locales are around 600 KB in size. All locales together are around 5 MB in size. ::: -:::tip Note +::: tip Note Some locales have limited coverage and rely more heavily on the English locale as the source for features they currently do not have. However, in most cases, using a specific locale will be beneficial in the long term as specifying a locale reduces the time necessary for startup, which has a compounding effect on testing frameworks that reload the imports every execution. ::: @@ -105,7 +105,6 @@ In this example there are 5 locales. Each of these is checked in order, and the | `fr_CA` | French (Canada) | `fakerFR_CA` | | `fr_CH` | French (Switzerland) | `fakerFR_CH` | | `fr_LU` | French (Luxembourg) | `fakerFR_LU` | -| `ge` | Georgian | `fakerGE` | | `he` | Hebrew | `fakerHE` | | `hr` | Croatian | `fakerHR` | | `hu` | Hungarian | `fakerHU` | @@ -113,6 +112,7 @@ In this example there are 5 locales. Each of these is checked in order, and the | `id_ID` | Indonesian | `fakerID_ID` | | `it` | Italian | `fakerIT` | | `ja` | Japanese | `fakerJA` | +| `ka_GE` | Georgian (Georgia) | `fakerKA_GE` | | `ko` | Korean | `fakerKO` | | `lv` | Latvian | `fakerLV` | | `mk` | Macedonian | `fakerMK` | diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index b135f96ffa6..fa56c6276b8 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -4,8 +4,7 @@ This is the migration guide for upgrading from v7 to v8. Since v8 has not yet been released, this is a work in progress list of any major and breaking changes in v8. -::: info -Not the version you are looking for? +::: info Not the version you are looking for? - [Upgrading to v7](https://v7.fakerjs.dev/guide/upgrading.html) - [Upgrading to v6](https://v6.fakerjs.dev/migration-guide-v5/) @@ -16,7 +15,7 @@ Not the version you are looking for? ### Removed ability to change the locale on existing `Faker` instances -:::tip NOTE +::: tip Note If you are using only the default (`en`) locale, then you don't have to change anything. ::: @@ -222,3 +221,5 @@ The functions `faker.system.mimeType`, `faker.system.fileType` and `faker.system The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales. The `cz` (Czech) locale was renamed to `cs_CZ` to use the standard ISO codes for language and country. + +The `ge` (Georgian) locale was renamed to `ka_GE` to use the standard ISO codes for language and country. diff --git a/docs/guide/usage.md b/docs/guide/usage.md index 26f81c08d22..f97590af7ee 100644 --- a/docs/guide/usage.md +++ b/docs/guide/usage.md @@ -37,7 +37,7 @@ For more information about changing and customizing the locales, please refer to ``` -::: info NOTE +::: info Note Using the browser is great for experimenting 👍. However, due to all of the strings Faker uses to generate fake data, **Faker is a large package**. It's `> 5 MiB` minified. **Please avoid deploying the full Faker in your web app.** ::: @@ -50,7 +50,7 @@ const randomName = faker.person.fullName(); // Willie Bahringer const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com ``` -::: info NOTE +::: info Note It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v7.4.0"`. Add `?dts` to import with type definitions: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v7.4.0?dts"`. ::: @@ -104,7 +104,7 @@ const secondRandom = faker.number.int(); console.log(firstRandom === secondRandom); ``` -::: info NOTE +::: info Note When upgrading to a new version of Faker, you may get different values for the same seed, as the underlying data (lists of names, words etc) may have changed. ::: diff --git a/package.json b/package.json index c807696d408..501ee8591f9 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "build:code": "tsx ./scripts/bundle.ts", "build:types": "tsc --emitDeclarationOnly --outDir dist/types", "build": "run-s build:clean build:code build:types", + "generate": "run-s generate:locales generate:api-docs", "generate:api-docs": "tsx ./scripts/apidoc.ts", "generate:locales": "tsx ./scripts/generateLocales.ts", "docs:build": "run-s docs:prepare docs:build:run", @@ -69,6 +70,7 @@ "docs:diff": "tsx ./scripts/diff.ts", "format": "prettier --cache --write .", "lint": "eslint --cache --cache-strategy content .", + "ts-check": "run-s ts-check:scripts ts-check:tests", "ts-check:scripts": "tsc --project tsconfig.check-scripts.json", "ts-check:tests": "tsc --project tsconfig.check-tests.json", "test": "vitest", @@ -80,23 +82,23 @@ "docs:test:e2e:open": "run-p --race docs:serve \"cypress open\"", "release": "standard-version", "prepublishOnly": "pnpm run clean && pnpm install && pnpm run build", - "preflight": "pnpm install && run-s generate:* format lint build test:update-snapshots" + "preflight": "pnpm install && run-s generate format lint build test:update-snapshots ts-check" }, "devDependencies": { "@actions/github": "~5.1.1", - "@algolia/client-search": "~4.16.0", + "@algolia/client-search": "~4.17.0", "@types/glob": "~8.1.0", "@types/markdown-it": "~12.2.3", "@types/node": "~18.15.11", "@types/prettier": "~2.7.2", - "@types/react": "~18.0.29", + "@types/react": "~18.0.32", "@types/sanitize-html": "~2.9.0", "@types/semver": "~7.3.13", "@types/validator": "~13.7.14", - "@typescript-eslint/eslint-plugin": "~5.56.0", - "@typescript-eslint/parser": "~5.56.0", - "@vitest/coverage-c8": "~0.29.7", - "@vitest/ui": "~0.29.7", + "@typescript-eslint/eslint-plugin": "~5.57.1", + "@typescript-eslint/parser": "~5.57.1", + "@vitest/coverage-c8": "~0.29.8", + "@vitest/ui": "~0.29.8", "@vueuse/core": "~9.13.0", "c8": "~7.13.0", "conventional-changelog-cli": "~2.2.2", @@ -126,11 +128,11 @@ "typescript": "~4.9.5", "validator": "~13.9.0", "vite": "~4.2.1", - "vitepress": "1.0.0-alpha.63", - "vitest": "~0.29.7", + "vitepress": "1.0.0-alpha.64", + "vitest": "~0.29.8", "vue": "~3.2.47" }, - "packageManager": "pnpm@7.30.3", + "packageManager": "pnpm@7.30.5", "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0", "npm": ">=6.14.13" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cea3cfb29f..24658291e06 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,19 +2,19 @@ lockfileVersion: 5.4 specifiers: '@actions/github': ~5.1.1 - '@algolia/client-search': ~4.16.0 + '@algolia/client-search': ~4.17.0 '@types/glob': ~8.1.0 '@types/markdown-it': ~12.2.3 '@types/node': ~18.15.11 '@types/prettier': ~2.7.2 - '@types/react': ~18.0.29 + '@types/react': ~18.0.32 '@types/sanitize-html': ~2.9.0 '@types/semver': ~7.3.13 '@types/validator': ~13.7.14 - '@typescript-eslint/eslint-plugin': ~5.56.0 - '@typescript-eslint/parser': ~5.56.0 - '@vitest/coverage-c8': ~0.29.7 - '@vitest/ui': ~0.29.7 + '@typescript-eslint/eslint-plugin': ~5.57.1 + '@typescript-eslint/parser': ~5.57.1 + '@vitest/coverage-c8': ~0.29.8 + '@vitest/ui': ~0.29.8 '@vueuse/core': ~9.13.0 c8: ~7.13.0 conventional-changelog-cli: ~2.2.2 @@ -44,25 +44,25 @@ specifiers: typescript: ~4.9.5 validator: ~13.9.0 vite: ~4.2.1 - vitepress: 1.0.0-alpha.63 - vitest: ~0.29.7 + vitepress: 1.0.0-alpha.64 + vitest: ~0.29.8 vue: ~3.2.47 devDependencies: '@actions/github': 5.1.1 - '@algolia/client-search': 4.16.0 + '@algolia/client-search': 4.17.0 '@types/glob': 8.1.0 '@types/markdown-it': 12.2.3 '@types/node': 18.15.11 '@types/prettier': 2.7.2 - '@types/react': 18.0.29 + '@types/react': 18.0.32 '@types/sanitize-html': 2.9.0 '@types/semver': 7.3.13 '@types/validator': 13.7.14 - '@typescript-eslint/eslint-plugin': 5.56.0_iac3ayshvqztisj7lblru7rgga - '@typescript-eslint/parser': 5.56.0_ip5up2nocltd47wbnuyybe5dxu - '@vitest/coverage-c8': 0.29.7_vitest@0.29.7 - '@vitest/ui': 0.29.7 + '@typescript-eslint/eslint-plugin': 5.57.1_iify4w3mi7rbbu6mxzspkpx4b4 + '@typescript-eslint/parser': 5.57.1_ip5up2nocltd47wbnuyybe5dxu + '@vitest/coverage-c8': 0.29.8_vitest@0.29.8 + '@vitest/ui': 0.29.8 '@vueuse/core': 9.13.0_vue@3.2.47 c8: 7.13.0 conventional-changelog-cli: 2.2.2 @@ -92,8 +92,8 @@ devDependencies: typescript: 4.9.5 validator: 13.9.0 vite: 4.2.1_@types+node@18.15.11 - vitepress: 1.0.0-alpha.63_stvxdp6dyzehytap6e2uvcgn6u - vitest: 0.29.7_@vitest+ui@0.29.7 + vitepress: 1.0.0-alpha.64_jfj4znh7mywluhumgz7o7fnx4i + vitest: 0.29.8_@vitest+ui@0.29.8 vue: 3.2.47 packages: @@ -121,14 +121,14 @@ packages: '@algolia/autocomplete-shared': 1.7.4 dev: true - /@algolia/autocomplete-preset-algolia/1.7.4_4cwlnazjj7u2acpwn27jf7qna4: + /@algolia/autocomplete-preset-algolia/1.7.4_jhejk2vonodiab5u7nrgzv6ywi: resolution: {integrity: sha512-s37hrvLEIfcmKY8VU9LsAXgm2yfmkdHT3DnA3SgHaY93yjZ2qL57wzb5QweVkYuEBZkT2PIREvRoLXC2sxTbpQ==} peerDependencies: '@algolia/client-search': '>= 4.9.1 < 6' algoliasearch: '>= 4.9.1 < 6' dependencies: '@algolia/autocomplete-shared': 1.7.4 - '@algolia/client-search': 4.16.0 + '@algolia/client-search': 4.17.0 algoliasearch: 4.16.0 dev: true @@ -146,6 +146,10 @@ packages: resolution: {integrity: sha512-4iHjkSYQYw46pITrNQgXXhvUmcekI8INz1m+SzmqLX8jexSSy4Ky4zfGhZzhhhLHXUP3+x/PK/c0qPjxEvRwKQ==} dev: true + /@algolia/cache-common/4.17.0: + resolution: {integrity: sha512-g8mXzkrcUBIPZaulAuqE7xyHhLAYAcF2xSch7d9dABheybaU3U91LjBX6eJTEB7XVhEsgK4Smi27vWtAJRhIKQ==} + dev: true + /@algolia/cache-in-memory/4.16.0: resolution: {integrity: sha512-p7RYykvA6Ip6QENxrh99nOD77otVh1sJRivcgcVpnjoZb5sIN3t33eUY1DpB9QSBizcrW+qk19rNkdnZ43a+PQ==} dependencies: @@ -176,6 +180,13 @@ packages: '@algolia/transporter': 4.16.0 dev: true + /@algolia/client-common/4.17.0: + resolution: {integrity: sha512-jHMks0ZFicf8nRDn6ma8DNNsdwGgP/NKiAAL9z6rS7CymJ7L0+QqTJl3rYxRW7TmBhsUH40wqzmrG6aMIN/DrQ==} + dependencies: + '@algolia/requester-common': 4.17.0 + '@algolia/transporter': 4.17.0 + dev: true + /@algolia/client-personalization/4.16.0: resolution: {integrity: sha512-irtLafssDGPuhYqIwxqOxiWlVYvrsBD+EMA1P9VJtkKi3vSNBxiWeQ0f0Tn53cUNdSRNEssfoEH84JL97SV2SQ==} dependencies: @@ -192,10 +203,22 @@ packages: '@algolia/transporter': 4.16.0 dev: true + /@algolia/client-search/4.17.0: + resolution: {integrity: sha512-x4P2wKrrRIXszT8gb7eWsMHNNHAJs0wE7/uqbufm4tZenAp+hwU/hq5KVsY50v+PfwM0LcDwwn/1DroujsTFoA==} + dependencies: + '@algolia/client-common': 4.17.0 + '@algolia/requester-common': 4.17.0 + '@algolia/transporter': 4.17.0 + dev: true + /@algolia/logger-common/4.16.0: resolution: {integrity: sha512-U9H8uCzSDuePJmbnjjTX21aPDRU6x74Tdq3dJmdYu2+pISx02UeBJm4kSgc9RW5jcR5j35G9gnjHY9Q3ngWbyQ==} dev: true + /@algolia/logger-common/4.17.0: + resolution: {integrity: sha512-DGuoZqpTmIKJFDeyAJ7M8E/LOenIjWiOsg1XJ1OqAU/eofp49JfqXxbfgctlVZVmDABIyOz8LqEoJ6ZP4DTyvw==} + dev: true + /@algolia/logger-console/4.16.0: resolution: {integrity: sha512-+qymusiM+lPZKrkf0tDjCQA158eEJO2IU+Nr/sJ9TFyI/xkFPjNPzw/Qbc8Iy/xcOXGlc6eMgmyjtVQqAWq6UA==} dependencies: @@ -212,6 +235,10 @@ packages: resolution: {integrity: sha512-3Zmcs/iMubcm4zqZ3vZG6Zum8t+hMWxGMzo0/uY2BD8o9q5vMxIYI0c4ocdgQjkXcix189WtZNkgjSOBzSbkdw==} dev: true + /@algolia/requester-common/4.17.0: + resolution: {integrity: sha512-XJjmWFEUlHu0ijvcHBoixuXfEoiRUdyzQM6YwTuB8usJNIgShua8ouFlRWF8iCeag0vZZiUm4S2WCVBPkdxFgg==} + dev: true + /@algolia/requester-node-http/4.16.0: resolution: {integrity: sha512-L8JxM2VwZzh8LJ1Zb8TFS6G3icYsCKZsdWW+ahcEs1rGWmyk9SybsOe1MLnjonGBaqPWJkn9NjS7mRdjEmBtKA==} dependencies: @@ -226,6 +253,14 @@ packages: '@algolia/requester-common': 4.16.0 dev: true + /@algolia/transporter/4.17.0: + resolution: {integrity: sha512-6xL6H6fe+Fi0AEP3ziSgC+G04RK37iRb4uUUqVAH9WPYFI8g+LYFq6iv5HS8Cbuc5TTut+Bwj6G+dh/asdb9uA==} + dependencies: + '@algolia/cache-common': 4.17.0 + '@algolia/logger-common': 4.17.0 + '@algolia/requester-common': 4.17.0 + dev: true + /@babel/code-frame/7.18.6: resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==} engines: {node: '>=6.9.0'} @@ -317,10 +352,10 @@ packages: resolution: {integrity: sha512-6SCwI7P8ao+se1TUsdZ7B4XzL+gqeQZnBc+2EONZlcVa0dVrk0NjETxozFKgMv0eEGH8QzP1fkN+A1rH61l4eg==} dev: true - /@docsearch/js/3.3.3_j477zghhmtwc4on6soxloht2m4: + /@docsearch/js/3.3.3_gs4mndlkjnmpktyt5wnbiwdrc4: resolution: {integrity: sha512-2xAv2GFuHzzmG0SSZgf8wHX0qZX8n9Y1ZirKUk5Wrdc+vH9CL837x2hZIUdwcPZI9caBA+/CzxsS68O4waYjUQ==} dependencies: - '@docsearch/react': 3.3.3_j477zghhmtwc4on6soxloht2m4 + '@docsearch/react': 3.3.3_gs4mndlkjnmpktyt5wnbiwdrc4 preact: 10.13.1 transitivePeerDependencies: - '@algolia/client-search' @@ -329,7 +364,7 @@ packages: - react-dom dev: true - /@docsearch/react/3.3.3_j477zghhmtwc4on6soxloht2m4: + /@docsearch/react/3.3.3_gs4mndlkjnmpktyt5wnbiwdrc4: resolution: {integrity: sha512-pLa0cxnl+G0FuIDuYlW+EBK6Rw2jwLw9B1RHIeS4N4s2VhsfJ/wzeCi3CWcs5yVfxLd5ZK50t//TMA5e79YT7Q==} peerDependencies: '@types/react': '>= 16.8.0 < 19.0.0' @@ -344,9 +379,9 @@ packages: optional: true dependencies: '@algolia/autocomplete-core': 1.7.4 - '@algolia/autocomplete-preset-algolia': 1.7.4_4cwlnazjj7u2acpwn27jf7qna4 + '@algolia/autocomplete-preset-algolia': 1.7.4_jhejk2vonodiab5u7nrgzv6ywi '@docsearch/css': 3.3.3 - '@types/react': 18.0.29 + '@types/react': 18.0.32 algoliasearch: 4.16.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -846,8 +881,8 @@ packages: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true - /@types/react/18.0.29: - resolution: {integrity: sha512-wXHktgUABxplw1+UnljseDq4+uztQyp2tlWZRIxHlpchsCFqiYkvaDS8JR7eKOQm8wziTH/el5qL7D6gYNkYcw==} + /@types/react/18.0.32: + resolution: {integrity: sha512-gYGXdtPQ9Cj0w2Fwqg5/ak6BcK3Z15YgjSqtyDizWUfx7mQ8drs0NBUzRRsAdoFVTO8kJ8L2TL8Skm7OFPnLUw==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.3 @@ -892,8 +927,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.56.0_iac3ayshvqztisj7lblru7rgga: - resolution: {integrity: sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg==} + /@typescript-eslint/eslint-plugin/5.57.1_iify4w3mi7rbbu6mxzspkpx4b4: + resolution: {integrity: sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -904,10 +939,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.4.1 - '@typescript-eslint/parser': 5.56.0_ip5up2nocltd47wbnuyybe5dxu - '@typescript-eslint/scope-manager': 5.56.0 - '@typescript-eslint/type-utils': 5.56.0_ip5up2nocltd47wbnuyybe5dxu - '@typescript-eslint/utils': 5.56.0_ip5up2nocltd47wbnuyybe5dxu + '@typescript-eslint/parser': 5.57.1_ip5up2nocltd47wbnuyybe5dxu + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/type-utils': 5.57.1_ip5up2nocltd47wbnuyybe5dxu + '@typescript-eslint/utils': 5.57.1_ip5up2nocltd47wbnuyybe5dxu debug: 4.3.4 eslint: 8.37.0 grapheme-splitter: 1.0.4 @@ -933,8 +968,8 @@ packages: - typescript dev: true - /@typescript-eslint/parser/5.56.0_ip5up2nocltd47wbnuyybe5dxu: - resolution: {integrity: sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==} + /@typescript-eslint/parser/5.57.1_ip5up2nocltd47wbnuyybe5dxu: + resolution: {integrity: sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -943,9 +978,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.56.0 - '@typescript-eslint/types': 5.56.0 - '@typescript-eslint/typescript-estree': 5.56.0_typescript@4.9.5 + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/typescript-estree': 5.57.1_typescript@4.9.5 debug: 4.3.4 eslint: 8.37.0 typescript: 4.9.5 @@ -953,14 +988,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager/5.56.0: - resolution: {integrity: sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - '@typescript-eslint/types': 5.56.0 - '@typescript-eslint/visitor-keys': 5.56.0 - dev: true - /@typescript-eslint/scope-manager/5.57.0: resolution: {integrity: sha512-NANBNOQvllPlizl9LatX8+MHi7bx7WGIWYjPHDmQe5Si/0YEYfxSljJpoTyTWFTgRy3X8gLYSE4xQ2U+aCozSw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -969,8 +996,16 @@ packages: '@typescript-eslint/visitor-keys': 5.57.0 dev: true - /@typescript-eslint/type-utils/5.56.0_ip5up2nocltd47wbnuyybe5dxu: - resolution: {integrity: sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A==} + /@typescript-eslint/scope-manager/5.57.1: + resolution: {integrity: sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/visitor-keys': 5.57.1 + dev: true + + /@typescript-eslint/type-utils/5.57.1_ip5up2nocltd47wbnuyybe5dxu: + resolution: {integrity: sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -979,8 +1014,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.56.0_typescript@4.9.5 - '@typescript-eslint/utils': 5.56.0_ip5up2nocltd47wbnuyybe5dxu + '@typescript-eslint/typescript-estree': 5.57.1_typescript@4.9.5 + '@typescript-eslint/utils': 5.57.1_ip5up2nocltd47wbnuyybe5dxu debug: 4.3.4 eslint: 8.37.0 tsutils: 3.21.0_typescript@4.9.5 @@ -989,18 +1024,18 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.56.0: - resolution: {integrity: sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==} + /@typescript-eslint/types/5.57.0: + resolution: {integrity: sha512-mxsod+aZRSyLT+jiqHw1KK6xrANm19/+VFALVFP5qa/aiJnlP38qpyaTd0fEKhWvQk6YeNZ5LGwI1pDpBRBhtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/types/5.57.0: - resolution: {integrity: sha512-mxsod+aZRSyLT+jiqHw1KK6xrANm19/+VFALVFP5qa/aiJnlP38qpyaTd0fEKhWvQk6YeNZ5LGwI1pDpBRBhtQ==} + /@typescript-eslint/types/5.57.1: + resolution: {integrity: sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.56.0_typescript@4.9.5: - resolution: {integrity: sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==} + /@typescript-eslint/typescript-estree/5.57.0_typescript@4.9.5: + resolution: {integrity: sha512-LTzQ23TV82KpO8HPnWuxM2V7ieXW8O142I7hQTxWIHDcCEIjtkat6H96PFkYBQqGFLW/G/eVVOB9Z8rcvdY/Vw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -1008,8 +1043,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.56.0 - '@typescript-eslint/visitor-keys': 5.56.0 + '@typescript-eslint/types': 5.57.0 + '@typescript-eslint/visitor-keys': 5.57.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1020,8 +1055,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree/5.57.0_typescript@4.9.5: - resolution: {integrity: sha512-LTzQ23TV82KpO8HPnWuxM2V7ieXW8O142I7hQTxWIHDcCEIjtkat6H96PFkYBQqGFLW/G/eVVOB9Z8rcvdY/Vw==} + /@typescript-eslint/typescript-estree/5.57.1_typescript@4.9.5: + resolution: {integrity: sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -1029,8 +1064,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.57.0 - '@typescript-eslint/visitor-keys': 5.57.0 + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/visitor-keys': 5.57.1 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1041,8 +1076,8 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.56.0_ip5up2nocltd47wbnuyybe5dxu: - resolution: {integrity: sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA==} + /@typescript-eslint/utils/5.57.0_ip5up2nocltd47wbnuyybe5dxu: + resolution: {integrity: sha512-ps/4WohXV7C+LTSgAL5CApxvxbMkl9B9AUZRtnEFonpIxZDIT7wC1xfvuJONMidrkB9scs4zhtRyIwHh4+18kw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -1050,9 +1085,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0_eslint@8.37.0 '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.56.0 - '@typescript-eslint/types': 5.56.0 - '@typescript-eslint/typescript-estree': 5.56.0_typescript@4.9.5 + '@typescript-eslint/scope-manager': 5.57.0 + '@typescript-eslint/types': 5.57.0 + '@typescript-eslint/typescript-estree': 5.57.0_typescript@4.9.5 eslint: 8.37.0 eslint-scope: 5.1.1 semver: 7.3.8 @@ -1061,8 +1096,8 @@ packages: - typescript dev: true - /@typescript-eslint/utils/5.57.0_ip5up2nocltd47wbnuyybe5dxu: - resolution: {integrity: sha512-ps/4WohXV7C+LTSgAL5CApxvxbMkl9B9AUZRtnEFonpIxZDIT7wC1xfvuJONMidrkB9scs4zhtRyIwHh4+18kw==} + /@typescript-eslint/utils/5.57.1_ip5up2nocltd47wbnuyybe5dxu: + resolution: {integrity: sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -1070,9 +1105,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0_eslint@8.37.0 '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.57.0 - '@typescript-eslint/types': 5.57.0 - '@typescript-eslint/typescript-estree': 5.57.0_typescript@4.9.5 + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/typescript-estree': 5.57.1_typescript@4.9.5 eslint: 8.37.0 eslint-scope: 5.1.1 semver: 7.3.8 @@ -1081,19 +1116,19 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.56.0: - resolution: {integrity: sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==} + /@typescript-eslint/visitor-keys/5.57.0: + resolution: {integrity: sha512-ery2g3k0hv5BLiKpPuwYt9KBkAp2ugT6VvyShXdLOkax895EC55sP0Tx5L0fZaQueiK3fBLvHVvEl3jFS5ia+g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.56.0 - eslint-visitor-keys: 3.3.0 + '@typescript-eslint/types': 5.57.0 + eslint-visitor-keys: 3.4.0 dev: true - /@typescript-eslint/visitor-keys/5.57.0: - resolution: {integrity: sha512-ery2g3k0hv5BLiKpPuwYt9KBkAp2ugT6VvyShXdLOkax895EC55sP0Tx5L0fZaQueiK3fBLvHVvEl3jFS5ia+g==} + /@typescript-eslint/visitor-keys/5.57.1: + resolution: {integrity: sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.57.0 + '@typescript-eslint/types': 5.57.1 eslint-visitor-keys: 3.4.0 dev: true @@ -1108,41 +1143,41 @@ packages: vue: 3.2.47 dev: true - /@vitest/coverage-c8/0.29.7_vitest@0.29.7: - resolution: {integrity: sha512-TSubtP9JFBuI/wuApxwknHe40VDkX8hFbBak0OXj4/jCeXrEu5B5GPWcxzyk9YvzXgCaDvoiZV79I7AvhNI9YQ==} + /@vitest/coverage-c8/0.29.8_vitest@0.29.8: + resolution: {integrity: sha512-y+sEMQMctWokjnSqm3FCQEYFkjLrYaznsxEZHxcx8z2aftpYg3A5tvI1S5himfdEFo7o+OeHzh40bPSWZHW4oQ==} peerDependencies: vitest: '>=0.29.0 <1' dependencies: c8: 7.13.0 picocolors: 1.0.0 std-env: 3.3.2 - vitest: 0.29.7_@vitest+ui@0.29.7 + vitest: 0.29.8_@vitest+ui@0.29.8 dev: true - /@vitest/expect/0.29.7: - resolution: {integrity: sha512-UtG0tW0DP6b3N8aw7PHmweKDsvPv4wjGvrVZW7OSxaFg76ShtVdMiMcUkZJgCE8QWUmhwaM0aQhbbVLo4F4pkA==} + /@vitest/expect/0.29.8: + resolution: {integrity: sha512-xlcVXn5I5oTq6NiZSY3ykyWixBxr5mG8HYtjvpgg6KaqHm0mvhX18xuwl5YGxIRNt/A5jidd7CWcNHrSvgaQqQ==} dependencies: - '@vitest/spy': 0.29.7 - '@vitest/utils': 0.29.7 + '@vitest/spy': 0.29.8 + '@vitest/utils': 0.29.8 chai: 4.3.7 dev: true - /@vitest/runner/0.29.7: - resolution: {integrity: sha512-Yt0+csM945+odOx4rjZSjibQfl2ymxqVsmYz6sO2fiO5RGPYDFCo60JF6tLL9pz4G/kjY4irUxadeB1XT+H1jg==} + /@vitest/runner/0.29.8: + resolution: {integrity: sha512-FzdhnRDwEr/A3Oo1jtIk/B952BBvP32n1ObMEb23oEJNO+qO5cBet6M2XWIDQmA7BDKGKvmhUf2naXyp/2JEwQ==} dependencies: - '@vitest/utils': 0.29.7 + '@vitest/utils': 0.29.8 p-limit: 4.0.0 pathe: 1.1.0 dev: true - /@vitest/spy/0.29.7: - resolution: {integrity: sha512-IalL0iO6A6Xz8hthR8sctk6ZS//zVBX48EiNwQguYACdgdei9ZhwMaBFV70mpmeYAFCRAm+DpoFHM5470Im78A==} + /@vitest/spy/0.29.8: + resolution: {integrity: sha512-VdjBe9w34vOMl5I5mYEzNX8inTxrZ+tYUVk9jxaZJmHFwmDFC/GV3KBFTA/JKswr3XHvZL+FE/yq5EVhb6pSAw==} dependencies: tinyspy: 1.1.1 dev: true - /@vitest/ui/0.29.7: - resolution: {integrity: sha512-KeOztcAldlFU5i8DKCQcmGrih1dVowurZy/9iPz5JyQdPJzej+nW1nI4nYvc4ZmUtA8+IAe9uViqnU7IXc1RNw==} + /@vitest/ui/0.29.8: + resolution: {integrity: sha512-+vbLd+c1R/XUWfzJsWeyjeiw13fwJ95I5tguxaqXRg61y9iYUKesVljg7Pttp2uo7VK+kAjvY91J41NZ1Vx3vg==} dependencies: fast-glob: 3.2.12 flatted: 3.2.7 @@ -1151,8 +1186,8 @@ packages: sirv: 2.0.2 dev: true - /@vitest/utils/0.29.7: - resolution: {integrity: sha512-vNgGadp2eE5XKCXtZXL5UyNEDn68npSct75OC9AlELenSK0DiV1Mb9tfkwJHKjRb69iek+e79iipoJx8+s3SdA==} + /@vitest/utils/0.29.8: + resolution: {integrity: sha512-qGzuf3vrTbnoY+RjjVVIBYfuWMjn3UMUqyQtdGNZ6ZIIyte7B37exj6LaVkrZiUTvzSadVvO/tJm8AEgbGCBPg==} dependencies: cli-truncate: 3.1.0 diff: 5.1.0 @@ -2442,11 +2477,6 @@ packages: estraverse: 5.3.0 dev: true - /eslint-visitor-keys/3.3.0: - resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /eslint-visitor-keys/3.4.0: resolution: {integrity: sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4994,8 +5024,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite-node/0.29.7_@types+node@18.15.11: - resolution: {integrity: sha512-PakCZLvz37yFfUPWBnLa1OYHPCGm5v4pmRrTcFN4V/N/T3I6tyP3z07S//9w+DdeL7vVd0VSeyMZuAh+449ZWw==} + /vite-node/0.29.8_@types+node@18.15.11: + resolution: {integrity: sha512-b6OtCXfk65L6SElVM20q5G546yu10/kNrhg08afEoWlFRJXFq9/6glsvSVY+aI6YeC1tu2TtAqI2jHEQmOmsFw==} engines: {node: '>=v14.16.0'} hasBin: true dependencies: @@ -5049,12 +5079,12 @@ packages: fsevents: 2.3.2 dev: true - /vitepress/1.0.0-alpha.63_stvxdp6dyzehytap6e2uvcgn6u: - resolution: {integrity: sha512-7QMwjT9888S64SkmJqSmRlP417yniCj4IqawIpzYSQMnlJ5CjBWOTbzXKvmzRZkjOJGTcaYr2C88+1/z8ERG+g==} + /vitepress/1.0.0-alpha.64_jfj4znh7mywluhumgz7o7fnx4i: + resolution: {integrity: sha512-u12wcDH4VzgxxkQfVQWkXumrL3WRetpenz4VuAtiMWXeZSCayWcJtieWOFxmX/RzS2KEuTJpXGbtJAXORyyJBQ==} hasBin: true dependencies: '@docsearch/css': 3.3.3 - '@docsearch/js': 3.3.3_j477zghhmtwc4on6soxloht2m4 + '@docsearch/js': 3.3.3_gs4mndlkjnmpktyt5wnbiwdrc4 '@vitejs/plugin-vue': 4.1.0_vite@4.2.1+vue@3.2.47 '@vue/devtools-api': 6.5.0 '@vueuse/core': 9.13.0_vue@3.2.47 @@ -5076,8 +5106,8 @@ packages: - terser dev: true - /vitest/0.29.7_@vitest+ui@0.29.7: - resolution: {integrity: sha512-aWinOSOu4jwTuZHkb+cCyrqQ116Q9TXaJrNKTHudKBknIpR0VplzeaOUuDF9jeZcrbtQKZQt6yrtd+eakbaxHg==} + /vitest/0.29.8_@vitest+ui@0.29.8: + resolution: {integrity: sha512-JIAVi2GK5cvA6awGpH0HvH/gEG9PZ0a/WoxdiV3PmqK+3CjQMf8c+J/Vhv4mdZ2nRyXFw66sAg6qz7VNkaHfDQ==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -5086,6 +5116,7 @@ packages: '@vitest/ui': '*' happy-dom: '*' jsdom: '*' + playwright: '*' safaridriver: '*' webdriverio: '*' peerDependenciesMeta: @@ -5099,6 +5130,8 @@ packages: optional: true jsdom: optional: true + playwright: + optional: true safaridriver: optional: true webdriverio: @@ -5107,11 +5140,11 @@ packages: '@types/chai': 4.3.4 '@types/chai-subset': 1.3.3 '@types/node': 18.15.11 - '@vitest/expect': 0.29.7 - '@vitest/runner': 0.29.7 - '@vitest/spy': 0.29.7 - '@vitest/ui': 0.29.7 - '@vitest/utils': 0.29.7 + '@vitest/expect': 0.29.8 + '@vitest/runner': 0.29.8 + '@vitest/spy': 0.29.8 + '@vitest/ui': 0.29.8 + '@vitest/utils': 0.29.8 acorn: 8.8.2 acorn-walk: 8.2.0 cac: 6.7.14 @@ -5127,7 +5160,7 @@ packages: tinypool: 0.4.0 tinyspy: 1.1.1 vite: 4.2.1_@types+node@18.15.11 - vite-node: 0.29.7_@types+node@18.15.11 + vite-node: 0.29.8_@types+node@18.15.11 why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/scripts/apidoc.ts b/scripts/apidoc.ts index 3c448f8b38a..ecb1f8fe02c 100644 --- a/scripts/apidoc.ts +++ b/scripts/apidoc.ts @@ -1,10 +1,8 @@ -import { faker } from '../src'; import { generate } from './apidoc/generate'; import { initMarkdownRenderer } from './apidoc/signature'; async function build(): Promise { await initMarkdownRenderer(); - faker.setDefaultRefDate(Date.UTC(2023, 0, 1)); await generate(); } diff --git a/scripts/apidoc/apiDocsWriter.ts b/scripts/apidoc/apiDocsWriter.ts index 6f00f64a313..ba1e43671f4 100644 --- a/scripts/apidoc/apiDocsWriter.ts +++ b/scripts/apidoc/apiDocsWriter.ts @@ -2,16 +2,17 @@ import { writeFileSync } from 'node:fs'; import { resolve } from 'node:path'; import type { ProjectReflection } from 'typedoc'; import type { Method } from '../../docs/.vitepress/components/api-docs/method'; -import type { APIGroup, APIItem } from '../../docs/api/api-types'; +import type { APIGroup } from '../../docs/api/api-types'; import { formatMarkdown, formatTypescript } from './format'; +import { extractSourceBaseUrl } from './typedoc'; +import type { DocsApiDiffIndex, ModuleSummary, Page } from './utils'; import { - extractModuleName, - extractSourceBaseUrl, - selectApiMethods, - selectApiModules, -} from './typedoc'; -import type { DocsApiDiffIndex, PageIndex } from './utils'; -import { pathDocsDiffIndexFile, pathDocsDir, pathOutputDir } from './utils'; + diffHash, + methodDiffHash, + pathDocsDiffIndexFile, + pathDocsDir, + pathOutputDir, +} from './utils'; const pathDocsApiPages = resolve(pathDocsDir, '.vitepress', 'api-pages.ts'); const pathDocsApiSearchIndex = resolve( @@ -29,6 +30,52 @@ editLink: false `; +/** + * Writes the api docs for the given modules. + * + * @param moduleName The name of the module to write the docs for. + * @param lowerModuleName The lowercase name of the module. + * @param comment The module comments. + * @param deprecated The deprecation message. + * @param methods The methods of the module. + */ +export function writeApiDocsModule( + moduleName: string, + lowerModuleName: string, + comment: string, + deprecated: string | undefined, + methods: Method[] +): ModuleSummary { + writeApiDocsModulePage( + moduleName, + lowerModuleName, + comment, + deprecated, + methods + ); + writeApiDocsModuleData(lowerModuleName, methods); + + return { + text: moduleName, + link: `/api/${lowerModuleName}.html`, + methods, + diff: methods.reduce( + (data, method) => ({ + ...data, + [method.name]: methodDiffHash(method), + }), + { + moduleHash: diffHash({ + name: moduleName, + field: lowerModuleName, + deprecated, + comment, + }), + } + ), + }; +} + /** * Writes the api page for the given module to the correct location. * @@ -37,7 +84,7 @@ editLink: false * @param comment The module comments. * @param methods The methods of the module. */ -export function writeApiDocsModulePage( +function writeApiDocsModulePage( moduleName: string, lowerModuleName: string, comment: string, @@ -94,7 +141,7 @@ export function writeApiDocsModulePage( * @param lowerModuleName The lowercase name of the module. * @param methods The methods data to save. */ -export function writeApiDocsData( +function writeApiDocsModuleData( lowerModuleName: string, methods: Method[] ): void { @@ -116,10 +163,9 @@ export function writeApiDocsData( * * @param pages The pages to write into the index. */ -export function writeApiPagesIndex(pages: PageIndex): void { +export function writeApiPagesIndex(pages: Page[]): void { // Write api-pages.ts console.log('Updating api-pages.ts'); - pages.sort((a, b) => a.text.localeCompare(b.text)); pages.splice(0, 0, { text: 'Overview', link: '/api/' }); let apiPagesContent = ` // This file is automatically generated. @@ -146,33 +192,20 @@ export function writeApiDiffIndex(diffIndex: DocsApiDiffIndex): void { * * @param project The typedoc project. */ -export function writeApiSearchIndex(project: ProjectReflection): void { - const apiIndex: APIGroup[] = []; - - const moduleApiSection: APIGroup = { - text: 'Module API', - items: [], - }; - - apiIndex.push(moduleApiSection); - - const apiModules = selectApiModules(project); - - moduleApiSection.items = apiModules - .map((module) => { - const moduleName = extractModuleName(module); - const apiSection: APIItem = { - text: moduleName, - link: moduleName.toLowerCase(), - headers: selectApiMethods(module).map((child) => ({ - anchor: child.name, - text: child.name, +export function writeApiSearchIndex(pages: ModuleSummary[]): void { + const apiIndex: APIGroup[] = [ + { + text: 'Module API', + items: pages.map((module) => ({ + text: module.text, + link: module.link, + headers: module.methods.map((method) => ({ + anchor: method.name, + text: method.name, })), - }; - - return apiSection; - }) - .sort((a, b) => a.text.localeCompare(b.text)); + })), + }, + ]; writeFileSync(pathDocsApiSearchIndex, JSON.stringify(apiIndex)); } diff --git a/scripts/apidoc/diff.ts b/scripts/apidoc/diff.ts index 913062c82d7..654f44b0260 100644 --- a/scripts/apidoc/diff.ts +++ b/scripts/apidoc/diff.ts @@ -35,11 +35,7 @@ async function loadLocal(path: string): Promise { * @param source The source to load the diff index from. */ async function load(source: string): Promise { - if (source.startsWith('https://')) { - return loadRemote(source); - } else { - return loadLocal(source); - } + return source.startsWith('https://') ? loadRemote(source) : loadLocal(source); } /** diff --git a/scripts/apidoc/fakerClass.ts b/scripts/apidoc/fakerClass.ts new file mode 100644 index 00000000000..9d11815f0a3 --- /dev/null +++ b/scripts/apidoc/fakerClass.ts @@ -0,0 +1,48 @@ +import type { DeclarationReflection, ProjectReflection } from 'typedoc'; +import { ReflectionKind } from 'typedoc'; +import type { Method } from '../../docs/.vitepress/components/api-docs/method'; +import { writeApiDocsModule } from './apiDocsWriter'; +import { processModuleMethods } from './moduleMethods'; +import { analyzeSignature, toBlock } from './signature'; +import { selectApiSignature } from './typedoc'; +import type { ModuleSummary } from './utils'; + +export function processFakerClass(project: ProjectReflection): ModuleSummary { + const fakerClass = project + .getChildrenByKind(ReflectionKind.Class) + .filter((clazz) => clazz.name === 'Faker')[0]; + + if (!fakerClass) { + throw new Error('Faker class not found'); + } + + return processClass(fakerClass); +} + +function processClass(fakerClass: DeclarationReflection): ModuleSummary { + console.log(`Processing Faker class`); + const comment = toBlock(fakerClass.comment); + const methods: Method[] = []; + + console.debug(`- constructor`); + methods.push(processConstructor(fakerClass)); + + methods.push(...processModuleMethods(fakerClass, 'faker.')); + + return writeApiDocsModule('Faker', 'faker', comment, undefined, methods); +} + +function processConstructor(fakerClass: DeclarationReflection): Method { + const constructor = fakerClass.getChildrenByKind( + ReflectionKind.Constructor + )[0]; + + const signature = selectApiSignature(constructor); + + const method = analyzeSignature(signature, '', 'new Faker'); + + return { + ...method, + name: 'constructor', + }; +} diff --git a/scripts/apidoc/fakerUtilities.ts b/scripts/apidoc/fakerUtilities.ts new file mode 100644 index 00000000000..f033eadc6e3 --- /dev/null +++ b/scripts/apidoc/fakerUtilities.ts @@ -0,0 +1,32 @@ +import type { DeclarationReflection, ProjectReflection } from 'typedoc'; +import { ReflectionKind } from 'typedoc'; +import type { Method } from '../../docs/.vitepress/components/api-docs/method'; +import { writeApiDocsModule } from './apiDocsWriter'; +import { processMethods } from './moduleMethods'; +import { selectApiSignature } from './typedoc'; +import type { ModuleSummary } from './utils'; + +export function processFakerUtilities( + project: ProjectReflection +): ModuleSummary { + const fakerUtilities = project + .getChildrenByKind(ReflectionKind.Function) + .filter((method) => !method.flags.isPrivate); + + return processUtilities(fakerUtilities); +} + +function processUtilities( + fakerUtilities: DeclarationReflection[] +): ModuleSummary { + console.log(`Processing Faker Utilities`); + const comment = 'A list of all the utilities available in Faker.js.'; + + const methods: Method[] = processMethods( + Object.fromEntries( + fakerUtilities.map((method) => [method.name, selectApiSignature(method)]) + ) + ); + + return writeApiDocsModule('Utilities', 'utils', comment, undefined, methods); +} diff --git a/scripts/apidoc/generate.ts b/scripts/apidoc/generate.ts index b5ccb3f34d7..408ab76a60c 100644 --- a/scripts/apidoc/generate.ts +++ b/scripts/apidoc/generate.ts @@ -5,7 +5,9 @@ import { writeApiSearchIndex, writeSourceBaseUrl, } from './apiDocsWriter'; -import { processModuleMethods } from './moduleMethods'; +import { processFakerClass } from './fakerClass'; +import { processFakerUtilities } from './fakerUtilities'; +import { processModules } from './moduleMethods'; import { loadProject } from './typedoc'; import { pathOutputDir } from './utils'; @@ -20,12 +22,16 @@ export async function generate(): Promise { // Useful for manually analyzing the content await app.generateJson(project, pathOutputJson); - const modules = processModuleMethods(project); - writeApiPagesIndex(modules.map(({ text, link }) => ({ text, link }))); + const pages = [ + processFakerClass(project), + ...processModules(project).sort((a, b) => a.text.localeCompare(b.text)), + processFakerUtilities(project), + ]; + writeApiPagesIndex(pages.map(({ text, link }) => ({ text, link }))); writeApiDiffIndex( - modules.reduce((data, { text, diff }) => ({ ...data, [text]: diff }), {}) + pages.reduce((data, { text, diff }) => ({ ...data, [text]: diff }), {}) ); + writeApiSearchIndex(pages); - writeApiSearchIndex(project); writeSourceBaseUrl(project); } diff --git a/scripts/apidoc/moduleMethods.ts b/scripts/apidoc/moduleMethods.ts index 20cbc2b8056..9c902dd7038 100644 --- a/scripts/apidoc/moduleMethods.ts +++ b/scripts/apidoc/moduleMethods.ts @@ -1,6 +1,10 @@ -import type { DeclarationReflection, ProjectReflection } from 'typedoc'; +import type { + DeclarationReflection, + ProjectReflection, + SignatureReflection, +} from 'typedoc'; import type { Method } from '../../docs/.vitepress/components/api-docs/method'; -import { writeApiDocsData, writeApiDocsModulePage } from './apiDocsWriter'; +import { writeApiDocsModule } from './apiDocsWriter'; import { analyzeSignature, stripAbsoluteFakerUrls, toBlock } from './signature'; import { extractDeprecated, @@ -9,8 +13,7 @@ import { selectApiMethodSignatures, selectApiModules, } from './typedoc'; -import type { PageAndDiffIndex } from './utils'; -import { diffHash, methodDiffHash } from './utils'; +import type { ModuleSummary } from './utils'; /** * Analyzes and writes the documentation for modules and their methods such as `faker.animal.cat()`. @@ -18,17 +21,8 @@ import { diffHash, methodDiffHash } from './utils'; * @param project The project used to extract the modules. * @returns The generated pages. */ -export function processModuleMethods( - project: ProjectReflection -): PageAndDiffIndex { - const pages: PageAndDiffIndex = []; - - // Generate module files - for (const module of selectApiModules(project)) { - pages.push(...processModuleMethod(module)); - } - - return pages; +export function processModules(project: ProjectReflection): ModuleSummary[] { + return selectApiModules(project).map(processModule); } /** @@ -37,48 +31,54 @@ export function processModuleMethods( * @param module The module to process. * @returns The generated pages. */ -function processModuleMethod(module: DeclarationReflection): PageAndDiffIndex { +function processModule(module: DeclarationReflection): ModuleSummary { const moduleName = extractModuleName(module); const moduleFieldName = extractModuleFieldName(module); console.log(`Processing Module ${moduleName}`); const comment = stripAbsoluteFakerUrls(toBlock(module.comment)); const deprecated = extractDeprecated(module); - const methods: Method[] = []; - - // Generate method section - for (const [methodName, signature] of Object.entries( - selectApiMethodSignatures(module) - )) { - console.debug(`- ${methodName}`); - methods.push(analyzeSignature(signature, moduleFieldName, methodName)); - } + const methods = processModuleMethods(module, `faker.${moduleFieldName}.`); - writeApiDocsModulePage( + return writeApiDocsModule( moduleName, moduleFieldName, comment, deprecated, methods ); - writeApiDocsData(moduleFieldName, methods); +} + +/** + * Processes all api methods of the given class. This does not include the constructor. + * + * @param module The module to process. + * @param accessor The code used to access the methods within the module. + * @returns A list containing the documentation for the api methods in the given module. + */ +export function processModuleMethods( + module: DeclarationReflection, + accessor: string +): Method[] { + return processMethods(selectApiMethodSignatures(module), accessor); +} + +/** + * Processes all api methods. + * + * @param signatures The signatures to process. + * @param accessor The code used to access the methods. + * @returns A list containing the documentation for the api methods. + */ +export function processMethods( + signatures: Record, + accessor: string = '' +): Method[] { + const methods: Method[] = []; + + for (const [methodName, signature] of Object.entries(signatures)) { + console.debug(`- ${methodName}`); + methods.push(analyzeSignature(signature, accessor, methodName)); + } - return [ - { - text: moduleName, - link: `/api/${moduleFieldName}.html`, - diff: methods.reduce( - (data, method) => ({ - ...data, - [method.name]: methodDiffHash(method), - }), - { - moduleHash: diffHash({ - name: moduleName, - field: moduleFieldName, - comment, - }), - } - ), - }, - ]; + return methods; } diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index f9364a04eb1..05944ba7176 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -17,7 +17,6 @@ import type { MethodParameter, } from '../../docs/.vitepress/components/api-docs/method'; import vitepressConfig from '../../docs/.vitepress/config'; -import { faker } from '../../src'; import { formatTypescript } from './format'; import { extractDeprecated, @@ -32,14 +31,6 @@ import { pathOutputDir } from './utils'; const code = '```'; -function prettifyMethodName(method: string): string { - return ( - // Capitalize and insert space before upper case characters - method.substring(0, 1).toUpperCase() + - method.substring(1).replace(/([A-Z]+)/g, ' $1') - ); -} - export const MISSING_DESCRIPTION = 'Missing'; export function toBlock(comment?: Comment): string { @@ -104,18 +95,18 @@ function mdToHtml(md: string, inline: boolean = false): string { // Revert some escaped characters for comparison. if (comparableSanitizedHtml(rawHtml) === comparableSanitizedHtml(safeHtml)) { return safeHtml; - } else { - console.debug('Rejected unsafe md:', md); - console.error('Rejected unsafe html:', rawHtml); - console.error('Rejected unsafe html:', comparableSanitizedHtml(rawHtml)); - console.error('Expected safe html:', comparableSanitizedHtml(safeHtml)); - throw new Error('Found unsafe html'); } + + console.debug('Rejected unsafe md:', md); + console.error('Rejected unsafe html:', rawHtml); + console.error('Rejected unsafe html:', comparableSanitizedHtml(rawHtml)); + console.error('Expected safe html:', comparableSanitizedHtml(safeHtml)); + throw new Error('Found unsafe html'); } export function analyzeSignature( signature: SignatureReflection, - moduleName: string | null, + accessor: string, methodName: string ): Method { const parameters: MethodParameter[] = []; @@ -155,27 +146,7 @@ export function analyzeSignature( const signatureParametersString = signatureParameters.join(', '); - let examples: string; - if (moduleName) { - examples = `faker.${moduleName}.${methodName}${signatureTypeParametersString}(${signatureParametersString}): ${signature.type?.toString()}\n`; - } else { - examples = `faker.${methodName}${signatureTypeParametersString}(${signatureParametersString}): ${signature.type?.toString()}\n`; - } - - faker.seed(0); - if (moduleName) { - try { - let example = JSON.stringify(faker[moduleName][methodName]()); - if (example.length > 50) { - example = `${example.substring(0, 47)}...`; - } - - examples += `faker.${moduleName}.${methodName}()`; - examples += `${example ? ` // => ${example}` : ''}\n`; - } catch (error) { - // Ignore the error => hide the example call + result. - } - } + let examples = `${accessor}${methodName}${signatureTypeParametersString}(${signatureParametersString}): ${signature.type?.toString()}\n`; const exampleTags = extractRawExamples(signature); if (exampleTags.length > 0) { @@ -191,7 +162,6 @@ export function analyzeSignature( : undefined; return { name: methodName, - title: prettifyMethodName(methodName), description: mdToHtml(toBlock(signature.comment)), parameters: parameters, since: extractSince(signature), @@ -294,11 +264,8 @@ function typeToText(type_?: Type, short = false): string { switch (type.type) { case 'array': { const text = typeToText(type.elementType, short); - if (text.includes('|') || text.includes('{')) { - return `Array<${text}>`; - } else { - return `${text}[]`; - } + const isComplexType = text.includes('|') || text.includes('{'); + return isComplexType ? `Array<${text}>` : `${text}[]`; } case 'union': @@ -318,20 +285,20 @@ function typeToText(type_?: Type, short = false): string { !type.name.match(/Char$/) ) { return typeToText(reflectionType, short); - } else { - return type.name; } + + return type.name; } else if (type.name === 'LiteralUnion') { return [ typeToText(type.typeArguments[0], short), typeToText(type.typeArguments[1], short), ].join(' | '); - } else { - return `${type.name}<${type.typeArguments - .map((t) => typeToText(t, short)) - .join(', ')}>`; } + return `${type.name}<${type.typeArguments + .map((t) => typeToText(t, short)) + .join(', ')}>`; + case 'reflection': return declarationTypeToText(type.declaration, short); @@ -348,9 +315,9 @@ function typeToText(type_?: Type, short = false): string { const text = typeToText(type.target, short); if (short && type.operator === 'readonly') { return text; - } else { - return `${type.operator} ${text}`; } + + return `${type.operator} ${text}`; } default: @@ -383,10 +350,10 @@ function declarationTypeToText( return `{\n${list}\n}`; } else if (declaration.signatures?.length) { return signatureTypeToText(declaration.signatures[0]); - } else { - return declaration.toString(); } + return declaration.toString(); + default: return declaration.toString(); } diff --git a/scripts/apidoc/utils.ts b/scripts/apidoc/utils.ts index 4c9c322d7cf..79e475070d7 100644 --- a/scripts/apidoc/utils.ts +++ b/scripts/apidoc/utils.ts @@ -5,12 +5,11 @@ import type { Method } from '../../docs/.vitepress/components/api-docs/method'; // Types export type Page = { text: string; link: string }; -export type PageIndex = Page[]; -export type PageAndDiff = Page & { +export type ModuleSummary = Page & { + methods: Method[]; diff: DocsApiDiff; }; -export type PageAndDiffIndex = PageAndDiff[]; export interface DocsApiDiffIndex { /** diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index b721cb90093..2af0c46a287 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -102,17 +102,17 @@ function removeTsSuffix(files: string[]): string[] { function escapeImport(parent: string, module: string): string { if (['name', 'type', 'switch', parent].includes(module)) { return `${module}_`; - } else { - return module; } + + return module; } function escapeField(parent: string, module: string): string { if (['name', 'type', 'switch', parent].includes(module)) { return `${module}: ${module}_`; - } else { - return module; } + + return module; } function generateLocaleFile(locale: string): void { diff --git a/src/locale/ge.ts b/src/locale/ge.ts index b70b48c606e..ea512b7128e 100644 --- a/src/locale/ge.ts +++ b/src/locale/ge.ts @@ -1,13 +1,12 @@ -/* - * This file is automatically generated. - * Run 'pnpm run generate:locales' to update. - */ +import { deprecated } from '../internal/deprecated'; +import { faker as ka_GE } from './ka_GE'; -import { Faker } from '../faker'; -import base from '../locales/base'; -import en from '../locales/en'; -import ge from '../locales/ge'; - -export const faker = new Faker({ - locale: [ge, en, base], -}); +export const faker = (() => { + deprecated({ + deprecated: "import { faker } from '@faker-js/faker/locale/ge'", + proposed: "import { faker } from '@faker-js/faker/locale/ka_GE'", + since: '8.0', + until: '9.0', + }); + return ka_GE; +})(); diff --git a/src/locale/index.ts b/src/locale/index.ts index 1ed301c5204..8772dca61b1 100644 --- a/src/locale/index.ts +++ b/src/locale/index.ts @@ -34,7 +34,6 @@ import { faker as fakerFR_BE } from './fr_BE'; import { faker as fakerFR_CA } from './fr_CA'; import { faker as fakerFR_CH } from './fr_CH'; import { faker as fakerFR_LU } from './fr_LU'; -import { faker as fakerGE } from './ge'; import { faker as fakerHE } from './he'; import { faker as fakerHR } from './hr'; import { faker as fakerHU } from './hu'; @@ -42,6 +41,7 @@ import { faker as fakerHY } from './hy'; import { faker as fakerID_ID } from './id_ID'; import { faker as fakerIT } from './it'; import { faker as fakerJA } from './ja'; +import { faker as fakerKA_GE } from './ka_GE'; import { faker as fakerKO } from './ko'; import { faker as fakerLV } from './lv'; import { faker as fakerMK } from './mk'; @@ -98,7 +98,6 @@ export { fakerFR_CA, fakerFR_CH, fakerFR_LU, - fakerGE, fakerHE, fakerHR, fakerHU, @@ -106,6 +105,7 @@ export { fakerID_ID, fakerIT, fakerJA, + fakerKA_GE, fakerKO, fakerLV, fakerMK, @@ -163,7 +163,6 @@ export const allFakers = { fr_CA: fakerFR_CA, fr_CH: fakerFR_CH, fr_LU: fakerFR_LU, - ge: fakerGE, he: fakerHE, hr: fakerHR, hu: fakerHU, @@ -171,6 +170,7 @@ export const allFakers = { id_ID: fakerID_ID, it: fakerIT, ja: fakerJA, + ka_GE: fakerKA_GE, ko: fakerKO, lv: fakerLV, mk: fakerMK, diff --git a/src/locale/ka_GE.ts b/src/locale/ka_GE.ts new file mode 100644 index 00000000000..8f32405f0c1 --- /dev/null +++ b/src/locale/ka_GE.ts @@ -0,0 +1,13 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ + +import { Faker } from '../faker'; +import base from '../locales/base'; +import en from '../locales/en'; +import ka_GE from '../locales/ka_GE'; + +export const faker = new Faker({ + locale: [ka_GE, en, base], +}); diff --git a/src/locales/en_US/location/county.ts b/src/locales/en_US/location/county.ts new file mode 100644 index 00000000000..2beaed3cd3a --- /dev/null +++ b/src/locales/en_US/location/county.ts @@ -0,0 +1,38 @@ +export default [ + 'Adams County', + 'Calhoun County', + 'Carroll County', + 'Clark County', + 'Clay County', + 'Crawford County', + 'Douglas County', + 'Fayette County', + 'Franklin County', + 'Grant County', + 'Greene County', + 'Hamilton County', + 'Hancock County', + 'Henry County', + 'Jackson County', + 'Jefferson County', + 'Johnson County', + 'Lake County', + 'Lawrence County', + 'Lee County', + 'Lincoln County', + 'Logan County', + 'Madison County', + 'Marion County', + 'Marshall County', + 'Monroe County', + 'Montgomery County', + 'Morgan County', + 'Perry County', + 'Pike County', + 'Polk County', + 'Scott County', + 'Union County', + 'Warren County', + 'Washington County', + 'Wayne County', +]; diff --git a/src/locales/en_US/location/index.ts b/src/locales/en_US/location/index.ts index a2415a8c4f1..d2e817abe24 100644 --- a/src/locales/en_US/location/index.ts +++ b/src/locales/en_US/location/index.ts @@ -4,12 +4,14 @@ */ import type { LocationDefinitions } from '../../..'; import city from './city'; +import county from './county'; import default_country from './default_country'; import postcode_by_state from './postcode_by_state'; import street from './street'; const location: LocationDefinitions = { city, + county, default_country, postcode_by_state, street, diff --git a/src/locales/fr_CH/location/street_address.ts b/src/locales/fr_CH/location/street_address.ts index 3ee966e2703..2e1a661d418 100644 --- a/src/locales/fr_CH/location/street_address.ts +++ b/src/locales/fr_CH/location/street_address.ts @@ -1,4 +1,4 @@ export default { - normal: '{{location.buildingNumber}} {{location.streetName}}', - full: '{{location.buildingNumber}} {{location.streetName}} {{location.secondaryAddress}}', + normal: '{{location.buildingNumber}} {{location.street}}', + full: '{{location.buildingNumber}} {{location.street}} {{location.secondaryAddress}}', }; diff --git a/src/locales/index.ts b/src/locales/index.ts index 18c91c7122a..b0f87395451 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -34,7 +34,6 @@ export { default as fr_BE } from './fr_BE'; export { default as fr_CA } from './fr_CA'; export { default as fr_CH } from './fr_CH'; export { default as fr_LU } from './fr_LU'; -export { default as ge } from './ge'; export { default as he } from './he'; export { default as hr } from './hr'; export { default as hu } from './hu'; @@ -42,6 +41,7 @@ export { default as hy } from './hy'; export { default as id_ID } from './id_ID'; export { default as it } from './it'; export { default as ja } from './ja'; +export { default as ka_GE } from './ka_GE'; export { default as ko } from './ko'; export { default as lv } from './lv'; export { default as mk } from './mk'; diff --git a/src/locales/ge/cell_phone/formats.ts b/src/locales/ka_GE/cell_phone/formats.ts similarity index 100% rename from src/locales/ge/cell_phone/formats.ts rename to src/locales/ka_GE/cell_phone/formats.ts diff --git a/src/locales/ge/cell_phone/index.ts b/src/locales/ka_GE/cell_phone/index.ts similarity index 100% rename from src/locales/ge/cell_phone/index.ts rename to src/locales/ka_GE/cell_phone/index.ts diff --git a/src/locales/ge/company/index.ts b/src/locales/ka_GE/company/index.ts similarity index 100% rename from src/locales/ge/company/index.ts rename to src/locales/ka_GE/company/index.ts diff --git a/src/locales/ge/company/name_patterns.ts b/src/locales/ka_GE/company/name_patterns.ts similarity index 100% rename from src/locales/ge/company/name_patterns.ts rename to src/locales/ka_GE/company/name_patterns.ts diff --git a/src/locales/ge/company/prefix.ts b/src/locales/ka_GE/company/prefix.ts similarity index 100% rename from src/locales/ge/company/prefix.ts rename to src/locales/ka_GE/company/prefix.ts diff --git a/src/locales/ge/company/suffix.ts b/src/locales/ka_GE/company/suffix.ts similarity index 100% rename from src/locales/ge/company/suffix.ts rename to src/locales/ka_GE/company/suffix.ts diff --git a/src/locales/ge/index.ts b/src/locales/ka_GE/index.ts similarity index 89% rename from src/locales/ge/index.ts rename to src/locales/ka_GE/index.ts index 618247f6c5f..ea959663f60 100644 --- a/src/locales/ge/index.ts +++ b/src/locales/ka_GE/index.ts @@ -11,7 +11,7 @@ import metadata from './metadata'; import person from './person'; import phone_number from './phone_number'; -const ge: LocaleDefinition = { +const ka_GE: LocaleDefinition = { cell_phone, company, internet, @@ -21,4 +21,4 @@ const ge: LocaleDefinition = { phone_number, }; -export default ge; +export default ka_GE; diff --git a/src/locales/ge/internet/domain_suffix.ts b/src/locales/ka_GE/internet/domain_suffix.ts similarity index 100% rename from src/locales/ge/internet/domain_suffix.ts rename to src/locales/ka_GE/internet/domain_suffix.ts diff --git a/src/locales/ge/internet/free_email.ts b/src/locales/ka_GE/internet/free_email.ts similarity index 100% rename from src/locales/ge/internet/free_email.ts rename to src/locales/ka_GE/internet/free_email.ts diff --git a/src/locales/ge/internet/index.ts b/src/locales/ka_GE/internet/index.ts similarity index 100% rename from src/locales/ge/internet/index.ts rename to src/locales/ka_GE/internet/index.ts diff --git a/src/locales/ge/location/building_number.ts b/src/locales/ka_GE/location/building_number.ts similarity index 100% rename from src/locales/ge/location/building_number.ts rename to src/locales/ka_GE/location/building_number.ts diff --git a/src/locales/ge/location/city.ts b/src/locales/ka_GE/location/city.ts similarity index 100% rename from src/locales/ge/location/city.ts rename to src/locales/ka_GE/location/city.ts diff --git a/src/locales/ge/location/city_name.ts b/src/locales/ka_GE/location/city_name.ts similarity index 100% rename from src/locales/ge/location/city_name.ts rename to src/locales/ka_GE/location/city_name.ts diff --git a/src/locales/ge/location/city_prefix.ts b/src/locales/ka_GE/location/city_prefix.ts similarity index 100% rename from src/locales/ge/location/city_prefix.ts rename to src/locales/ka_GE/location/city_prefix.ts diff --git a/src/locales/ge/location/city_suffix.ts b/src/locales/ka_GE/location/city_suffix.ts similarity index 100% rename from src/locales/ge/location/city_suffix.ts rename to src/locales/ka_GE/location/city_suffix.ts diff --git a/src/locales/ge/location/country.ts b/src/locales/ka_GE/location/country.ts similarity index 100% rename from src/locales/ge/location/country.ts rename to src/locales/ka_GE/location/country.ts diff --git a/src/locales/ge/location/default_country.ts b/src/locales/ka_GE/location/default_country.ts similarity index 100% rename from src/locales/ge/location/default_country.ts rename to src/locales/ka_GE/location/default_country.ts diff --git a/src/locales/ge/location/index.ts b/src/locales/ka_GE/location/index.ts similarity index 100% rename from src/locales/ge/location/index.ts rename to src/locales/ka_GE/location/index.ts diff --git a/src/locales/ge/location/postcode.ts b/src/locales/ka_GE/location/postcode.ts similarity index 100% rename from src/locales/ge/location/postcode.ts rename to src/locales/ka_GE/location/postcode.ts diff --git a/src/locales/ge/location/secondary_address.ts b/src/locales/ka_GE/location/secondary_address.ts similarity index 100% rename from src/locales/ge/location/secondary_address.ts rename to src/locales/ka_GE/location/secondary_address.ts diff --git a/src/locales/ge/location/street.ts b/src/locales/ka_GE/location/street.ts similarity index 100% rename from src/locales/ge/location/street.ts rename to src/locales/ka_GE/location/street.ts diff --git a/src/locales/ge/location/street_address.ts b/src/locales/ka_GE/location/street_address.ts similarity index 100% rename from src/locales/ge/location/street_address.ts rename to src/locales/ka_GE/location/street_address.ts diff --git a/src/locales/ge/location/street_name.ts b/src/locales/ka_GE/location/street_name.ts similarity index 100% rename from src/locales/ge/location/street_name.ts rename to src/locales/ka_GE/location/street_name.ts diff --git a/src/locales/ge/location/street_suffix.ts b/src/locales/ka_GE/location/street_suffix.ts similarity index 100% rename from src/locales/ge/location/street_suffix.ts rename to src/locales/ka_GE/location/street_suffix.ts diff --git a/src/locales/ge/metadata.ts b/src/locales/ka_GE/metadata.ts similarity index 79% rename from src/locales/ge/metadata.ts rename to src/locales/ka_GE/metadata.ts index b77524dc15f..5a049913438 100644 --- a/src/locales/ge/metadata.ts +++ b/src/locales/ka_GE/metadata.ts @@ -1,7 +1,7 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Georgian', + title: 'Georgian (Georgia)', }; export default metadata; diff --git a/src/locales/ge/person/female_prefix.ts b/src/locales/ka_GE/person/female_prefix.ts similarity index 100% rename from src/locales/ge/person/female_prefix.ts rename to src/locales/ka_GE/person/female_prefix.ts diff --git a/src/locales/ge/person/first_name.ts b/src/locales/ka_GE/person/first_name.ts similarity index 100% rename from src/locales/ge/person/first_name.ts rename to src/locales/ka_GE/person/first_name.ts diff --git a/src/locales/ge/person/index.ts b/src/locales/ka_GE/person/index.ts similarity index 100% rename from src/locales/ge/person/index.ts rename to src/locales/ka_GE/person/index.ts diff --git a/src/locales/ge/person/last_name.ts b/src/locales/ka_GE/person/last_name.ts similarity index 100% rename from src/locales/ge/person/last_name.ts rename to src/locales/ka_GE/person/last_name.ts diff --git a/src/locales/ge/person/last_name_patterns.ts b/src/locales/ka_GE/person/last_name_patterns.ts similarity index 100% rename from src/locales/ge/person/last_name_patterns.ts rename to src/locales/ka_GE/person/last_name_patterns.ts diff --git a/src/locales/ge/person/male_prefix.ts b/src/locales/ka_GE/person/male_prefix.ts similarity index 100% rename from src/locales/ge/person/male_prefix.ts rename to src/locales/ka_GE/person/male_prefix.ts diff --git a/src/locales/ge/person/name.ts b/src/locales/ka_GE/person/name.ts similarity index 100% rename from src/locales/ge/person/name.ts rename to src/locales/ka_GE/person/name.ts diff --git a/src/locales/ge/person/prefix.ts b/src/locales/ka_GE/person/prefix.ts similarity index 100% rename from src/locales/ge/person/prefix.ts rename to src/locales/ka_GE/person/prefix.ts diff --git a/src/locales/ge/person/title.ts b/src/locales/ka_GE/person/title.ts similarity index 100% rename from src/locales/ge/person/title.ts rename to src/locales/ka_GE/person/title.ts diff --git a/src/locales/ge/phone_number/formats.ts b/src/locales/ka_GE/phone_number/formats.ts similarity index 100% rename from src/locales/ge/phone_number/formats.ts rename to src/locales/ka_GE/phone_number/formats.ts diff --git a/src/locales/ge/phone_number/index.ts b/src/locales/ka_GE/phone_number/index.ts similarity index 100% rename from src/locales/ge/phone_number/index.ts rename to src/locales/ka_GE/phone_number/index.ts diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts index 56b298eb043..579bd89bcd9 100644 --- a/src/modules/finance/index.ts +++ b/src/modules/finance/index.ts @@ -135,19 +135,9 @@ export class FinanceModule { options = { length: options }; } - let { length = 8 } = options; - if (length === 0) { - length = 8; - } - - let template = ''; + const { length = 8 } = options; - for (let i = 0; i < length; i++) { - template += '#'; - } - - length = null; - return this.faker.helpers.replaceSymbolWithNumber(template); + return this.faker.string.numeric({ length, allowLeadingZeros: true }); } /** diff --git a/src/modules/helpers/unique.ts b/src/modules/helpers/unique.ts index 26f1b6d0d88..c6668137c27 100644 --- a/src/modules/helpers/unique.ts +++ b/src/modules/helpers/unique.ts @@ -150,16 +150,16 @@ export function exec< store[result] = result; options.currentIterations = 0; return result; - } else { - // console.log('conflict', result); - options.currentIterations++; - return exec(method, args, { - ...options, - startTime, - maxTime, - maxRetries, - compare, - exclude, - }); } + + // console.log('conflict', result); + options.currentIterations++; + return exec(method, args, { + ...options, + startTime, + maxTime, + maxRetries, + compare, + exclude, + }); } diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index ab158ecbc88..03d3413431b 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -240,6 +240,7 @@ export class LocationModule { * * @example * fakerEN_GB.location.county() // 'Cambridgeshire' + * fakerEN_US.location.county() // 'Monroe County' * * @since 8.0.0 */ diff --git a/src/modules/number/index.ts b/src/modules/number/index.ts index 1e3ed3637e0..92751fe627c 100644 --- a/src/modules/number/index.ts +++ b/src/modules/number/index.ts @@ -167,12 +167,12 @@ export class NumberModule { max: max * factor, }); return int / factor; - } else { - // @ts-expect-error: access private member field - const mersenne: Mersenne = this.faker._mersenne; - const real = mersenne.next(); - return real * (max - min) + min; } + + // @ts-expect-error: access private member field + const mersenne: Mersenne = this.faker._mersenne; + const real = mersenne.next(); + return real * (max - min) + min; } /** diff --git a/src/modules/person/index.ts b/src/modules/person/index.ts index 2d2d1dc17c1..5dbeea3d146 100644 --- a/src/modules/person/index.ts +++ b/src/modules/person/index.ts @@ -149,18 +149,13 @@ export class PersonModule { } ); return this.faker.helpers.fake(pattern); - } else { - return selectDefinition( - this.faker, - this.faker.helpers.arrayElement, - sex, - { - generic: last_name, - female: female_last_name, - male: male_last_name, - } - ); } + + return selectDefinition(this.faker, this.faker.helpers.arrayElement, sex, { + generic: last_name, + female: female_last_name, + male: male_last_name, + }); } /** diff --git a/src/modules/word/filterWordListByLength.ts b/src/modules/word/filterWordListByLength.ts index ca3123719dd..4651d4973ef 100644 --- a/src/modules/word/filterWordListByLength.ts +++ b/src/modules/word/filterWordListByLength.ts @@ -87,12 +87,12 @@ export function filterWordListByLength(options: { if (typeof length === 'number') { return STRATEGIES[strategy](wordList, { min: length, max: length }); - } else { - return STRATEGIES[strategy](wordList, length); } + + return STRATEGIES[strategy](wordList, length); } else if (strategy === 'shortest' || strategy === 'longest') { return STRATEGIES[strategy](wordList); - } else { - return [...wordList]; } + + return [...wordList]; } diff --git a/test/finance.spec.ts b/test/finance.spec.ts index c71b3d38528..864ddb3bf23 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -123,16 +123,6 @@ describe('finance', () => { ).toHaveLength(8); }); - it('should supply a default length if a zero is passed', () => { - const accountNum = faker.finance.account(0); - - expect(accountNum).toBeTruthy(); - expect( - accountNum, - 'The length of the account number should be 8 characters long' - ).toHaveLength(8); - }); - it('should be the the length fo given number', () => { const accountNum = faker.finance.account(16); diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap index f93bcd497e9..715c85aa1fa 100644 --- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap +++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap @@ -5,7 +5,7 @@ exports[`signature > analyzeSignature() > complexArrayParameter 1`] = ` "deprecated": undefined, "description": "

Complex array parameter.

", - "examples": "
ts
faker.complexArrayParameter<T>(array: readonly Array<{
+  "examples": "
ts
complexArrayParameter<T>(array: readonly Array<{
   value: T,
   weight: number
 }>): T
@@ -45,7 +45,6 @@ exports[`signature > analyzeSignature() > complexArrayParameter 1`] = `
   "seeAlsos": [],
   "since": "",
   "sourcePath": "test/scripts/apidoc/signature.example.ts#L343",
-  "title": "Complex Array Parameter",
 }
 `;
 
@@ -54,7 +53,7 @@ exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = `
   "deprecated": undefined,
   "description": "

Test with a default parameter.

", - "examples": "
ts
faker.defaultBooleanParamMethod(c: boolean = true): number
+  "examples": "
ts
defaultBooleanParamMethod(c: boolean = true): number
 
", "name": "defaultBooleanParamMethod", @@ -71,7 +70,6 @@ exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L101", - "title": "Default Boolean Param Method", } `; @@ -104,7 +102,7 @@ exports[`signature > analyzeSignature() > functionParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with a function parameters.

", - "examples": "
ts
faker.functionParamMethod(fn: (a: string) => number): number
+  "examples": "
ts
functionParamMethod(fn: (a: string) => number): number
 
", "name": "functionParamMethod", @@ -121,7 +119,6 @@ exports[`signature > analyzeSignature() > functionParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L121", - "title": "Function Param Method", } `; @@ -130,7 +127,7 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with LiteralUnion.

", - "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string, namedValue: 'a' | 'b' | string, array: readonly Array<'a' | 'b' | string>, namedArray: readonly Array<'a' | 'b' | string>, mixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>, namedMixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>): string
+  "examples": "
ts
literalUnionParamMethod(value: 'a' | 'b' | string, namedValue: 'a' | 'b' | string, array: readonly Array<'a' | 'b' | string>, namedArray: readonly Array<'a' | 'b' | string>, mixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>, namedMixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>): string
 
", "name": "literalUnionParamMethod", @@ -182,7 +179,6 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L155", - "title": "Literal Union Param Method", } `; @@ -192,7 +188,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = ` ", "description": "

Test with deprecated and see marker.

", - "examples": "
ts
faker.methodWithDeprecated(): number
+  "examples": "
ts
methodWithDeprecated(): number
 
", "name": "methodWithDeprecated", @@ -203,7 +199,6 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = ` ], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L273", - "title": "Method With Deprecated", } `; @@ -212,7 +207,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecatedOption 1`] = ` "deprecated": undefined, "description": "

Test with deprecated option.

", - "examples": "
ts
faker.methodWithDeprecatedOption(option: {
+  "examples": "
ts
methodWithDeprecatedOption(option: {
   a: string,
   b: () => number,
   c: number
@@ -256,7 +251,6 @@ exports[`signature > analyzeSignature() > methodWithDeprecatedOption 1`] = `
   "seeAlsos": [],
   "since": "",
   "sourcePath": "test/scripts/apidoc/signature.example.ts#L285",
-  "title": "Method With Deprecated Option",
 }
 `;
 
@@ -265,7 +259,7 @@ exports[`signature > analyzeSignature() > methodWithExample 1`] = `
   "deprecated": undefined,
   "description": "

Test with example marker.

", - "examples": "
ts
faker.methodWithExample(): number
+  "examples": "
ts
methodWithExample(): number
 test.apidoc.methodWithExample() // 0
 
", @@ -275,7 +269,6 @@ exports[`signature > analyzeSignature() > methodWithExample 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L262", - "title": "Method With Example", } `; @@ -284,7 +277,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = ` "deprecated": undefined, "description": "

Test with multiple see markers.

", - "examples": "
ts
faker.methodWithMultipleSeeMarkers(): number
+  "examples": "
ts
methodWithMultipleSeeMarkers(): number
 
", "name": "methodWithMultipleSeeMarkers", @@ -296,7 +289,6 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = ` ], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L312", - "title": "Method With Multiple See Markers", } `; @@ -305,7 +297,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic "deprecated": undefined, "description": "

Test with multiple see markers and backticks.

", - "examples": "
ts
faker.methodWithMultipleSeeMarkersAndBackticks(): number
+  "examples": "
ts
methodWithMultipleSeeMarkersAndBackticks(): number
 
", "name": "methodWithMultipleSeeMarkersAndBackticks", @@ -317,7 +309,6 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic ], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L322", - "title": "Method With Multiple See Markers And Backticks", } `; @@ -326,7 +317,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = ` "deprecated": undefined, "description": "

Test with since marker.

", - "examples": "
ts
faker.methodWithSinceMarker(): number
+  "examples": "
ts
methodWithSinceMarker(): number
 
", "name": "methodWithSinceMarker", @@ -335,7 +326,6 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = ` "seeAlsos": [], "since": "1.0.0", "sourcePath": "test/scripts/apidoc/signature.example.ts#L331", - "title": "Method With Since Marker", } `; @@ -344,7 +334,7 @@ exports[`signature > analyzeSignature() > multiParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with multiple parameters.

", - "examples": "
ts
faker.multiParamMethod(a: number, b?: string, c: boolean = true): number
+  "examples": "
ts
multiParamMethod(a: number, b?: string, c: boolean = true): number
 
", "name": "multiParamMethod", @@ -375,7 +365,6 @@ exports[`signature > analyzeSignature() > multiParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L112", - "title": "Multi Param Method", } `; @@ -384,7 +373,7 @@ exports[`signature > analyzeSignature() > noParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with no parameters.

", - "examples": "
ts
faker.noParamMethod(): number
+  "examples": "
ts
noParamMethod(): number
 
", "name": "noParamMethod", @@ -393,7 +382,6 @@ exports[`signature > analyzeSignature() > noParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L74", - "title": "No Param Method", } `; @@ -402,7 +390,7 @@ exports[`signature > analyzeSignature() > optionalStringParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with an optional parameter.

", - "examples": "
ts
faker.optionalStringParamMethod(b?: string): number
+  "examples": "
ts
optionalStringParamMethod(b?: string): number
 
", "name": "optionalStringParamMethod", @@ -419,7 +407,6 @@ exports[`signature > analyzeSignature() > optionalStringParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L92", - "title": "Optional String Param Method", } `; @@ -428,7 +415,7 @@ exports[`signature > analyzeSignature() > optionsInlineParamMethodWithDefaults 1 "deprecated": undefined, "description": "

Test with a function parameters (inline types) with defaults.

", - "examples": "
ts
faker.optionsInlineParamMethodWithDefaults(a: {
+  "examples": "
ts
optionsInlineParamMethodWithDefaults(a: {
   value: number
 } = { value: 1 }, b: {
   value: number
@@ -488,7 +475,6 @@ It also has a more complex description.

"seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L212", - "title": "Options Inline Param Method With Defaults", } `; @@ -497,7 +483,7 @@ exports[`signature > analyzeSignature() > optionsInterfaceParamMethodWithDefault "deprecated": undefined, "description": "

Test with a function parameters with defaults.

", - "examples": "
ts
faker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number
+  "examples": "
ts
optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number
 
", "name": "optionsInterfaceParamMethodWithDefaults", @@ -528,7 +514,6 @@ exports[`signature > analyzeSignature() > optionsInterfaceParamMethodWithDefault "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L248", - "title": "Options Interface Param Method With Defaults", } `; @@ -537,7 +522,7 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with a function parameters.

", - "examples": "
ts
faker.optionsParamMethod(options: {
+  "examples": "
ts
optionsParamMethod(options: {
   a: number,
   b: string,
   c: boolean,
@@ -595,7 +580,6 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = `
   "seeAlsos": [],
   "since": "",
   "sourcePath": "test/scripts/apidoc/signature.example.ts#L182",
-  "title": "Options Param Method",
 }
 `;
 
@@ -604,7 +588,7 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`]
   "deprecated": undefined,
   "description": "

Test with a function parameters with defaults.

", - "examples": "
ts
faker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number
+  "examples": "
ts
optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number
 
", "name": "optionsTypeParamMethodWithDefaults", @@ -635,7 +619,6 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`] "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L230", - "title": "Options Type Param Method With Defaults", } `; @@ -644,7 +627,7 @@ exports[`signature > analyzeSignature() > requiredNumberParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with a required parameter.

", - "examples": "
ts
faker.requiredNumberParamMethod(a: number): number
+  "examples": "
ts
requiredNumberParamMethod(a: number): number
 
", "name": "requiredNumberParamMethod", @@ -661,7 +644,6 @@ exports[`signature > analyzeSignature() > requiredNumberParamMethod 1`] = ` "seeAlsos": [], "since": "", "sourcePath": "test/scripts/apidoc/signature.example.ts#L83", - "title": "Required Number Param Method", } `; @@ -670,7 +652,7 @@ exports[`signature > analyzeSignature() > stringUnionParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with string union.

", - "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b', options?: {
+  "examples": "
ts
stringUnionParamMethod(value: 'a' | 'b', options?: {
   casing: 'lower' | 'mixed' | 'upper',
   excludes: readonly AlphaNumericChar[],
   format: 'binary' | 'css' | 'decimal' | 'hex'
@@ -719,6 +701,5 @@ exports[`signature > analyzeSignature() > stringUnionParamMethod 1`] = `
   "seeAlsos": [],
   "since": "",
   "sourcePath": "test/scripts/apidoc/signature.example.ts#L134",
-  "title": "String Union Param Method",
 }
 `;
diff --git a/test/scripts/apidoc/signature.debug.ts b/test/scripts/apidoc/signature.debug.ts
index 6be0e49fd0c..0076dfa74e3 100644
--- a/test/scripts/apidoc/signature.debug.ts
+++ b/test/scripts/apidoc/signature.debug.ts
@@ -16,7 +16,7 @@ initMarkdownRenderer()
   .then(() => {
     Object.entries(methods).forEach(([name, method]) => {
       console.log('Analyzing: ', name);
-      const result = analyzeSignature(method, null, method.name);
+      const result = analyzeSignature(method, '', method.name);
       console.log('Result: ', result);
     });
   })
diff --git a/test/scripts/apidoc/signature.spec.ts b/test/scripts/apidoc/signature.spec.ts
index d90370a27c2..3a48c29b7dd 100644
--- a/test/scripts/apidoc/signature.spec.ts
+++ b/test/scripts/apidoc/signature.spec.ts
@@ -23,7 +23,7 @@ describe('signature', () => {
     });
 
     it.each(Object.entries(methods))('%s', (name, signature) => {
-      const actual = analyzeSignature(signature, null, name);
+      const actual = analyzeSignature(signature, '', name);
 
       expect(actual).toMatchSnapshot();
     });
diff --git a/test/scripts/apidoc/verify-jsdoc-tags.spec.ts b/test/scripts/apidoc/verify-jsdoc-tags.spec.ts
index 410bffc206d..68692fabc7a 100644
--- a/test/scripts/apidoc/verify-jsdoc-tags.spec.ts
+++ b/test/scripts/apidoc/verify-jsdoc-tags.spec.ts
@@ -109,18 +109,18 @@ describe('verify JSDoc tags', () => {
         });
 
         it('verify @param tags', () => {
-          analyzeSignature(
-            signature,
-            moduleName,
-            methodName
-          ).parameters.forEach((param) => {
-            const { name, description } = param;
-            const plainDescription = description.replace(/<[^>]+>/g, '').trim();
-            expect(
-              plainDescription,
-              `Expect param ${name} to have a description`
-            ).not.toBe(MISSING_DESCRIPTION);
-          });
+          analyzeSignature(signature, '', methodName).parameters.forEach(
+            (param) => {
+              const { name, description } = param;
+              const plainDescription = description
+                .replace(/<[^>]+>/g, '')
+                .trim();
+              expect(
+                plainDescription,
+                `Expect param ${name} to have a description`
+              ).not.toBe(MISSING_DESCRIPTION);
+            }
+          );
         });
 
         it('verify @see tags', () => {