title: TypeScript ESLint incorrectly reports: "Function is defined but never used."
body: <p>I have <code>iwAddClassAndRemoveInSiblings</code> function in <code>lib\iw-browser.ts</code> file:</p>
  
  <pre><code>"use strict";
  
  /* Adds given CSS class to given element and remove this class in element's siblings.
     Equal to jQuery: $(element1).addClass(CSSClass).siblings().removeClass(CSSClass) */
  function iwAddClassAndRemoveInSiblings(element: Element, CSSClass: string): void {
    for (const sibling of element.parentNode.children)
      sibling.classList.remove(CSSClass)
    element.classList.add(CSSClass)
  }
  </code></pre>
  
  <p>I call this function in <code>lib\iw-carousel\iw-carousel.ts</code> file:</p>
  
  <pre><code>document.addEventListener('click', (event) =&gt; {
    const target = &lt;HTMLElement&gt;event.target
    if (target.matches('.iw-carousel__indicators li'))
      iwCarouselShowSlide(target.closest('.iw-carousel'), Number(target.dataset.slideTo))
  })
  
  /* Shows i-th slide of the given iw-carousel. */
  const iwCarouselShowSlide = (carousel: HTMLElement, slideIndex: number) =&gt; {
    const slides = carousel.querySelectorAll('.iw-carousel__item')
    iwAddClassAndRemoveInSiblings(slides[slideIndex], 'active')
  }
  </code></pre>
  
  <p>The compiled <code>iw-browser.js</code> and <code>iw-carousel.js</code> are referenced in <code>iw-carousel.html</code>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;  
    &lt;script src="lib/iw-carousel/iw-carousel.js"&gt;&lt;/script&gt;
    &lt;script src="lib/iw-browser.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;!-- unimportant html content --&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Unfortunately, Typescript ESLint incorectly reports the <code>iwAddClassAndRemoveInSiblings</code> function as unused, both in Visual Studio Code, and if run it from the command line <code>npx eslint . --ext .ts</code>:</p>
  
  <pre><code>'iwAddClassAndRemoveInSiblings' is defined but never used. eslint(@typescript-eslint/no-unused-vars)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ApXLD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ApXLD.png" alt="The error in Visual Studio Code"></a></p>
  
  <p>The HTML page is displayed properly - it runs <code>iwAddClassAndRemoveInSiblings</code> function without problems. Visual Studio Code also knows that <code>iwAddClassAndRemoveInSiblings</code> function is used. If I try to use a nonexistent function, VSC says: <em>Cannot find name 'nonExsistingFunction'</em>. So VSC checks if the function is defined. I have this problem only with ESLint.</p>
  
  <p>Have I configured ESLint or Typescript incorrectly?</p>
  
  <p>I have installed TypeScript and ESLint in the way described at: <a href="https://stackoverflow.com/questions/61963749/how-to-use-eslint-typescript-airbnb-configuration">How to use ESLint TypeScript Airbnb configuration?</a></p>
  
  <p>The Typescript and ESLint configuration files are below:</p>
  
  <p>.eslintrc.js:</p>
  
  <pre class="lang-js prettyprint-override"><code>module.exports = {
    root: true,
    parser: '@typescript-eslint/parser', // allows ESLint to understand TypeScript syntax
    parserOptions: {
      project: ['./tsconfig.json'],      // required for "type-aware linting"
    },
    plugins: [
      '@typescript-eslint',              // allows to use the rules within the codebase
    ],
    extends: [
      'airbnb-typescript/base',          //use Airbnb config
    ],
    rules: { }
  };
  </code></pre>
  
  <p>tsconfig.json:</p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "ES2016",
      "module": "commonjs",
      "sourceMap": true
    }
  }
  </code></pre>
  
  <p>package.json:</p>
  
  <pre><code>{
    "name": "iw-components",
    "version": "0.1.0",
    "description": "...",
    "main": "index.js",
    "directories": {
      "lib": "lib"
    },
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "repository": {
      "type": "git",
      "url": "git+https://github.com/iwis/iw-components.git"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "bugs": {
      "url": "https://github.com/iwis/iw-components/issues"
    },
    "homepage": "https://github.com/iwis/iw-components#readme",
    "devDependencies": {
      "@typescript-eslint/eslint-plugin": "^2.34.0",
      "@typescript-eslint/parser": "^2.34.0",
      "eslint": "^6.8.0",
      "eslint-config-airbnb-typescript": "^7.2.1",
      "eslint-config-standard-with-typescript": "^16.0.0",
      "eslint-plugin-import": "^2.20.2",
      "eslint-plugin-node": "^11.1.0",
      "eslint-plugin-promise": "^4.2.1",
      "eslint-plugin-standard": "^4.0.1",
      "typescript": "~3.7.5"
    }
  }
  </code></pre>