Skip to content

Commit

Permalink
Merge branch 'next' into docs/pre-built/description
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Oct 20, 2024
2 parents 07f640e + 3f3d628 commit 5ad1814
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ It is highly recommended to use version tags when importing libraries in Deno, e

## TypeScript Support

Faker supports TypeScript out of the box, so you don't have to install any extra packages.
We assume that you use TypeScript (strict mode).
You can use Faker without it, but we don't have dedicated error messages for wrong parameter types.

In order to have Faker working properly, you need to check if these `compilerOptions` are set correctly in your `tsconfig` file:

```json
{
"compilerOptions": {
"esModuleInterop": true,
"moduleResolution": "Bundler" // "Node10", "Node16" or "NodeNext"
"moduleResolution": "Bundler", // "Node10", "Node16" or "NodeNext"
"strict": true // Optional, but recommended
}
}
```
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,13 @@ const config: ReturnType<typeof tseslint.config> = tseslint.config(
{
files: ['src/**/*.ts'],
rules: {
'no-undef': 'error', // Must override the config from typescript-eslint
'jsdoc/require-jsdoc': 'error',
},
languageOptions: {
// Don't allow any globals in our TypeScript files - unless explicitly ignored
globals: {},
},
},
{
files: ['src/locale/**/*.ts'],
Expand Down
1 change: 1 addition & 0 deletions src/internal/base64.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef -- This file serves as a compatibility layer between environments */
/**
* This works the same as `Buffer.from(input).toString('base64')`
* to work on both Node.js and browser environment.
Expand Down
1 change: 1 addition & 0 deletions src/internal/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ export function deprecated(opts: DeprecatedOptions): void {
message += `. Please use ${opts.proposed} instead`;
}

// eslint-disable-next-line no-undef -- Using console here is intentional and required
console.warn(`${message}.`);
}
5 changes: 5 additions & 0 deletions src/modules/date/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ export class SimpleDateModule extends SimpleModuleBase {
*
* For more control, any of these methods can be customized with further options, or use [`between()`](https://fakerjs.dev/api/date.html#between) to generate a single date between two dates, or [`betweens()`](https://fakerjs.dev/api/date.html#betweens) for multiple dates.
*
* If you need to generate a date range (start-end), you can do so using either of these two methods:
*
* - `const start = faker.date.soon(); const end = faker.date.soon({ refDate: start });`
* - `const [start, end] = faker.date.betweens({ from, to, count: 2 });` // does not work with tsconfig's `noUncheckedIndexedAccess: true`
*
* Dates can be specified as Javascript Date objects, strings or UNIX timestamps.
* For example to generate a date between 1st January 2000 and now, use:
* ```ts
Expand Down
1 change: 1 addition & 0 deletions src/modules/helpers/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function evalProcessFunction(
return entrypoint(...params);
}

// eslint-disable-next-line no-undef
console.warn(
`[@faker-js/faker]: Invoking expressions which are not functions is deprecated since v9.0 and will be removed in v10.0.
Please remove the parentheses or replace the expression with an actual function.
Expand Down

0 comments on commit 5ad1814

Please # to comment.