From 0cae21561a14af6a8aecce7527e2cf252f053417 Mon Sep 17 00:00:00 2001 From: Tnarita0000 Date: Mon, 5 Nov 2018 13:59:23 -0800 Subject: [PATCH] Fix `no-shadow` eslint warning & remove var (#22124) Summary: Fixes `no-shadow` warning for `local-cli/link/ios/getGroup.js` and remove `var` declaration keyword. ``` react-native/local-cli/link/ios/getGroup.js 13:23 warning 'group' is already declared in the upper scope no-shadow ``` - [x] Check `npm run flow` - [x] Check `npm run flow-check-ios` - [x] Check `npm run flow-check-android` - [x] Check `npm run lint` N/A Pull Request resolved: https://github.com/facebook/react-native/pull/22124 Differential Revision: D12929717 Pulled By: TheSavior fbshipit-source-id: 10f8269ae7a0e61f4d0ec6fe710889c3a7c90b3b --- link/ios/getGroup.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/link/ios/getGroup.js b/link/ios/getGroup.js index d7b54ad5b..c53e731d9 100644 --- a/link/ios/getGroup.js +++ b/link/ios/getGroup.js @@ -9,8 +9,8 @@ const getFirstProject = project => project.getFirstProject().firstProject; -const findGroup = (group, name) => - group.children.find(group => group.comment === name); +const findGroup = (groups, name) => + groups.children.find(group => group.comment === name); /** * Returns group from .xcodeproj if one exists, null otherwise @@ -23,22 +23,22 @@ const findGroup = (group, name) => module.exports = function getGroup(project, path) { const firstProject = getFirstProject(project); - var group = project.getPBXGroupByKey(firstProject.mainGroup); + let groups = project.getPBXGroupByKey(firstProject.mainGroup); if (!path) { - return group; + return groups; } for (var name of path.split('/')) { - var foundGroup = findGroup(group, name); + var foundGroup = findGroup(groups, name); if (foundGroup) { - group = project.getPBXGroupByKey(foundGroup.value); + groups = project.getPBXGroupByKey(foundGroup.value); } else { - group = null; + groups = null; break; } } - return group; + return groups; };