From 74f6bbd193decda92359c21548c81e68f4550729 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 24 Oct 2023 17:28:29 +0200 Subject: [PATCH] infra(unicorn): no-for-loop (#2490) --- .eslintrc.js | 1 - src/modules/finance/iban.ts | 4 ++-- test/docs/versions.spec.ts | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index cd918e3bfb3..eb82b380d88 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,7 +55,6 @@ module.exports = defineConfig({ 'unicorn/no-array-callback-reference': 'off', 'unicorn/no-array-reduce': 'off', 'unicorn/no-await-expression-member': 'off', - 'unicorn/no-for-loop': 'off', 'unicorn/no-negated-condition': 'off', 'unicorn/no-object-as-default-parameter': 'off', 'unicorn/no-useless-switch-case': 'off', diff --git a/src/modules/finance/iban.ts b/src/modules/finance/iban.ts index 2eb6fbba4f2..f37bc7f4cab 100644 --- a/src/modules/finance/iban.ts +++ b/src/modules/finance/iban.ts @@ -1398,8 +1398,8 @@ const iban: Iban = { ], mod97: (digitStr) => { let m = 0; - for (let i = 0; i < digitStr.length; i++) { - m = (m * 10 + +digitStr[i]) % 97; + for (const element of digitStr) { + m = (m * 10 + +element) % 97; } return m; diff --git a/test/docs/versions.spec.ts b/test/docs/versions.spec.ts index 5d9efd921fc..777efcb2c9c 100644 --- a/test/docs/versions.spec.ts +++ b/test/docs/versions.spec.ts @@ -38,10 +38,10 @@ describe.runIf(isFakerOrigin())('docs versions', () => { semver.valid(version) ); const latestMajorRelease = semver.major(releaseVersions[0].version); - for (let i = 0; i < releaseVersions.length; i++) { - const { version, link } = releaseVersions[i]; + for (const [index, value] of releaseVersions.entries()) { + const { version, link } = value; const oldMajorVersion = semver.major(version); - expect(oldMajorVersion).toBe(latestMajorRelease - i); + expect(oldMajorVersion).toBe(latestMajorRelease - index); expect(link).toBe(`https://v${oldMajorVersion}.fakerjs.dev/`); } });