Eslint prefer-const (#17864)

* adds prefer-const to eslint config and runs fixer

* reverts unintended change
This commit is contained in:
Jordan Reimer
2022-11-09 16:15:31 -07:00
committed by GitHub
parent 96d623d3fc
commit 483ef19946
464 changed files with 1701 additions and 1714 deletions

View File

@@ -5,11 +5,11 @@ export default function (arr = [], attribute = 'id') {
// this assumes an already sorted array
// if the array is sorted, we want to compare the first and last
// item in the array - if they share a prefix, all of the items do
let firstString = arr[0][attribute];
let lastString = arr[arr.length - 1][attribute];
const firstString = arr[0][attribute];
const lastString = arr[arr.length - 1][attribute];
// the longest the shared prefix could be is the length of the match
let targetLength = firstString.length;
const targetLength = firstString.length;
let prefixLength = 0;
// walk the two strings, and if they match at the current length,
// increment the prefixLength and try again