title: Cannot read property 'name' of undefined Occurred while linting in React
body: <p>I have this really weird &quot;<em>bug</em>&quot; I guess you can call it with <strong>eslint</strong> when I try and run <code>yarn lint</code></p>
  <pre><code>$ tsc --noEmit &amp;&amp; eslint src/**/*.ts{,x}
  </code></pre>
  <p>For some reason it fails with</p>
  <pre><code>Oops! Something went wrong! :(
  
  ESLint: 7.32.0
  
  TypeError: Cannot read property 'name' of undefined
  Occurred while linting /Users/Reynaldo/Documents/cafemat/src/hooks/useFirebase.ts:13
      at ExpressionStatement (/Users/Reynaldo/Documents/cafemat/node_modules/eslint-plugin-storybook/lib/rules/prefer-csf.js:18:44)
      at /Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/safe-emitter.js:45:58
      at Array.forEach (&lt;anonymous&gt;)
      at Object.emit (/Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
      at NodeEventGenerator.applySelector (/Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
      at NodeEventGenerator.applySelectors (/Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/node-event-generator.js:322:22)
      at NodeEventGenerator.enterNode (/Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/node-event-generator.js:336:14)
      at CodePathAnalyzer.enterNode (/Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
      at /Users/Reynaldo/Documents/cafemat/node_modules/eslint/lib/linter/linter.js:960:32
      at Array.forEach (&lt;anonymous&gt;)
  error Command failed with exit code 2.
  </code></pre>
  <p>Also, if I have my <strong>useFirebase.ts</strong> file focused (in view) on VSCode and run <code>yarn start</code> I get the error:</p>
  <pre><code>Failed to compile
  
  Cannot read property 'name' of undefined
  Occurred while linting /Users/Reynaldo/Documents/cafemat/src/hooks/useFirebase.ts:13
  This error occurred during the build time and cannot be dismissed.
  </code></pre>
  <p>Yet if I put in focus (into view) any other file on VSCode and run <code>yarn start</code> the project compiles and runs without problems.</p>
  <p>Is this a weird bug or am I doing something wrong? Here are the files:</p>
  <p><code>useFirebase.ts</code></p>
  <pre class="lang-js prettyprint-override"><code>import { useEffect, useState } from &quot;react&quot;;
  
  import { FirebaseApp, deleteApp, getApp, initializeApp } from &quot;firebase/app&quot;;
  import { appName, firebaseConfig } from &quot;../config/firebaseConfig&quot;;
  
  function useFirebase(): FirebaseApp | null {
    const [firebaseApp, setFirebaseApp] = useState&lt;FirebaseApp | null&gt;(null);
  
    useEffect(() =&gt; {
      let app: FirebaseApp;
  
      try {
        app = getApp(appName);
      } 
      catch (err) {
        app = initializeApp(firebaseConfig, appName);
      }
  
      setFirebaseApp(app);
  
      return () =&gt; {
        deleteApp(app);
      };
    }, []);
  
    return firebaseApp;
  }
  
  export default useFirebase;
  </code></pre>
  <p><code>package.json</code></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;xxxxxxx&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@reach/router&quot;: &quot;1.3.4&quot;,
      &quot;firebase&quot;: &quot;9.1.3&quot;,
      &quot;react&quot;: &quot;17.0.2&quot;,
      &quot;react-dom&quot;: &quot;17.0.2&quot;,
      &quot;react-helmet-async&quot;: &quot;1.1.2&quot;,
      &quot;react-scripts&quot;: &quot;4.0.3&quot;,
      &quot;web-vitals&quot;: &quot;1.0.1&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;craco start&quot;,
      &quot;build&quot;: &quot;craco build&quot;,
      &quot;test&quot;: &quot;craco test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;,
      &quot;format&quot;: &quot;prettier --write 'src/**/*.ts{,x}'&quot;,
      &quot;lint&quot;: &quot;tsc --noEmit &amp;&amp; eslint src/**/*.ts{,x}&quot;,
      &quot;cypress:open&quot;: &quot;cypress open&quot;,
      &quot;storybook&quot;: &quot;start-storybook -p 6006 -s public&quot;,
      &quot;build-storybook&quot;: &quot;build-storybook -s public&quot;,
      &quot;serve&quot;: &quot;serve -s build&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: [
        &quot;react-app&quot;,
        &quot;react-app/jest&quot;
      ],
      &quot;overrides&quot;: [
        {
          &quot;files&quot;: [
            &quot;**/*.stories.*&quot;
          ],
          &quot;rules&quot;: {
            &quot;import/no-anonymous-default-export&quot;: &quot;off&quot;
          }
        }
      ]
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;
      ]
    },
    &quot;devDependencies&quot;: {
      &quot;@craco/craco&quot;: &quot;^6.2.0&quot;,
      &quot;@storybook/addon-actions&quot;: &quot;^6.3.2&quot;,
      &quot;@storybook/addon-essentials&quot;: &quot;^6.3.2&quot;,
      &quot;@storybook/addon-links&quot;: &quot;^6.3.2&quot;,
      &quot;@storybook/node-logger&quot;: &quot;^6.3.2&quot;,
      &quot;@storybook/preset-create-react-app&quot;: &quot;^3.1.7&quot;,
      &quot;@storybook/react&quot;: &quot;^6.3.2&quot;,
      &quot;@tailwindcss/postcss7-compat&quot;: &quot;^2.2.4&quot;,
      &quot;@testing-library/jest-dom&quot;: &quot;^5.14.1&quot;,
      &quot;@testing-library/react&quot;: &quot;^11.1.0&quot;,
      &quot;@testing-library/user-event&quot;: &quot;^12.1.10&quot;,
      &quot;@types/jest&quot;: &quot;^26.0.15&quot;,
      &quot;@types/node&quot;: &quot;^12.0.0&quot;,
      &quot;@types/reach__router&quot;: &quot;^1.3.9&quot;,
      &quot;@types/react&quot;: &quot;^17.0.13&quot;,
      &quot;@types/react-dom&quot;: &quot;^17.0.0&quot;,
      &quot;@types/react-helmet&quot;: &quot;^6.1.2&quot;,
      &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^4.28.1&quot;,
      &quot;@typescript-eslint/parser&quot;: &quot;^4.28.1&quot;,
      &quot;autoprefixer&quot;: &quot;^9&quot;,
      &quot;babel-loader&quot;: &quot;8.1.0&quot;,
      &quot;cypress&quot;: &quot;^7.6.0&quot;,
      &quot;eslint&quot;: &quot;^7.2.0&quot;,
      &quot;eslint-config-airbnb&quot;: &quot;18.2.1&quot;,
      &quot;eslint-config-airbnb-typescript&quot;: &quot;^12.3.1&quot;,
      &quot;eslint-config-prettier&quot;: &quot;^8.3.0&quot;,
      &quot;eslint-plugin-chai-friendly&quot;: &quot;^0.7.1&quot;,
      &quot;eslint-plugin-cypress&quot;: &quot;^2.11.3&quot;,
      &quot;eslint-plugin-import&quot;: &quot;^2.22.1&quot;,
      &quot;eslint-plugin-jest&quot;: &quot;^24.3.6&quot;,
      &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.4.1&quot;,
      &quot;eslint-plugin-prettier&quot;: &quot;^3.4.0&quot;,
      &quot;eslint-plugin-react&quot;: &quot;^7.21.5&quot;,
      &quot;eslint-plugin-react-hooks&quot;: &quot;^1.7.0&quot;,
      &quot;eslint-plugin-storybook&quot;: &quot;^0.1.1&quot;,
      &quot;postcss&quot;: &quot;^7&quot;,
      &quot;postcss-cli&quot;: &quot;^8.3.1&quot;,
      &quot;prettier&quot;: &quot;^2.3.2&quot;,
      &quot;tailwindcss&quot;: &quot;npm:@tailwindcss/postcss7-compat&quot;,
      &quot;typescript&quot;: &quot;^4.1.2&quot;
    }
  }
  
  </code></pre>
  <p><code>.eslintrc</code></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;extends&quot;: [
      &quot;airbnb-typescript&quot;,
      &quot;airbnb/hooks&quot;,
      &quot;plugin:@typescript-eslint/recommended&quot;,
      &quot;plugin:jest/recommended&quot;,
      &quot;plugin:prettier/recommended&quot;,
      &quot;plugin:cypress/recommended&quot;,
      &quot;plugin:chai-friendly/recommended&quot;
    ],
    &quot;plugins&quot;: [
      &quot;react&quot;, 
      &quot;@typescript-eslint&quot;, 
      &quot;jest&quot;, 
      &quot;cypress&quot;, 
      &quot;chai-friendly&quot;, 
      &quot;storybook&quot;
    ],
    &quot;env&quot;: {
      &quot;browser&quot;: true,
      &quot;es6&quot;: true,
      &quot;jest&quot;: true,
      &quot;cypress/globals&quot;: true
    },
    &quot;globals&quot;: {
      &quot;Atomics&quot;: &quot;readonly&quot;,
      &quot;SharedArrayBuffer&quot;: &quot;readonly&quot;
    },
    &quot;parser&quot;: &quot;@typescript-eslint/parser&quot;,
    &quot;parserOptions&quot;: {
      &quot;ecmaFeatures&quot;: {
        &quot;jsx&quot;: true
      },
      &quot;ecmaVersion&quot;: 2018,
      &quot;sourceType&quot;: &quot;module&quot;,
      &quot;project&quot;: &quot;./tsconfig.json&quot;
    },
    &quot;rules&quot;: {
      &quot;linebreak-style&quot;: &quot;off&quot;,
      &quot;prettier/prettier&quot;: [
        &quot;error&quot;,
        {
          &quot;endOfLine&quot;: &quot;auto&quot;
        }
      ],
      &quot;cypress/no-assigning-return-values&quot;: &quot;error&quot;,
      &quot;cypress/no-unnecessary-waiting&quot;: &quot;error&quot;,
      &quot;cypress/assertion-before-screenshot&quot;: &quot;warn&quot;,
      &quot;cypress/no-force&quot;: &quot;warn&quot;,
      &quot;cypress/no-async-tests&quot;: &quot;error&quot;,
      &quot;no-unused-expressions&quot;: 0,
      &quot;chai-friendly/no-unused-expressions&quot;: 2,
      &quot;storybook/prefer-csf&quot;: &quot;error&quot;
    }
  }
  </code></pre>
  <p><code>.eslintignore</code></p>
  <pre><code># Temporary lint ignore because storybook example files
  # generated files that go against specified ESLint rules.
    src/stories
  # ESLinting error taken off by ignoring config files
  # https://stackoverflow.com/questions/58510287/parseroptions-project-has-been-set-for-typescript-eslint-parser/64488474#64488474
    tailwind.config.js
    postcss.config.js
    craco.config.js
  </code></pre>