aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-11-04 10:40:06 +0100
committerGitHub <[email protected]>2023-11-04 09:40:06 +0000
commit358572d9e76f4cd22bfcb09c092a1eaf3a31f005 (patch)
tree836d9b14d2c7e338610dc36073e799a7723af8c8 /src/modules
parent22003bbac9518befeaacfc75c9360a273f0ea6b4 (diff)
downloadfaker-358572d9e76f4cd22bfcb09c092a1eaf3a31f005.tar.xz
faker-358572d9e76f4cd22bfcb09c092a1eaf3a31f005.zip
infra(typescript-eslint): strict-type-checked (#2467)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/finance/index.ts2
-rw-r--r--src/modules/image/index.ts7
-rw-r--r--src/modules/word/filter-word-list-by-length.ts4
3 files changed, 6 insertions, 7 deletions
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index 2664cdfc..b381e16c 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -815,7 +815,7 @@ export class FinanceModule {
const normalizedIssuer = issuer.toLowerCase();
if (normalizedIssuer in localeFormat) {
format = this.faker.helpers.arrayElement(localeFormat[normalizedIssuer]);
- } else if (/#/.test(issuer)) {
+ } else if (issuer.includes('#')) {
// The user chose an optional scheme
format = issuer;
} else {
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts
index a93f181e..b1c9c692 100644
--- a/src/modules/image/index.ts
+++ b/src/modules/image/index.ts
@@ -232,17 +232,16 @@ export class ImageModule {
length: { min: 5, max: 10 },
})}/${width}/${height}`;
- const hasValidGrayscale = grayscale === true;
const hasValidBlur = typeof blur === 'number' && blur >= 1 && blur <= 10;
- if (hasValidGrayscale || hasValidBlur) {
+ if (grayscale || hasValidBlur) {
url += '?';
- if (hasValidGrayscale) {
+ if (grayscale) {
url += `grayscale`;
}
- if (hasValidGrayscale && hasValidBlur) {
+ if (grayscale && hasValidBlur) {
url += '&';
}
diff --git a/src/modules/word/filter-word-list-by-length.ts b/src/modules/word/filter-word-list-by-length.ts
index 106e9858..60c6fae9 100644
--- a/src/modules/word/filter-word-list-by-length.ts
+++ b/src/modules/word/filter-word-list-by-length.ts
@@ -13,12 +13,12 @@ const STRATEGIES = {
wordList: ReadonlyArray<string>,
length: { min: number; max: number }
): string[] => {
- const wordsByLength = wordList.reduce(
+ const wordsByLength = wordList.reduce<Record<number, string[]>>(
(data, word) => {
(data[word.length] = data[word.length] ?? []).push(word);
return data;
},
- {} as Record<number, string[]>
+ {}
);
const lengths = Object.keys(wordsByLength).map(Number);