diff options
| author | ST-DDT <[email protected]> | 2024-10-19 13:39:30 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-19 13:39:30 +0200 |
| commit | 7141608aa0a570be88dc7f0ffb6dbd9a2c72c2ab (patch) | |
| tree | 2a17c3eacfcd9fbbaa32db44c53589bde1426944 | |
| parent | 90147150837e2a7222b4876b86223fc1e67100a0 (diff) | |
| download | faker-7141608aa0a570be88dc7f0ffb6dbd9a2c72c2ab.tar.xz faker-7141608aa0a570be88dc7f0ffb6dbd9a2c72c2ab.zip | |
infra(eslint): limit usage of globals in src (#3191)
| -rw-r--r-- | eslint.config.ts | 5 | ||||
| -rw-r--r-- | src/internal/base64.ts | 1 | ||||
| -rw-r--r-- | src/internal/deprecated.ts | 1 | ||||
| -rw-r--r-- | src/modules/helpers/eval.ts | 1 |
4 files changed, 8 insertions, 0 deletions
diff --git a/eslint.config.ts b/eslint.config.ts index 4b522eec..e4dc76bb 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -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'], diff --git a/src/internal/base64.ts b/src/internal/base64.ts index b346538a..e2702355 100644 --- a/src/internal/base64.ts +++ b/src/internal/base64.ts @@ -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. diff --git a/src/internal/deprecated.ts b/src/internal/deprecated.ts index fe2cdc94..3d82eb2e 100644 --- a/src/internal/deprecated.ts +++ b/src/internal/deprecated.ts @@ -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}.`); } diff --git a/src/modules/helpers/eval.ts b/src/modules/helpers/eval.ts index 5c34fbe6..e04575bc 100644 --- a/src/modules/helpers/eval.ts +++ b/src/modules/helpers/eval.ts @@ -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. |
