From 299c031b59c3bd35e0144606313e5ce69da101e4 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 9 Oct 2023 13:13:06 +0200 Subject: [PATCH] infra(unicorn): explicit-length-check --- .eslintrc.js | 1 - scripts/apidoc/signature.ts | 4 ++-- test/all_functional.spec.ts | 2 +- test/vitest-extensions.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bb135397802..b6ee8bd3a17 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -52,7 +52,6 @@ module.exports = defineConfig({ 'unicorn/consistent-destructuring': 'off', 'unicorn/consistent-function-scoping': 'off', 'unicorn/escape-case': 'off', - 'unicorn/explicit-length-check': 'off', 'unicorn/filename-case': 'off', 'unicorn/import-style': 'off', 'unicorn/no-array-callback-reference': 'off', diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 113df911650..63e8d5eed3a 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -64,7 +64,7 @@ export async function analyzeSignature( // Generate usage section let signatureTypeParametersString = ''; - if (signatureTypeParameters.length !== 0) { + if (signatureTypeParameters.length > 0) { signatureTypeParametersString = `<${signatureTypeParameters.join(', ')}>`; } @@ -207,7 +207,7 @@ async function typeToText(type_?: Type, short = false): Promise { .join(' | '); case 'reference': - if (!type.typeArguments || !type.typeArguments.length) { + if (!type.typeArguments || type.typeArguments.length === 0) { const reflection = type.reflection as DeclarationReflection | undefined; const reflectionType = reflection?.type; if ( diff --git a/test/all_functional.spec.ts b/test/all_functional.spec.ts index 23ed6ccf681..0437a239b8b 100644 --- a/test/all_functional.spec.ts +++ b/test/all_functional.spec.ts @@ -70,7 +70,7 @@ function modulesList(): { [module: string]: string[] } { .reduce((result, mod) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument const methods = Object.keys(fakerEN[mod]).filter(isMethodOf(mod)); - if (methods.length) { + if (methods.length > 0) { result[mod] = methods; } else { console.log(`Skipping ${mod} - No testable methods`); diff --git a/test/vitest-extensions.ts b/test/vitest-extensions.ts index c241fcf99ea..e23b9c09c81 100644 --- a/test/vitest-extensions.ts +++ b/test/vitest-extensions.ts @@ -9,7 +9,7 @@ expect.extend({ const uniqueDuplication = [...new Set(duplications)]; return { - pass: uniqueDuplication.length !== 0, + pass: uniqueDuplication.length > 0, message: () => isNot ? `Duplicated values are [${uniqueDuplication.join(', ')}]`