Skip to content
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

Error with @nrwl/nx/enforce-module-boundaries ESLint rule - Cannot read property 'map' of undefined #6864

Closed
zjkipping opened this issue Aug 26, 2021 · 4 comments · Fixed by #9192
Assignees
Labels
outdated scope: linter Issues related to Eslint support in Nx type: bug

Comments

@zjkipping
Copy link

Current Behavior

run nx lint library-name
Get error logs below:

Cannot read property 'map' of undefined
Occured whille linting C:\....

This occurs while the lib in question has nx module boundaries defined by the nx.json & .eslintrc.json

Expected Behavior

run nx lint library-name
Get actual linting errors/warnings

This can be achieved by setting our lib to a scope that has * for onlyDependOnLibsWithTags. Basically removing the nx module boundaries for the lib and circumnavigating the eslint rule that is breaking.

Steps to Reproduce

Using nx empty workspace with angular added for version 12.7.2 of @nrwl dependencies. Besides this I don't know how to reproduce & cannot share any of the source code of the project. Though I know of other projects that have experienced similar errors in vscode (not the command line like my behavior above).

Failure Logs

Unfortunately the logs in the Current Behavior section is all that is outputted in the console...

Environment

Node: 14.17.0
OS : win32 x64
yarn : 1.22.5

nx : Not Found
@nrwl/angular : 12.7.2
@nrwl/cli : 12.7.2
@nrwl/cypress : 12.7.2
@nrwl/devkit : 12.7.2
@nrwl/eslint-plugin-nx : 12.7.2
@nrwl/express : Not Found
@nrw/jest : 12.7.2
@nrwl/linter : 12.7.2
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.7.2
@nrwl/web : Not Found
@nrwl/workspace : 12.7.2
@nrwl/storybook : 12.7.2
@nrwl/gatsby : Not Found
typescript : 4.3.5

@zjkipping
Copy link
Author

zjkipping commented Aug 26, 2021

Looking into the source code for the rule I realized the depConstraints object we have had no onlyDependOnLibsWithTags property. Adding that property with a value of [] gave us the expected behavior.

Possibly it would be worth having better error handling here in case this bit of the json is missing?

@leosvelperez leosvelperez added the scope: misc Misc issues label Aug 27, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Feb 24, 2022
@AgentEnder
Copy link
Member

@meeroslav This would be more relevant now that we have banned imports support, as they may not have any tag based constraints. Do you care to take a look?

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: linter Issues related to Eslint support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants