From 7f9469acd3223ea61d1875d8bbd14493e7b942a8 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 3 Dec 2021 13:41:43 -0500 Subject: [PATCH 1/2] feat(eslint-config): Enable array-callback-return rule Docs: https://eslint.org/docs/rules/array-callback-return Make sure that we are returning in the callbacks passed into `.map()`, `.filter()` and `.reduce()`. If we are not, we should be using `.forEach()` or an explicit for loop. --- packages/eslint-config-sdk/src/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/eslint-config-sdk/src/index.js b/packages/eslint-config-sdk/src/index.js index 8824f0540c18..0f46d10c63eb 100644 --- a/packages/eslint-config-sdk/src/index.js +++ b/packages/eslint-config-sdk/src/index.js @@ -234,5 +234,10 @@ module.exports = { // Make sure for in loops check for properties 'guard-for-in': 'error', + + // Make sure that we are returning in the callbacks passed into `.map()`, + // `.filter()` and `.reduce()`. If we are not, we should be using + // `.forEach()` or an explicit for loop. + 'array-callback-return': ['error', { allowImplicit: true }], }, }; From 2989b5847771ad1c2bb29418024a7bcd7bf620be Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 6 Dec 2021 08:04:36 -0500 Subject: [PATCH 2/2] Update packages/eslint-config-sdk/src/index.js Co-authored-by: iker barriocanal <32816711+iker-barriocanal@users.noreply.github.com> --- packages/eslint-config-sdk/src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-sdk/src/index.js b/packages/eslint-config-sdk/src/index.js index 0f46d10c63eb..855632571072 100644 --- a/packages/eslint-config-sdk/src/index.js +++ b/packages/eslint-config-sdk/src/index.js @@ -235,8 +235,8 @@ module.exports = { // Make sure for in loops check for properties 'guard-for-in': 'error', - // Make sure that we are returning in the callbacks passed into `.map()`, - // `.filter()` and `.reduce()`. If we are not, we should be using + // Make sure that we are returning in the callbacks passed into `.map`, + // `.filter` and `.reduce`. If we are not, we should be using // `.forEach()` or an explicit for loop. 'array-callback-return': ['error', { allowImplicit: true }], },