Skip to content

Commit f3738a5

Browse files
authored
Merge branch 'next' into infra/unicorn/numeric-separators-style
2 parents 37e1d1c + a082ed2 commit f3738a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+958
-349
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
33
{
44
"name": "FakerJs",
5-
"image": "mcr.microsoft.com/devcontainers/typescript-node:20@sha256:173debabac3a927225aac3fa451dfd1baa780d5fb8f8e513b1efc615e3221225",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:22@sha256:52f2401bd5937985be000f34bb33bb3a3a47bd20249d91bc787d8f00eba220e9",
66

77
// Features to add to the dev container. More info: https://containers.dev/features.
88
// "features": {},

.eslintrc.cjs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports = defineConfig({
3939
'prefer-exponentiation-operator': 'error',
4040
'prefer-template': 'error',
4141

42+
'unicorn/import-style': 'off', // subjective & doesn't do anything for us
4243
'unicorn/no-array-callback-reference': 'off', // reduces readability
4344
'unicorn/no-nested-ternary': 'off', // incompatible with prettier
4445
'unicorn/no-null': 'off', // incompatible with TypeScript
@@ -50,7 +51,6 @@ module.exports = defineConfig({
5051
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
5152
'unicorn/better-regex': 'off',
5253
'unicorn/consistent-function-scoping': 'off',
53-
'unicorn/import-style': 'off',
5454
'unicorn/no-object-as-default-parameter': 'off',
5555
'unicorn/prefer-export-from': 'off',
5656
'unicorn/prefer-string-slice': 'off',
@@ -79,6 +79,12 @@ module.exports = defineConfig({
7979
trailingUnderscore: 'forbid',
8080
},
8181
],
82+
'@typescript-eslint/no-confusing-void-expression': [
83+
'error',
84+
{
85+
ignoreArrowShorthand: true,
86+
},
87+
],
8288
'@typescript-eslint/no-inferrable-types': [
8389
'error',
8490
{ ignoreParameters: true },
@@ -113,10 +119,6 @@ module.exports = defineConfig({
113119
'@typescript-eslint/unbound-method': 'off',
114120
'@typescript-eslint/unified-signatures': 'off', // incompatible with our api docs generation
115121

116-
// TODO @ST-DDT 2023-10-10: The following rules currently conflict with our code.
117-
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
118-
'@typescript-eslint/no-confusing-void-expression': 'off',
119-
120122
'jsdoc/require-jsdoc': 'off', // Enabled only for src/**/*.ts
121123
'jsdoc/require-returns': 'off',
122124
'jsdoc/sort-tags': [
@@ -163,12 +165,6 @@ module.exports = defineConfig({
163165
'error',
164166
{
165167
case: 'snakeCase',
166-
// TODO @ST-DDT 2023-10-21: rename the definitions in v9
167-
ignore: [
168-
/chemicalElement\.ts$/,
169-
/directoryPaths\.ts$/,
170-
/mimeTypes\.ts$/,
171-
],
172168
},
173169
],
174170
'unicorn/text-encoding-identifier-case': 'off',

.github/workflows/ci.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
node_version: [18, 20]
18+
node_version: [18, 20, 22]
1919
fail-fast: false
2020
timeout-minutes: 10
2121

2222
name: 'Build & Unit Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
25+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
2626
with:
2727
# Required for docs/versions tests
2828
fetch-depth: 0
@@ -70,7 +70,7 @@ jobs:
7070
run: date
7171

7272
- name: Checkout
73-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
73+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
7474
with:
7575
# Required for docs/versions tests
7676
fetch-depth: 0
@@ -104,7 +104,7 @@ jobs:
104104
name: 'E2E Doc Test: node-20, ubuntu-latest'
105105
steps:
106106
- name: Checkout
107-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
107+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
108108

109109
- name: Install pnpm
110110
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
@@ -122,20 +122,20 @@ jobs:
122122
lint:
123123
runs-on: ubuntu-latest
124124
timeout-minutes: 10
125-
name: 'Lint: node-20, ubuntu-latest'
125+
name: 'Lint: node-22, ubuntu-latest'
126126
steps:
127127
- name: Checkout
128-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
128+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
129129
with:
130130
fetch-depth: 0
131131

132132
- name: Install pnpm
133133
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
134134

135-
- name: Set node version to 20
135+
- name: Set node version to 22
136136
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
137137
with:
138-
node-version: 20
138+
node-version: 22
139139
cache: 'pnpm'
140140

141141
- name: Install deps
@@ -152,20 +152,20 @@ jobs:
152152
ts-check:
153153
runs-on: ubuntu-latest
154154
timeout-minutes: 10
155-
name: 'TS-Check: node-20, ubuntu-latest'
155+
name: 'TS-Check: node-22, ubuntu-latest'
156156
steps:
157157
- name: Checkout
158-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
158+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
159159
with:
160160
fetch-depth: 0
161161

162162
- name: Install pnpm
163163
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
164164

165-
- name: Set node version to 20
165+
- name: Set node version to 22
166166
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
167167
with:
168-
node-version: 20
168+
node-version: 22
169169
cache: 'pnpm'
170170

171171
- name: Install deps
@@ -182,20 +182,20 @@ jobs:
182182
codecov:
183183
runs-on: ubuntu-latest
184184
timeout-minutes: 10
185-
name: 'Codecov: node-20, ubuntu-latest'
185+
name: 'Codecov: node-22, ubuntu-latest'
186186
steps:
187187
- name: Checkout
188-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
188+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
189189
with:
190190
fetch-depth: 0
191191

192192
- name: Install pnpm
193193
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
194194

195-
- name: Set node version to 20
195+
- name: Set node version to 22
196196
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
197197
with:
198-
node-version: 20
198+
node-version: 22
199199
cache: 'pnpm'
200200

201201
- name: Install deps
@@ -210,7 +210,7 @@ jobs:
210210
run: pnpm vitest run --coverage
211211

212212
- name: Upload coverage to Codecov
213-
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4.3.1
213+
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
214214
with:
215215
token: ${{ secrets.CODECOV_TOKEN }}
216216
fail_ci_if_error: true

.github/workflows/pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ jobs:
1010
check-code-generation:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 10
13-
name: 'Check Code Generation: node-20, ubuntu-latest'
13+
name: 'Check Code Generation: node-22, ubuntu-latest'
1414
permissions:
1515
pull-requests: write
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
18+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
1919
with:
2020
fetch-depth: 0
2121

2222
- name: Install pnpm
2323
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
2424

25-
- name: Set node version to 20
25+
- name: Set node version to 22
2626
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2727
with:
28-
node-version: 20
28+
node-version: 22
2929
cache: 'pnpm'
3030

3131
- name: Install deps

docs/guide/upgrading.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,28 @@ Renamed deprecated locale aliases `cz`, `en_IND`, `ge` and removed `global`.
480480
| `import { faker } from '@faker-js/faker/locale/ge'` | `import { faker } from '@faker-js/faker/locale/ka_GE'` |
481481
| `import { faker } from '@faker-js/faker/locale/global'` | `import { faker } from '@faker-js/faker/locale/base'` |
482482

483+
### Renamed Locale Definitions
484+
485+
The following locale definitions have been renamed
486+
487+
| old | replacement |
488+
| ------------------------------------------- | -------------------------------------------- |
489+
| `faker.definitions.science.chemicalElement` | `faker.definitions.science.chemical_element` |
490+
| `faker.definitions.system.directoryPaths` | `faker.definitions.system.directory_paths` |
491+
| `faker.definitions.system.mimeTypes` | `faker.definitions.system.mime_types` |
492+
493+
With that now all our locale data use the following naming scheme:
494+
495+
```txt
496+
faker.definitions.category_name.entry_name
497+
```
498+
499+
Please keep in mind that property keys of complex objects remain in camel-case.
500+
501+
```txt
502+
faker.definitions.science.chemical_element.atomicNumber
503+
```
504+
483505
### Type Aliases
484506

485507
Removed deprecated type aliases

docs/guide/usage.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,22 @@ const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
2626

2727
:::
2828

29-
For more information about changing and customizing the locales, please refer to our [Localization Guide](localization).
29+
For more information on selecting and customizing a locale, please refer to our [Localization Guide](localization).
3030

3131
## Browser
3232

33+
If you want to try it yourself, you can open your browser console via `Ctrl + Shift + J` / `F12`.
34+
35+
```js
36+
const { faker } = await import('https://esm.sh/@faker-js/faker');
37+
38+
const randomName = faker.person.fullName(); // Amber Keebler
39+
const randomEmail = faker.internet.email(); // Norma13@hotmail.com
40+
```
41+
42+
Some websites may have protections against downloading external code, dev servers usually work fine.
43+
As an alternative, you can create a simple html file and open it with your browser:
44+
3345
```html
3446
<script type="module">
3547
import { faker } from 'https://esm.sh/@faker-js/faker';
@@ -39,11 +51,17 @@ For more information about changing and customizing the locales, please refer to
3951
4052
// Rusty@arne.info
4153
const randomEmail = faker.internet.email();
54+
55+
document.getElementById('name').value = randomName;
56+
document.getElementById('email').value = randomEmail;
4257
</script>
58+
59+
<input id="name" />
60+
<input id="email" />
4361
```
4462

4563
::: info Note
46-
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.**
64+
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 package in your web app.**
4765
:::
4866

4967
## CDN/Deno
@@ -56,7 +74,7 @@ const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com
5674
```
5775

5876
::: info Note
59-
It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://esm.sh/@faker-js/faker@v8.4.0"`.
77+
It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://esm.sh/@faker-js/faker@v8.4.1"`.
6078
:::
6179

6280
### Alternative CDN links

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"@eslint-types/prettier": "5.1.3",
9898
"@eslint-types/typescript-eslint": "7.5.0",
9999
"@eslint-types/unicorn": "52.0.0",
100-
"@types/node": "20.12.11",
100+
"@types/node": "20.12.12",
101101
"@types/sanitize-html": "2.11.0",
102102
"@types/semver": "7.5.8",
103103
"@types/validator": "13.11.10",
@@ -106,7 +106,7 @@
106106
"@vitest/coverage-v8": "1.6.0",
107107
"@vitest/ui": "1.6.0",
108108
"@vueuse/core": "10.9.0",
109-
"cypress": "13.9.0",
109+
"cypress": "13.10.0",
110110
"eslint": "8.57.0",
111111
"eslint-config-prettier": "9.1.0",
112112
"eslint-define-config": "2.1.0",
@@ -116,7 +116,7 @@
116116
"eslint-plugin-prettier": "5.1.3",
117117
"eslint-plugin-unicorn": "52.0.0",
118118
"eslint-plugin-vitest": "0.4.1",
119-
"npm-run-all2": "6.1.2",
119+
"npm-run-all2": "6.2.0",
120120
"prettier": "3.2.5",
121121
"prettier-plugin-organize-imports": "3.2.4",
122122
"rimraf": "5.0.7",
@@ -125,15 +125,15 @@
125125
"commit-and-tag-version": "12.4.1",
126126
"ts-morph": "22.0.0",
127127
"tsup": "8.0.2",
128-
"tsx": "4.10.1",
128+
"tsx": "4.11.0",
129129
"typescript": "5.4.5",
130130
"validator": "13.12.0",
131131
"vite": "5.2.11",
132-
"vitepress": "1.2.0",
132+
"vitepress": "1.2.2",
133133
"vitest": "1.6.0",
134134
"vue": "3.4.27"
135135
},
136-
"packageManager": "pnpm@9.1.1",
136+
"packageManager": "pnpm@9.1.2",
137137
"engines": {
138138
"node": ">=18.0.0",
139139
"npm": ">=9.0.0"

0 commit comments

Comments
 (0)