From f064d24f402200ac18e94fb38537f8a222ce954c Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Fri, 9 Feb 2024 20:30:14 +0100 Subject: [PATCH 1/2] infra(eslint)!: logical-assignment-operators --- .eslintrc.cjs | 1 + test/modules/finance.spec.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index b2424b41f32..a2b8e93668a 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -33,6 +33,7 @@ module.exports = defineConfig({ }, rules: { eqeqeq: ['error', 'always', { null: 'ignore' }], + 'logical-assignment-operators': 'error', 'no-else-return': 'error', 'no-restricted-globals': ['error', 'Intl'], 'prefer-exponentiation-operator': 'error', diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index 0b9a4d6cff7..3b6f49c99db 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -168,7 +168,7 @@ describe('finance', () => { it('should set a specified length', () => { let expected = faker.number.int(20); - expected = expected || 4; + expected ||= 4; const mask = faker.finance.maskedNumber({ length: expected, From 9a3ef16704f926202744c11a162471cd7d560e7e Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 9 Feb 2024 20:39:17 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: ST-DDT --- test/modules/finance.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index 3b6f49c99db..5c3549c1c36 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -166,9 +166,7 @@ describe('finance', () => { }); it('should set a specified length', () => { - let expected = faker.number.int(20); - - expected ||= 4; + const expected = faker.number.int(20) || 4; const mask = faker.finance.maskedNumber({ length: expected,