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

Use default exports for handler classes #520

Closed
tegefaulkes opened this issue Apr 6, 2023 · 7 comments · Fixed by #567
Closed

Use default exports for handler classes #520

tegefaulkes opened this issue Apr 6, 2023 · 7 comments · Fixed by #567
Assignees
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management

Comments

@tegefaulkes
Copy link
Contributor

tegefaulkes commented Apr 6, 2023

Specification

As a standard we want to use default exports if a file exports a single class. The client handlers used to export the caller and handler definition. Now it's just the handler so it needs to be updated to a default export.

Additional context

Tasks

  1. update all of the client handlers to use default exports.
@tegefaulkes tegefaulkes added the development Standard development label Apr 6, 2023
@tegefaulkes
Copy link
Contributor Author

I accidentally created this to soon. let me edit it.

@tegefaulkes tegefaulkes self-assigned this Apr 6, 2023
@tegefaulkes
Copy link
Contributor Author

Is there any technical reason to use default exports?

I think named exports are just generally better for maintainability. They prevent renaming things when you import them. Otherwise it's possible for the imported and exported name to become out of sync.

@CMCDragonkai
Copy link
Member

It's just convention and consistency. Actually both can be used at the same time. Sometimes I provide a default export and named exports. But the name of the file should always be the same as the name of the default export.

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management label Jul 9, 2023
@CMCDragonkai
Copy link
Member

See if you can do this before we extract out all the CLI to Polykey-CLI.

@CMCDragonkai CMCDragonkai self-assigned this Sep 29, 2023
@CMCDragonkai
Copy link
Member

Doing this now in #552.

1 similar comment
@CMCDragonkai
Copy link
Member

Doing this now in #552.

@CMCDragonkai
Copy link
Member

I think you used suffix naming. XHandler. Whereas usually we prefer prefix naming. Like EventX, or ErrorX, so HandlerX should be used instead.

But since the entire directory is this... it could be shortened to just X. In this case instead of NodesClaimsGetHandler, it could just be NodesClaimsGet. Subject, object verb order.

I'm dropping the Handler name then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management
2 participants