Skip to content

first set of for...of removals to get rid of eslint disables #12401

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ function prepareChildrenArray(childrenArray) {
function prepareChildrenIterable(childrenArray) {
return {
'@@iterator': function*() {
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const child of childrenArray) {
for (let i = 0; i < childrenArray.length; i++) {
let child = childrenArray[i];
yield child;
}
},
Expand Down
17 changes: 8 additions & 9 deletions packages/react-native-renderer/src/__mocks__/FabricUIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const allocatedTags = new Set();
function dumpSubtree(info, indent) {
let out = '';
out += ' '.repeat(indent) + info.viewName + ' ' + JSON.stringify(info.props);
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const child of info.children) {
for (let i = 0; i < info.children.length; i++) {
const child = info.children[i];
out += '\n' + dumpSubtree(child, indent + 2);
}
return out;
Expand All @@ -27,22 +27,21 @@ function dumpSubtree(info, indent) {
const RCTFabricUIManager = {
__dumpChildSetForJestTestsOnly: function(childSet) {
let result = [];
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const child of childSet) {
for (let i = 0; i < childSet.length; i++) {
const child = childSet[i];
result.push(dumpSubtree(child, 0));
}
return result.join('\n');
},
__dumpHierarchyForJestTestsOnly: function() {
let result = [];
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const [rootTag, childSet] of roots) {
roots.forEach(function(childSet, rootTag){
result.push(rootTag);
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const child of childSet) {
for (let i = 0; i < childSet.length; i++) {
const child = childSet[i];
result.push(dumpSubtree(child, 1));
}
}
});
return result.join('\n');
},
createNode: jest.fn(function createNode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('ReactFabric', () => {
).toBe(1);
});

it('should only pass props diffs to FabricUIManager.cloneNode', () => {
it.only('should only pass props diffs to FabricUIManager.cloneNode', () => {
const View = createReactNativeComponentClass('View', () => ({
validAttributes: {foo: true, bar: true},
uiViewClassName: 'View',
Expand Down
3 changes: 2 additions & 1 deletion scripts/error-codes/invertObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function invertObject(targetObj /* : ErrorMap */) /* : ErrorMap */ {
const mapKeys = Object.keys(targetObj);

// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const originalKey of mapKeys) {
for (let i = 0; i < mapKeys.length; i++) {
const originalKey = mapKeys[i];
const originalVal = targetObj[originalKey];

result[originalVal] = originalKey;
Expand Down