Skip to content

Commit

Permalink
Merge branch 'next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Oct 30, 2023
2 parents 1e4f57d + 2d591de commit cc9c202
Show file tree
Hide file tree
Showing 72 changed files with 1,120 additions and 963 deletions.
61 changes: 32 additions & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,74 +15,55 @@ module.exports = defineConfig({
reportUnusedDisableDirectives: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:prettier/recommended',
'plugin:deprecation/recommended',
'plugin:jsdoc/recommended-typescript-error',
'plugin:unicorn/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ['@typescript-eslint', 'prettier', 'deprecation', 'jsdoc'],
rules: {
eqeqeq: ['error', 'always', { null: 'ignore' }],
'no-else-return': 'error',
'prefer-template': 'error',
'no-restricted-globals': ['error', 'Intl'],

'deprecation/deprecation': 'error',
'prefer-template': 'error',

'unicorn/no-nested-ternary': 'off', // incompatible with prettier
'unicorn/no-null': 'off', // incompatible with TypeScript
'unicorn/no-zero-fractions': 'off', // deactivated to raise awareness of floating operations
'unicorn/number-literal-case': 'off', // incompatible with prettier
'unicorn/prefer-ternary': 'off', // ternaries aren't always better

// TODO @Shinigami92 2023-09-23: prefer-at should be turned on when we drop support for Node 14.
'unicorn/prefer-at': 'off',
// TODO @Shinigami92 2023-09-23: prefer-string-replace-all should be turned on when we drop support for Node 14.
'unicorn/prefer-string-replace-all': 'off',
// TODO @ST-DDT 2023-10-28: The following rule should be turned on when we switch to esm.
'unicorn/prefer-top-level-await': 'off',

// TODO @Shinigami92 2023-09-23: The following rules currently conflict with our code.
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
'unicorn/better-regex': 'off',
'unicorn/catch-error-name': 'off',
'unicorn/consistent-destructuring': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/escape-case': 'off',
'unicorn/explicit-length-check': 'off',
'unicorn/filename-case': 'off',
'unicorn/import-style': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-for-loop': 'off',
'unicorn/no-instanceof-array': 'off',
'unicorn/no-negated-condition': 'off',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-useless-switch-case': 'off',
'unicorn/no-zero-fractions': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-array-some': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-includes': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-native-coercion-functions': 'off',
'unicorn/prefer-negative-index': 'off',
'unicorn/prefer-number-properties': 'off',
'unicorn/prefer-optional-catch-binding': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prefer-string-slice': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/require-array-join-separator': 'off',
'unicorn/switch-case-braces': 'off',
'unicorn/text-encoding-identifier-case': 'off',

'@typescript-eslint/array-type': [
'error',
Expand Down Expand Up @@ -110,23 +91,21 @@ module.exports = defineConfig({
'error',
{ ignoreParameters: true },
],
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: 'block-like', next: '*' },
],
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowNumber: true, allowBoolean: true },
],
'@typescript-eslint/unbound-method': 'off',

'jsdoc/no-types': 'error',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-jsdoc': 'off', // Enabled only for src/**/*.ts
'jsdoc/require-returns': 'off',
'jsdoc/sort-tags': [
'error',
Expand Down Expand Up @@ -159,6 +138,30 @@ module.exports = defineConfig({
'jsdoc/require-jsdoc': 'error',
},
},
{
files: ['src/locale/**/*.ts'],
rules: {
'unicorn/filename-case': 'off', // our locale files have a custom naming scheme
},
},
{
files: ['src/definitions/**/*.ts', 'src/locales/**/*.ts'],
rules: {
'unicorn/filename-case': [
'error',
{
case: 'snakeCase',
// TODO @ST-DDT 2023-10-21: rename the definitions in v9
ignore: [
/chemicalElement\.ts$/,
/directoryPaths\.ts$/,
/mimeTypes\.ts$/,
],
},
],
'unicorn/text-encoding-identifier-case': 'off',
},
},
{
files: ['test/**/*.spec.ts'],
extends: ['plugin:vitest/recommended'],
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: 'Build & Unit Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
# Required for docs/versions tests
fetch-depth: 0
Expand All @@ -51,7 +51,7 @@ jobs:
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
run: date

- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
# Required for docs/versions tests
fetch-depth: 0
Expand All @@ -99,7 +99,7 @@ jobs:
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
Expand All @@ -124,7 +124,7 @@ jobs:
name: 'E2E Doc Test: node-20, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
Expand All @@ -145,15 +145,15 @@ jobs:
name: 'Lint: node-20, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 20
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -175,15 +175,15 @@ jobs:
name: 'TS-Check: node-20, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 20
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -202,15 +202,15 @@ jobs:
name: 'Codecov: node-20, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 20
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: 'pnpm'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 20
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: 'pnpm'
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

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.

## [8.2.0](https://github.com/faker-js/faker/compare/v8.1.0...v8.2.0) (2023-10-14)


### Features

* support custom randomizer ([#2284](https://github.com/faker-js/faker/issues/2284)) ([5410239](https://github.com/faker-js/faker/commit/5410239245b4a6fe8c1976f8aa33c970923f9f40))


### Bug Fixes

* **docs:** revert filter code that breaks search in docs ([#2425](https://github.com/faker-js/faker/issues/2425)) ([c498c09](https://github.com/faker-js/faker/commit/c498c091f488db287684690ab4ff109b1589523f))
* **locale:** Dutch phone number ([#2400](https://github.com/faker-js/faker/issues/2400)) ([005369b](https://github.com/faker-js/faker/commit/005369b29c7ee290a870396ff0acc85e3f715e10))


### New Locales

* **locale:** add airline database science commerce and vehicle for zh_CN ([#2395](https://github.com/faker-js/faker/issues/2395)) ([9c96c0a](https://github.com/faker-js/faker/commit/9c96c0a131e0609a21dc5ee110cc407e76852373))
* **locale:** add street_name to `en_US`, `en_GB` and `en` ([#2371](https://github.com/faker-js/faker/issues/2371)) ([491d319](https://github.com/faker-js/faker/commit/491d3191213e2ceaaee46dcc50ac25c3995ba2d5))
* **locale:** add unionpay credit card for zh_CN ([#2338](https://github.com/faker-js/faker/issues/2338)) ([74eeccc](https://github.com/faker-js/faker/commit/74eecccd3af702d8a1d8072f94032ccb54293cb1))

## [8.1.0](https://github.com/faker-js/faker/compare/v8.0.2...v8.1.0) (2023-09-19)


Expand Down
2 changes: 1 addition & 1 deletion docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ interface User {
}
```

As you can see, your `User` model probably looks completely different from the one you have in your codebase.
As you can see, our `User` model probably looks completely different from the one you have in your codebase.
One thing to keep an eye on is the `subscriptionTier` property, as it is not simply a string, but only one of the strings defined in the `SubscriptionTier` type (`'free'` or `'basic'` or `'business'`).
Also, in a real scenario, your model should not depend on a type of a third party library (`SexType` in this case).

Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@faker-js/faker",
"version": "8.1.0",
"version": "8.2.0",
"description": "Generate massive amounts of fake contextual data",
"keywords": [
"faker",
Expand Down Expand Up @@ -63,7 +63,7 @@
"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",
"generate:locales": "tsx ./scripts/generate-locales.ts",
"docs:build": "run-s docs:prepare docs:build:run",
"docs:build:run": "vitepress build docs",
"docs:build:ci": "run-s build docs:build",
Expand All @@ -87,30 +87,30 @@
"preflight": "pnpm install && run-s generate format lint build test:update-snapshots ts-check"
},
"devDependencies": {
"@actions/github": "~5.1.1",
"@actions/github": "~6.0.0",
"@algolia/client-search": "~4.19.1",
"@types/markdown-it": "~13.0.2",
"@types/node": "~20.8.3",
"@types/sanitize-html": "~2.9.1",
"@types/semver": "~7.5.3",
"@types/validator": "~13.11.2",
"@typescript-eslint/eslint-plugin": "~6.7.4",
"@typescript-eslint/parser": "~6.7.4",
"@types/markdown-it": "~13.0.4",
"@types/node": "~20.8.7",
"@types/sanitize-html": "~2.9.3",
"@types/semver": "~7.5.4",
"@types/validator": "~13.11.5",
"@typescript-eslint/eslint-plugin": "~6.9.0",
"@typescript-eslint/parser": "~6.9.0",
"@vitest/coverage-v8": "~0.34.6",
"@vitest/ui": "~0.34.7",
"@vueuse/core": "~10.5.0",
"conventional-changelog-cli": "~4.1.0",
"cypress": "~13.3.0",
"esbuild": "~0.19.4",
"eslint": "~8.51.0",
"cypress": "~13.3.2",
"esbuild": "~0.19.5",
"eslint": "~8.52.0",
"eslint-config-prettier": "~9.0.0",
"eslint-define-config": "~1.24.1",
"eslint-gitignore": "~0.1.0",
"eslint-plugin-deprecation": "~2.0.0",
"eslint-plugin-jsdoc": "~46.8.2",
"eslint-plugin-prettier": "~5.0.0",
"eslint-plugin-unicorn": "~48.0.1",
"eslint-plugin-vitest": "~0.3.2",
"eslint-plugin-prettier": "~5.0.1",
"eslint-plugin-unicorn": "~49.0.0",
"eslint-plugin-vitest": "~0.3.8",
"glob": "~10.3.10",
"npm-run-all": "~4.1.5",
"prettier": "3.0.3",
Expand All @@ -123,10 +123,10 @@
"typedoc": "~0.24.8",
"typescript": "~4.9.5",
"validator": "~13.11.0",
"vite": "~4.4.11",
"vite": "~4.5.0",
"vitepress": "1.0.0-beta.7",
"vitest": "~0.34.6",
"vue": "~3.3.4"
"vue": "~3.3.6"
},
"packageManager": "pnpm@8.5.1",
"engines": {
Expand Down
Loading

0 comments on commit cc9c202

Please sign in to comment.