title: ESLint: 'cy' is not defined (Cypress)
body: <p>I've just started using Cypress with my React Typescript project. I've gotten some simple tests to run:</p>
  
  <pre class="lang-js prettyprint-override"><code>describe('settings page', () =&gt; {
    beforeEach(() =&gt; {
      cy.visit('http://localhost:3000')
    });
    it('starts in a waiting state, with no settings.', () =&gt; {
      cy.contains('Waiting for settings...')
    });
    it('shows settings once settings are received', () =&gt; {
      const state = cy.window().its('store').invoke('getState')
      console.log(state) // different question: how do I get this to be the state and not a $Chainer?
    });
  });
  </code></pre>
  
  <p>It runs in Cypress just fine. But I get Typescript errors in Webstorm, saying that <code>cy</code> is not defined (a TS and ESlint error) and an error on <code>describe</code> saying <code>all files must be modules when the --isolatedModules flag is provided</code>.</p>
  
  <p>I can make it a JS file instead of a TS file, then I still get <code>cy</code> is not defined.</p>
  
  <p>I've tried <code>import cy from 'cypress'</code> but then I get <code>ParseError: 'import' and 'export' may appear only with 'sourceType: module'</code> which is a whole other can of worms (I'm taking baby steps in writing my tests and haven't had to import anything yet...)</p>
  
  <p><code>/// &lt;reference types="cypress" /&gt;</code> <strong>does not work.</strong></p>
  
  <h3>Update (sort of)</h3>
  
  <p>I've followed instructions <a href="https://glebbahmutov.com/blog/use-typescript-with-cypress/" rel="noreferrer">here</a> and have made a little progress. To my already very full React webpack.config.dev.js I added the recommended code:</p>
  
  <pre class="lang-js prettyprint-override"><code>          { // TODO inserted for cypress https://stackoverflow.com/a/56693706/6826164
              rules: [
                {
                  test: /\.tsx?$/,
                  use: 'ts-loader',
                  exclude: /node_modules/
                }
              ]
            },
  </code></pre>
  
  <p>to the end of the list of rules (just before the file loader).</p>
  
  <p>When I do this as well as setting up the <code>plugins/index</code> file as indicated in the article, the cypress "home screen" runs but when I click to open my tests, it takes very many seconds and then shows lots of errors, starting with </p>
  
  <pre><code>integration\settings.spec.ts
  This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
  
  A missing file or dependency
  A syntax error in the file or one of its dependencies
  Fix the error in your code and re-run your tests.
  
  ./cypress/integration/settings.spec.ts
  Module build failed (from ./node_modules/ts-loader/index.js):
  Error: TypeScript emitted no output for C:\Users\...\...\front_end\cypress\integration\settings.spec.ts.
   @ multi ./cypress/integration/settings.spec.ts main[0]
  </code></pre>
  
  <p>Followed by, actually, a lot of Typescript output such as this:</p>
  
  <pre><code>C:\Users\jtuzman\dev\...\...\src\__tests__\Errors.test.tsx
  [tsl] ERROR in C:\Users\jtuzman\dev\...\...\src\__tests__\Errors.test.tsx(37,41)
        TS2339: Property 'toBeTruthy' does not exist on type 'Assertion'.
  
  C:\Users\jtuzman\dev\...\...\src\__tests__\Errors.test.tsx
  [tsl] ERROR in C:\Users\jtuzman\dev\...\...\src\__tests__\Errors.test.tsx(41,45)
        TS2339: Property 'toBeDefined' does not exist on type 'Assertion'.
  </code></pre>
  
  <p>Notice that these are now errors for code outside the test files (although perhaps that makes sense). Many of them are for files in which I'm using Jest rather than Cypress, and many errors, as you can see, seem to be related to it inferring an <code>Assertion</code> type on <code>expect</code> that is not Jest, such that it thinks the <code>toEqual</code> matcher is wrong. </p>
  
  <p>All the while, in Webstorm ESLint is still complaining about all my <code>cy</code> and TypeScript is underlining all those Jest assertions mentioned in the output.</p>
  
  <p>This is all with a ts test file. If I rename the file to js, it says the file has no tests.</p>
  
  <p>Any help? I love Cypress but I'm having a hell of a time getting it to work fully!</p>