Skip to content

Commit 22663b9

Browse files
committed
Merge branch 'next' into refactor/flatten-jobs-definitions
# Conflicts: # src/locales/en/person/index.ts # src/locales/es/person/index.ts # src/locales/fr/person/index.ts # src/locales/fr/person/title.ts # src/modules/person/index.ts # test/all-functional.spec.ts
2 parents f43503a + 394d58f commit 22663b9

File tree

210 files changed

+4259
-8162
lines changed

Some content is hidden

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

210 files changed

+4259
-8162
lines changed

.eslintrc.js

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
const { defineConfig } = require('eslint-define-config');
33
const { readGitignoreFiles } = require('eslint-gitignore');
44

5+
/// <reference types="@eslint-types/deprecation" />
6+
/// <reference types="@eslint-types/jsdoc" />
7+
/// <reference types="@eslint-types/prettier" />
8+
/// <reference types="@eslint-types/typescript-eslint" />
9+
/// <reference types="@eslint-types/unicorn" />
10+
511
module.exports = defineConfig({
612
ignorePatterns: [
713
...readGitignoreFiles(),
@@ -15,7 +21,7 @@ module.exports = defineConfig({
1521
reportUnusedDisableDirectives: true,
1622
extends: [
1723
'eslint:recommended',
18-
'plugin:@typescript-eslint/recommended-type-checked',
24+
'plugin:@typescript-eslint/strict-type-checked',
1925
'plugin:prettier/recommended',
2026
'plugin:deprecation/recommended',
2127
'plugin:jsdoc/recommended-typescript-error',
@@ -29,6 +35,7 @@ module.exports = defineConfig({
2935
eqeqeq: ['error', 'always', { null: 'ignore' }],
3036
'no-else-return': 'error',
3137
'no-restricted-globals': ['error', 'Intl'],
38+
'prefer-exponentiation-operator': 'error',
3239
'prefer-template': 'error',
3340

3441
'unicorn/no-nested-ternary': 'off', // incompatible with prettier
@@ -41,26 +48,21 @@ module.exports = defineConfig({
4148
'unicorn/prefer-at': 'off',
4249
// TODO @Shinigami92 2023-09-23: prefer-string-replace-all should be turned on when we drop support for Node 14.
4350
'unicorn/prefer-string-replace-all': 'off',
51+
// TODO @ST-DDT 2023-10-28: The following rule should be turned on when we switch to esm.
52+
'unicorn/prefer-top-level-await': 'off',
4453

4554
// TODO @Shinigami92 2023-09-23: The following rules currently conflict with our code.
4655
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
4756
'unicorn/better-regex': 'off',
4857
'unicorn/consistent-function-scoping': 'off',
49-
'unicorn/filename-case': 'off',
5058
'unicorn/import-style': 'off',
5159
'unicorn/no-array-callback-reference': 'off',
52-
'unicorn/no-array-reduce': 'off',
5360
'unicorn/no-await-expression-member': 'off',
54-
'unicorn/no-negated-condition': 'off',
5561
'unicorn/no-object-as-default-parameter': 'off',
5662
'unicorn/no-useless-switch-case': 'off',
5763
'unicorn/numeric-separators-style': 'off',
58-
'unicorn/prefer-code-point': 'off',
5964
'unicorn/prefer-export-from': 'off',
60-
'unicorn/prefer-module': 'off',
61-
'unicorn/prefer-negative-index': 'off',
6265
'unicorn/prefer-string-slice': 'off',
63-
'unicorn/prefer-top-level-await': 'off',
6466
'unicorn/prevent-abbreviations': 'off',
6567
'unicorn/require-array-join-separator': 'off',
6668
'unicorn/switch-case-braces': 'off',
@@ -91,6 +93,7 @@ module.exports = defineConfig({
9193
'error',
9294
{ ignoreParameters: true },
9395
],
96+
'@typescript-eslint/no-unnecessary-condition': 'off', // requires `strictNullChecks` to be enabled
9497
'@typescript-eslint/no-unsafe-assignment': 'off',
9598
'@typescript-eslint/no-unsafe-call': 'off',
9699
'@typescript-eslint/no-unsafe-member-access': 'off',
@@ -103,7 +106,16 @@ module.exports = defineConfig({
103106
'error',
104107
{ allowNumber: true, allowBoolean: true },
105108
],
109+
'@typescript-eslint/switch-exhaustiveness-check': [
110+
'error',
111+
{ requireDefaultForNonUnion: true },
112+
],
106113
'@typescript-eslint/unbound-method': 'off',
114+
'@typescript-eslint/unified-signatures': 'off', // incompatible with our api docs generation
115+
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',
107119

108120
'jsdoc/require-jsdoc': 'off', // Enabled only for src/**/*.ts
109121
'jsdoc/require-returns': 'off',
@@ -139,8 +151,26 @@ module.exports = defineConfig({
139151
},
140152
},
141153
{
142-
files: ['src/locales/**/*.ts'],
154+
files: ['src/locale/**/*.ts'],
143155
rules: {
156+
'unicorn/filename-case': 'off', // our locale files have a custom naming scheme
157+
},
158+
},
159+
{
160+
files: ['src/definitions/**/*.ts', 'src/locales/**/*.ts'],
161+
rules: {
162+
'unicorn/filename-case': [
163+
'error',
164+
{
165+
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+
],
172+
},
173+
],
144174
'unicorn/text-encoding-identifier-case': 'off',
145175
},
146176
},

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
5252

5353
- name: Set node version to ${{ matrix.node_version }}
54-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
54+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
5555
with:
5656
node-version: ${{ matrix.node_version }}
5757
cache: 'pnpm'
@@ -99,7 +99,7 @@ jobs:
9999
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
100100

101101
- name: Set node version to ${{ matrix.node_version }}
102-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
102+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
103103
with:
104104
node-version: ${{ matrix.node_version }}
105105
cache: 'pnpm'
@@ -153,7 +153,7 @@ jobs:
153153
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
154154

155155
- name: Set node version to 20
156-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
156+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
157157
with:
158158
node-version: 20
159159
cache: 'pnpm'
@@ -183,7 +183,7 @@ jobs:
183183
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
184184

185185
- name: Set node version to 20
186-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
186+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
187187
with:
188188
node-version: 20
189189
cache: 'pnpm'
@@ -210,7 +210,7 @@ jobs:
210210
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
211211

212212
- name: Set node version to 20
213-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
213+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
214214
with:
215215
node-version: 20
216216
cache: 'pnpm'

.github/workflows/comment-issue.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
issues: write
1414
steps:
1515
- name: Add Comment For User Interest
16-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
16+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
1717
with:
1818
script: |
1919
github.rest.issues.createComment({
@@ -49,7 +49,7 @@ jobs:
4949
})
5050
5151
- name: React to Issue
52-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
52+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5353
with:
5454
script: |
5555
github.rest.reactions.createForIssue({

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
2424

2525
- name: Set node version to 20
26-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
26+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
2727
with:
2828
node-version: 20
2929
cache: 'pnpm'
@@ -53,7 +53,7 @@ jobs:
5353
run: pnpm exec tsc .github/workflows/commentCodeGeneration.ts --outDir .github/workflows
5454

5555
- name: Comment
56-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
56+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5757
with:
5858
script: |
5959
const script = require('${{ github.workspace }}/.github/workflows/commentCodeGeneration.js')

.prettierrc.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { Options } from 'prettier';
2+
3+
declare const options: Options;
4+
export = options;

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [8.3.1](https://github.com/faker-js/faker/compare/v8.3.0...v8.3.1) (2023-11-14)
6+
7+
8+
### Bug Fixes
9+
10+
* remove `[@internal](https://github.com/internal)` from module parent classes ([#2548](https://github.com/faker-js/faker/issues/2548)) ([77f54ad](https://github.com/faker-js/faker/commit/77f54ad78f9d7952b3b315f72878267f18ed1e69))
11+
12+
## [8.3.0](https://github.com/faker-js/faker/compare/v8.2.0...v8.3.0) (2023-11-14)
13+
14+
15+
### Features
16+
17+
* **person:** use fake patterns for jobTitle ([#2528](https://github.com/faker-js/faker/issues/2528)) ([b40ad45](https://github.com/faker-js/faker/commit/b40ad45ad3cca6769968a63264e6d925bf4b328a))
18+
19+
20+
### Bug Fixes
21+
22+
* **date:** ensures correct range for birthdate ([#2535](https://github.com/faker-js/faker/issues/2535)) ([7ce8c28](https://github.com/faker-js/faker/commit/7ce8c285cb5b2d13e95a17be78ecbd52f3c7d9db))
23+
* **finance:** maskedNumber has incorrect defaults ([#2494](https://github.com/faker-js/faker/issues/2494)) ([e0ba50b](https://github.com/faker-js/faker/commit/e0ba50b37e438503ed1899bff35afc92b4f8f49c))
24+
* **locale:** improve Swedish phone numbers format ([#2520](https://github.com/faker-js/faker/issues/2520)) ([e4865df](https://github.com/faker-js/faker/commit/e4865df199359797397cc3c5455f3a1a9c179f93))
25+
26+
27+
### Changed Locales
28+
29+
* **locale:** remove fr_CH data which is identical to fr ([#2526](https://github.com/faker-js/faker/issues/2526)) ([fafcba4](https://github.com/faker-js/faker/commit/fafcba473f8a91eeb8230ebdc1ad5039b25091e1))
30+
31+
32+
### New Locales
33+
34+
* **locale:** add person to fr_SN ([#2537](https://github.com/faker-js/faker/issues/2537)) ([ef965da](https://github.com/faker-js/faker/commit/ef965da48a8089e6bb19bcf260bfcd8af1a43799))
35+
* **locale:** add Senegal locale ([#2525](https://github.com/faker-js/faker/issues/2525)) ([6df70bc](https://github.com/faker-js/faker/commit/6df70bce16500ab74a37f932f2e17a08f297430b))
36+
* **locale:** add streets to location fr_SN ([#2536](https://github.com/faker-js/faker/issues/2536)) ([36fc517](https://github.com/faker-js/faker/commit/36fc517d17591c8ea1d5135d9a93c7591e3d1f74))
37+
* **locale:** and location to fr_SN ([#2533](https://github.com/faker-js/faker/issues/2533)) ([f730125](https://github.com/faker-js/faker/commit/f730125ffb941fe936d6a18c775cbe3a99b312dc))
38+
539
## [8.2.0](https://github.com/faker-js/faker/compare/v8.1.0...v8.2.0) (2023-10-14)
640

741

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Faker - Copyright (c) 2022-2023
1+
Faker - Copyright (c) 2022-2024
22

33
This software consists of voluntary contributions made by many individuals.
44
For exact contribution history, see the revision history

cypress/e2e/api.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('API Test', () => {
3434
cy.get('.api-group li').each(($el) => {
3535
const anchor = $el.find('a');
3636
const text = anchor.text();
37-
const link = anchor.attr('href').split('#')[0];
37+
const link = anchor.attr('href')?.split('#')[0] ?? 'MISSING';
3838
if (checked.has(link)) {
3939
return;
4040
}

docs/.vitepress/api-pages.ts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,37 @@ export const apiPages = [
44
{ text: 'Overview', link: '/api/' },
55
{ text: 'Faker', link: '/api/faker.html' },
66
{ text: 'SimpleFaker', link: '/api/simpleFaker.html' },
7-
{ text: 'Airline', link: '/api/airline.html' },
8-
{ text: 'Animal', link: '/api/animal.html' },
9-
{ text: 'Color', link: '/api/color.html' },
10-
{ text: 'Commerce', link: '/api/commerce.html' },
11-
{ text: 'Company', link: '/api/company.html' },
12-
{ text: 'Database', link: '/api/database.html' },
13-
{ text: 'Datatype', link: '/api/datatype.html' },
14-
{ text: 'Date', link: '/api/date.html' },
15-
{ text: 'Finance', link: '/api/finance.html' },
16-
{ text: 'Git', link: '/api/git.html' },
17-
{ text: 'Hacker', link: '/api/hacker.html' },
18-
{ text: 'Helpers', link: '/api/helpers.html' },
19-
{ text: 'Image', link: '/api/image.html' },
20-
{ text: 'Internet', link: '/api/internet.html' },
21-
{ text: 'Location', link: '/api/location.html' },
22-
{ text: 'Lorem', link: '/api/lorem.html' },
23-
{ text: 'Music', link: '/api/music.html' },
24-
{ text: 'Number', link: '/api/number.html' },
25-
{ text: 'Person', link: '/api/person.html' },
26-
{ text: 'Phone', link: '/api/phone.html' },
27-
{ text: 'Random', link: '/api/random.html' },
28-
{ text: 'Science', link: '/api/science.html' },
29-
{ text: 'String', link: '/api/string.html' },
30-
{ text: 'System', link: '/api/system.html' },
31-
{ text: 'Vehicle', link: '/api/vehicle.html' },
32-
{ text: 'Word', link: '/api/word.html' },
337
{ text: 'Randomizer', link: '/api/randomizer.html' },
348
{ text: 'Utilities', link: '/api/utils.html' },
9+
{
10+
text: 'Modules',
11+
items: [
12+
{ text: 'Airline', link: '/api/airline.html' },
13+
{ text: 'Animal', link: '/api/animal.html' },
14+
{ text: 'Color', link: '/api/color.html' },
15+
{ text: 'Commerce', link: '/api/commerce.html' },
16+
{ text: 'Company', link: '/api/company.html' },
17+
{ text: 'Database', link: '/api/database.html' },
18+
{ text: 'Datatype', link: '/api/datatype.html' },
19+
{ text: 'Date', link: '/api/date.html' },
20+
{ text: 'Finance', link: '/api/finance.html' },
21+
{ text: 'Git', link: '/api/git.html' },
22+
{ text: 'Hacker', link: '/api/hacker.html' },
23+
{ text: 'Helpers', link: '/api/helpers.html' },
24+
{ text: 'Image', link: '/api/image.html' },
25+
{ text: 'Internet', link: '/api/internet.html' },
26+
{ text: 'Location', link: '/api/location.html' },
27+
{ text: 'Lorem', link: '/api/lorem.html' },
28+
{ text: 'Music', link: '/api/music.html' },
29+
{ text: 'Number', link: '/api/number.html' },
30+
{ text: 'Person', link: '/api/person.html' },
31+
{ text: 'Phone', link: '/api/phone.html' },
32+
{ text: 'Random', link: '/api/random.html' },
33+
{ text: 'Science', link: '/api/science.html' },
34+
{ text: 'String', link: '/api/string.html' },
35+
{ text: 'System', link: '/api/system.html' },
36+
{ text: 'Vehicle', link: '/api/vehicle.html' },
37+
{ text: 'Word', link: '/api/word.html' },
38+
],
39+
},
3540
];

docs/.vitepress/config.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import { defineConfig } from 'vitepress';
2-
import { DefaultTheme } from 'vitepress/theme';
1+
import type { UserConfig } from 'vitepress';
2+
import type { DefaultTheme } from 'vitepress/theme';
33
import { apiPages } from './api-pages';
4-
import { currentVersion, oldVersions, versionBannerInfix } from './versions';
4+
import {
5+
algoliaIndex,
6+
currentVersion,
7+
oldVersions,
8+
versionBannerInfix,
9+
} from './versions';
510

611
type SidebarItem = DefaultTheme.SidebarItem;
712

@@ -55,7 +60,8 @@ function extendSideNav(current: SidebarItem): SidebarItem[] {
5560
return links;
5661
}
5762

58-
const config = defineConfig({
63+
// TODO @Shinigami92 2023-12-28: reuse `defineConfig` from vitepress, when we can go esm-only
64+
const config: UserConfig<DefaultTheme.Config> = {
5965
title: 'Faker',
6066
description,
6167

@@ -121,11 +127,14 @@ const config = defineConfig({
121127
{ icon: 'github', link: 'https://github.com/faker-js/faker' },
122128
],
123129

124-
algolia: {
125-
apiKey: process.env.API_KEY,
126-
appId: process.env.APP_ID,
127-
indexName: 'fakerjs',
128-
},
130+
algolia:
131+
process.env.API_KEY == null || process.env.APP_ID == null
132+
? undefined
133+
: {
134+
apiKey: process.env.API_KEY,
135+
appId: process.env.APP_ID,
136+
indexName: algoliaIndex,
137+
},
129138

130139
footer: {
131140
message: 'Released under the MIT License.',
@@ -140,7 +149,7 @@ const config = defineConfig({
140149
link: '/api/',
141150
},
142151
{
143-
text: 'Ecosystem',
152+
text: 'Try it',
144153
items: [{ text: 'StackBlitz ', link: 'https://fakerjs.dev/new' }],
145154
},
146155
{
@@ -256,7 +265,7 @@ const config = defineConfig({
256265
__BANNER__: versionBannerInfix ?? false,
257266
},
258267
},
259-
});
268+
};
260269

261270
if (versionBannerInfix) {
262271
config.head?.push([

docs/.vitepress/theme/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ table td ul li {
1515
}
1616

1717
.VPHero .action:not(:last-child) a.VPButton.alt {
18-
border-color: var(--vp-button-brand-border) !important;
19-
color: var(--vp-button-brand-border) !important;
18+
border-color: var(--vp-button-brand-bg) !important;
19+
color: var(--vp-button-brand-text) !important;
2020
}

0 commit comments

Comments
 (0)