Skip to content

TypeError: Cannot read property 'name' of undefined for no-debug #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tdeekens opened this issue Mar 30, 2020 · 9 comments · Fixed by #102
Closed

TypeError: Cannot read property 'name' of undefined for no-debug #101

tdeekens opened this issue Mar 30, 2020 · 9 comments · Fixed by #102
Assignees
Labels
bug Something isn't working released

Comments

@tdeekens
Copy link

We adopted the react preset recently and are seeing failing builds on CI with the error TypeError: Cannot read property 'name' of undefined. Which seems to originate from this code:

ImportDeclaration(node) {
    const screenModuleName = LIBRARY_MODULES_WITH_SCREEN.find(
      module => module === node.source.value
    );

    if (
      screenModuleName &&
      node.specifiers.some(
        specifier => specifier.imported.name === 'screen'
      )
    ) {
      hasImportedScreen = true;
    }
},

in no-debug.js on line 95.

CleanShot 2020-03-30 at 10 29 58@2x

We are also seeing the error on a GitHub Action build to inspect for you.

https://github.com/commercetools/merchant-center-application-kit/pull/1419/checks?check_run_id=544774992

@Belco90
Copy link
Member

Belco90 commented Mar 30, 2020

Hey Tobias, thanks for reporting the error. Sorry about this, I'll take a look a it this morning, should be easy to fix. Pretty awesome how much info you added to the issue :)

@tdeekens
Copy link
Author

You're welcome. I do some Open Source myself so I know how hard (also emotionally) it can be to get an issue with little to no context 😄. Thanks for the quick response.

@Belco90
Copy link
Member

Belco90 commented Mar 30, 2020

I found the issue: wildcard imports like import * as rtl from '@testing-library/react'; are not taken into account properly. Checking how to fix it properly.

@Belco90
Copy link
Member

Belco90 commented Mar 30, 2020

@tdeekens fixed btw, just waiting for the PR to be approved. I'm checking meanwhile another rule that could be affected by the same issue!

@tdeekens
Copy link
Author

Wow, super fast. Thanks!

Belco90 added a commit that referenced this issue Mar 31, 2020
* fix(no-debug): check namespaced imports
* fix(prefer-wait-for): check namespaced imports

Closes #101
@Belco90
Copy link
Member

Belco90 commented Mar 31, 2020

🎉 This issue has been resolved in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tdeekens
Copy link
Author

Thanks bot. Thanks human :)

@Belco90
Copy link
Member

Belco90 commented Mar 31, 2020

@all-contributors please add @tdeekens for bug

@allcontributors
Copy link
Contributor

@Belco90

I've put up a pull request to add @tdeekens! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
2 participants