aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-11-07 17:12:47 +0100
committerGitHub <[email protected]>2023-11-07 16:12:47 +0000
commit9498203190e37a96114ddc8e861b02ccd94e517b (patch)
treebf605df537b387d1d33fe2707f3d46b9b4afed44
parentfafcba473f8a91eeb8230ebdc1ad5039b25091e1 (diff)
downloadfaker-9498203190e37a96114ddc8e861b02ccd94e517b.tar.xz
faker-9498203190e37a96114ddc8e861b02ccd94e517b.zip
infra(unicorn): no-negated-condition (#2507)
-rw-r--r--.eslintrc.js1
-rw-r--r--scripts/apidoc/diff.ts4
-rw-r--r--src/modules/helpers/index.ts22
-rw-r--r--src/modules/image/index.ts2
4 files changed, 14 insertions, 15 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index f2115380..7e60b795 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -52,7 +52,6 @@ module.exports = defineConfig({
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-await-expression-member': 'off',
- 'unicorn/no-negated-condition': 'off',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-useless-switch-case': 'off',
'unicorn/numeric-separators-style': 'off',
diff --git a/scripts/apidoc/diff.ts b/scripts/apidoc/diff.ts
index 18b8e60f..101200cd 100644
--- a/scripts/apidoc/diff.ts
+++ b/scripts/apidoc/diff.ts
@@ -12,9 +12,9 @@ async function loadRemote(url: string): Promise<DocsApiDiffIndex> {
throw new Error(
`Failed to load remote diff index from ${url}: ${res.statusText}`
);
- } else {
- return res.json() as Promise<DocsApiDiffIndex>;
}
+
+ return res.json() as Promise<DocsApiDiffIndex>;
});
}
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index ff93f2ca..f7d9538b 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -456,17 +456,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
}
while (range != null) {
- if (!range[0].includes('-')) {
- // handle non-ranges
- if (isCaseInsensitive && Number.isNaN(Number(range[0]))) {
- rangeCodes.push(
- range[0].toUpperCase().charCodeAt(0),
- range[0].toLowerCase().charCodeAt(0)
- );
- } else {
- rangeCodes.push(range[0].charCodeAt(0));
- }
- } else {
+ if (range[0].includes('-')) {
// handle ranges
const rangeMinMax = range[0].split('-').map((x) => x.charCodeAt(0));
min = rangeMinMax[0];
@@ -490,6 +480,16 @@ export class SimpleHelpersModule extends SimpleModuleBase {
rangeCodes.push(i);
}
}
+ } else {
+ // handle non-ranges
+ if (isCaseInsensitive && Number.isNaN(Number(range[0]))) {
+ rangeCodes.push(
+ range[0].toUpperCase().charCodeAt(0),
+ range[0].toLowerCase().charCodeAt(0)
+ );
+ } else {
+ rangeCodes.push(range[0].charCodeAt(0));
+ }
}
ranges = ranges.substring(range[0].length);
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts
index 915014db..f5f24711 100644
--- a/src/modules/image/index.ts
+++ b/src/modules/image/index.ts
@@ -175,7 +175,7 @@ export class ImageModule extends ModuleBase {
const { width = 640, height = 480, category } = options;
return `https://loremflickr.com/${width}/${height}${
- category != null ? `/${category}` : ''
+ category == null ? '' : `/${category}`
}?lock=${this.faker.number.int()}`;
}