drowsy-probius / twitch-icon-selector

Use const declarations for variables that are never reassigned JS-0242
Anti-pattern
Minor
a year ago2 years old
'key' is never reassigned. Use 'const' instead.
382      let keywords = image.getAttribute("data-keywords").split(",").map(w => `~${w}`);
383      let keyword = keywords[0];
384      let isPrefix = false;
385      for(let key of keywords)386      {
387        if(key.startsWith(currentInput))
388        {
'keywords' is never reassigned. Use 'const' instead.
379      inputArea.focus();
380      const image = iconSelectorList.children[iconSelectorCursor];
381      const currentInput = text.split(" ").pop();
382      let keywords = image.getAttribute("data-keywords").split(",").map(w => `~${w}`);383      let keyword = keywords[0];
384      let isPrefix = false;
385      for(let key of keywords)
'key' is never reassigned. Use 'const' instead.
148  let keywords = e.target.getAttribute("data-keywords").split(",").map(w => `~${w}`);
149  let keyword = keywords[0];
150  let isPrefix = false;
151  for(let key of keywords)152  {
153    if(key.startsWith(currentInput))
154    {
'keywords' is never reassigned. Use 'const' instead.
145const iconClickHandler = async (e) => {
146  const currentInput = inputArea.innerText.trimStart().split(" ").pop();
147
148  let keywords = e.target.getAttribute("data-keywords").split(",").map(w => `~${w}`);149  let keyword = keywords[0];
150  let isPrefix = false;
151  for(let key of keywords)
'fail' is never reassigned. Use 'const' instead.
 1let fail = false; 2let error = undefined;
 3
 4let lastUrl = "";