diff --git a/.eslintrc.js b/.eslintrc.js index f2115380033..7e60b795af8 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 18b8e60fc4d..101200cd93b 100644 --- a/scripts/apidoc/diff.ts +++ b/scripts/apidoc/diff.ts @@ -12,9 +12,9 @@ async function loadRemote(url: string): Promise { throw new Error( `Failed to load remote diff index from ${url}: ${res.statusText}` ); - } else { - return res.json() as Promise; } + + return res.json() as Promise; }); } diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index ff93f2caf4c..f7d9538bce1 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 915014db07e..f5f24711b3c 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()}`; }