Skip to content

Commit

Permalink
Merge branch 'next' into feat/adds-support-for-ulid-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Sep 16, 2024
2 parents 8f9aecc + 48f171e commit 8acad7a
Show file tree
Hide file tree
Showing 15 changed files with 606 additions and 480 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "FakerJs",
"image": "mcr.microsoft.com/devcontainers/typescript-node:22@sha256:bac061bcdaed47c16949eaf1b1315cc69ba5e372911e77d6cdfdc5843c1c012c",
"image": "mcr.microsoft.com/devcontainers/typescript-node:22@sha256:34a8d83d38c96b2b59e42d522f09313b02223185896d52b07d9c3e8ba2b6266f",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"eslint.options": {
"flags": ["unstable_ts_config"]
},
// Enable eslint validation for js and ts files
"eslint.validate": ["javascript", "typescript"],

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Thanks to all the people who already contributed to Faker!

<a href="https://github.com/faker-js/faker/graphs/contributors"><img src="https://opencollective.com/fakerjs/contributors.svg?width=800" /></a>

The [fakerjs.dev](https://fakerjs.dev) website is kindly hosted by the Netlify Team. Also the search functionality is powered by [algolia](https://www.algolia.com).
The [fakerjs.dev](https://fakerjs.dev) website is generously hosted by [Netlify](https://www.netlify.com/), with search functionality powered by [Algolia](https://www.algolia.com/).

## 📝 Changelog

Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useElementSize } from '@vueuse/core';
import { ref, watchEffect } from 'vue';
defineProps<{
const { version } = defineProps<{
version: string;
}>();
Expand Down
17 changes: 10 additions & 7 deletions docs/.vitepress/components/api-docs/method-parameters.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ApiDocsMethodParameter } from './method';
const props = defineProps<{ parameters: ApiDocsMethodParameter[] }>();
const { parameters } = defineProps<{ parameters: ApiDocsMethodParameter[] }>();
</script>

<template>
Expand All @@ -18,19 +18,22 @@ const props = defineProps<{ parameters: ApiDocsMethodParameter[] }>();
</tr>
</thead>
<tbody>
<tr v-for="parameter of props.parameters" :key="parameter.name">
<tr
v-for="{ name, description, type, default: def } of parameters"
:key="name"
>
<td
:class="{
deprecated: parameter.description.includes('DEPRECATED'),
deprecated: description.includes('DEPRECATED'),
}"
>
{{ parameter.name }}
{{ name }}
</td>
<td>{{ parameter.type }}</td>
<td>{{ type }}</td>
<td>
<code v-if="parameter.default">{{ parameter.default }}</code>
<code v-if="def">{{ def }}</code>
</td>
<td v-html="parameter.description"></td>
<td v-html="description"></td>
</tr>
</tbody>
</table>
Expand Down
57 changes: 33 additions & 24 deletions docs/.vitepress/components/api-docs/method.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,60 @@ import { slugify } from '../../shared/utils/slugify';
import type { ApiDocsMethod } from './method';
import MethodParameters from './method-parameters.vue';
const props = defineProps<{ method: ApiDocsMethod }>();
const { method } = defineProps<{ method: ApiDocsMethod }>();
const {
deprecated,
description,
since,
parameters,
returns,
throws,
signature,
examples,
seeAlsos,
sourcePath,
} = method;
function seeAlsoToUrl(see: string): string {
const [, module, method] = see.replace(/\(.*/, '').split('\.');
if (!method) {
return 'faker.html#' + slugify(module);
const [, module, methodName] = see.replace(/\(.*/, '').split('\.');
if (!methodName) {
return `faker.html#${slugify(module)}`;
}
return module + '.html#' + slugify(method);
return `${module}.html#${slugify(methodName)}`;
}
</script>

<template>
<div>
<div v-if="props.method.deprecated" class="warning custom-block">
<div v-if="deprecated" class="warning custom-block">
<p class="custom-block-title">Deprecated</p>
<p>This method is deprecated and will be removed in a future version.</p>
<span v-html="props.method.deprecated" />
<span v-html="deprecated" />
</div>

<div v-html="props.method.description"></div>
<div v-html="description"></div>

<p v-if="props.method.since">
<em>Available since v{{ props.method.since }}</em>
<p v-if="since">
<em>Available since v{{ since }}</em>
</p>

<MethodParameters
v-if="props.method.parameters.length > 0"
:parameters="props.method.parameters"
/>
<MethodParameters v-if="parameters.length > 0" :parameters="parameters" />

<p><strong>Returns:</strong> {{ props.method.returns }}</p>
<p><strong>Returns:</strong> {{ returns }}</p>

<p v-if="props.method.throws">
<strong>Throws:</strong> <span v-html="props.method.throws" />
</p>
<p v-if="throws"><strong>Throws:</strong> <span v-html="throws" /></p>

<div v-html="props.method.signature" />
<div v-html="signature" />

<h3>Examples</h3>
<div v-html="props.method.examples" />
<div v-html="examples" />

<div v-if="props.method.seeAlsos.length > 0">
<div v-if="seeAlsos.length > 0">
<h3>See Also</h3>
<ul>
<li v-for="seeAlso of props.method.seeAlsos" :key="seeAlso">
<li v-for="seeAlso of seeAlsos" :key="seeAlso">
<a
v-if="seeAlso.startsWith('faker.')"
:href="seeAlsoToUrl(seeAlso)"
Expand All @@ -59,12 +68,12 @@ function seeAlsoToUrl(see: string): string {
</ul>
</div>

<div v-if="props.method.sourcePath">
<div v-if="sourcePath">
<h3>Source</h3>
<ul>
<li>
<a
:href="sourceBaseUrl + props.method.sourcePath"
:href="sourceBaseUrl + sourcePath"
target="_blank"
class="source-link"
>
Expand Down
6 changes: 3 additions & 3 deletions eslint.config.js → eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { includeIgnoreFile } from '@eslint/compat';
import eslint from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
Expand All @@ -15,7 +13,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const gitignorePath = resolve(__dirname, '.gitignore');

export default tseslint.config(
const config: ReturnType<typeof tseslint.config> = tseslint.config(
//#region global
includeIgnoreFile(gitignorePath),
{
Expand Down Expand Up @@ -260,3 +258,5 @@ export default tseslint.config(
}
//#endregion
);

export default config;
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"docs:serve": "vitepress serve docs --port 5173",
"docs:diff": "tsx ./scripts/diff.ts",
"format": "prettier --cache --write .",
"lint": "eslint --cache --cache-strategy content .",
"lint": "eslint --cache --cache-strategy content --flag unstable_ts_config .",
"ts-check": "tsc",
"test": "vitest",
"test:update-snapshots": "vitest run -u",
Expand Down Expand Up @@ -105,22 +105,18 @@
"devDependencies": {
"@actions/github": "6.0.0",
"@algolia/client-search": "5.4.1",
"@eslint-types/deprecation": "2.0.0-1",
"@eslint-types/jsdoc": "48.2.2",
"@eslint-types/prettier": "5.1.3",
"@eslint-types/typescript-eslint": "7.5.0",
"@eslint-types/unicorn": "52.0.0",
"@eslint/compat": "1.1.1",
"@eslint/js": "9.10.0",
"@stylistic/eslint-plugin": "2.8.0",
"@types/eslint__js": "8.42.3",
"@types/node": "20.16.5",
"@types/sanitize-html": "2.13.0",
"@types/semver": "7.5.8",
"@types/validator": "13.12.1",
"@vitest/coverage-v8": "2.0.5",
"@vitest/ui": "2.0.5",
"@vitest/coverage-v8": "2.1.1",
"@vitest/ui": "2.1.1",
"@vueuse/core": "10.11.1",
"commit-and-tag-version": "12.4.3",
"commit-and-tag-version": "12.4.4",
"cypress": "13.14.2",
"eslint": "9.10.0",
"eslint-config-prettier": "9.1.0",
Expand All @@ -129,6 +125,7 @@
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-unicorn": "55.0.0",
"eslint-plugin-vitest": "0.5.4",
"jiti": "1.21.6",
"npm-run-all2": "6.2.3",
"prettier": "3.3.3",
"prettier-plugin-organize-imports": "4.0.0",
Expand All @@ -139,16 +136,16 @@
"ts-morph": "23.0.0",
"tsup": "8.2.4",
"tsx": "4.19.1",
"typescript": "5.5.4",
"typescript": "5.6.2",
"typescript-eslint": "8.5.0",
"validator": "13.12.0",
"vite": "5.4.5",
"vitepress": "1.3.4",
"vitest": "2.0.5",
"vue": "3.5.5",
"vitest": "2.1.1",
"vue": "3.5.6",
"vue-tsc": "2.1.6"
},
"packageManager": "pnpm@9.9.0",
"packageManager": "pnpm@9.10.0",
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0"
Expand Down
Loading

0 comments on commit 8acad7a

Please sign in to comment.