Skip to content

Commit

Permalink
Fix no-shadow eslint warning & remove var (facebook#22124)
Browse files Browse the repository at this point in the history
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: facebook#22124

Differential Revision: D12929717

Pulled By: TheSavior

fbshipit-source-id: 10f8269ae7a0e61f4d0ec6fe710889c3a7c90b3b
  • Loading branch information
binaryta authored and facebook-github-bot committed Nov 5, 2018
1 parent 4b934f7 commit 98f08c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions local-cli/link/ios/getGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
};

0 comments on commit 98f08c0

Please sign in to comment.