Merge pull request #15076 from Snuffleupagus/prefer-array-index-of

Enable the `prefer-array-index-of` ESLint plugin rule
This commit is contained in:
Jonas Jenwald 2022-06-21 18:57:51 +02:00 committed by GitHub
commit eca939d904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -51,6 +51,7 @@
"unicorn/no-useless-spread": "error",
"unicorn/prefer-array-flat": "error",
"unicorn/prefer-array-flat-map": "error",
"unicorn/prefer-array-index-of": "error",
"unicorn/prefer-at": "error",
"unicorn/prefer-date-now": "error",
"unicorn/prefer-dom-node-append": "error",

View File

@ -5658,7 +5658,7 @@ class Template extends XFAObject {
// We must stop the contentAreas filling and go to the next page.
targetPageArea = target;
} else if (target instanceof ContentArea) {
const index = contentAreas.findIndex(e => e === target);
const index = contentAreas.indexOf(target);
if (index !== -1) {
if (index > currentIndex) {
// In the next loop iteration `i` will be incremented, note the
@ -5671,9 +5671,7 @@ class Template extends XFAObject {
}
} else {
targetPageArea = target[$getParent]();
startIndex = targetPageArea.contentArea.children.findIndex(
e => e === target
);
startIndex = targetPageArea.contentArea.children.indexOf(target);
}
}
continue;