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

fixing early return error and lint errors #16379

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Feb 14, 2023

Description

Fixing an error in the Prebuilds page component that had an early return before all of the hooks. One of the rules of hooks is that your hooks should all come before any returns so that they all run, in the same order, on every render in a component. I've fixed this particular issue.

It's quite easy to mix up something like this with hooks, so there are builtin (to create react app) eslint rules to detect these types of problems. Unfortunately we didn't have it caught because of a rule we had turned off - import/no-anonymous-default-export. When this is off, it allows you to have an anonymous default export for a component, which results in some of the other hook related eslint plugins/rules not detecting it's a component. More context here.

I've turned the rule back on, and fixed the few spots where we had default anonymous exports. This should help us avoid these kinds of pitfalls and see them as linter errors earlier (which will be blocking as soon as we resolve the remaining errors).

How to test

This thread has some context for testing the related issue w/ the Prebuilds page. The rest of the changes shouldn't have any visible impact.

Release Notes

NONE

Documentation

Build Options:

  • /werft with-github-actions
    Experimental feature to run the build with GitHub Actions (and not in Werft).
  • leeway-no-cache
    leeway-target=components:all
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-ee-license
  • with-slow-database
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-bmh-prebuilds-early-return-error.1 because the annotations in the pull request description changed
(with .werft/ from main)

@selfcontained selfcontained marked this pull request as ready for review February 14, 2023 00:09
@selfcontained selfcontained requested a review from a team February 14, 2023 00:09
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Feb 14, 2023
Copy link
Member

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇🏻‍♂️

@roboquat roboquat merged commit 24979dc into main Feb 14, 2023
@roboquat roboquat deleted the bmh/prebuilds-early-return-error branch February 14, 2023 08:05
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants