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

Add no-cycle eslint rule #247

Merged

Conversation

nicholas-l
Copy link
Contributor

We are trying to mock our imports of react-resource-router using snippet below, however due to the cyclic import of react-resource-router, we are getting a "Cannot read properties of undefined (reading 'ResourceDependencyError')". I believe this is due to the cyclic imports that means when Jest tries to import the actual module, and then when the submodules in react-resource-router imports the root index file, this file points to the Jest mock which has not been fully set up. This causes an property of undefined error.

jest.mock('react-resource-router', () => ({
   ...jest.requireActual('react-resource-router'),
   useRouter: jest.fn(),
});

Copy link

changeset-bot bot commented Nov 5, 2024

🦋 Changeset detected

Latest commit: cb59d99

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-resource-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

.eslintrc.js Outdated Show resolved Hide resolved
@JakeLane JakeLane merged commit a627bb6 into atlassian-labs:master Nov 7, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants