-
Notifications
You must be signed in to change notification settings - Fork 39
refactor(frontend): Convert all Leptos component function names to PascalCase #822
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
base: main
Are you sure you want to change the base?
Conversation
…scalCase - Renamed 121 component functions from snake_case to PascalCase - Improves consistency between function definitions and component usage in JSX - Makes component functions easier to search and identify - All component definitions now match their usage in view! macros - Build verified successfully with no errors Examples of changes: - experiment_list -> ExperimentList - button -> Button - side_nav -> SideNav - experiment_form -> ExperimentForm
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughSystematic refactoring of Leptos component function names across the frontend codebase from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~45 minutes The refactoring is predominantly systematic rename operations with a highly repetitive pattern, lowering per-file complexity. However, the sheer scope (60+ files) and scattered functional enhancements in key components ( Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Should we consider adding some lint check to force PascalCase for functions with component macro? |
- Created scripts/check_component_names.sh to enforce PascalCase naming - Integrated linter into `make check` target - Automatically runs in CI via existing check workflow - Prevents regression to snake_case component names The linter scans all Leptos component functions and ensures they use PascalCase naming convention for consistency with JSX usage. Also fixed makefile syntax issues: - Corrected .PHONY declaration format - Fixed tab/space inconsistency in ifeq block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
crates/frontend/src/pages/type_template.rs (1)
25-25: Complete the refactoring: Rename private component to PascalCase.The private component function
type_infoshould be renamed toTypeInfoto maintain consistency with the PR's objective of converting all Leptos component function names to PascalCase. While Line 149 uses<TypeInfo />in the view macro (which works due to Leptos's macro transformation), the PR aims to align function definitions with their usage for better searchability and consistency.🔎 Proposed fix
#[component] -fn type_info(type_template: TypeTemplate) -> impl IntoView { +fn TypeInfo(type_template: TypeTemplate) -> impl IntoView { view! { <div class="card bg-base-100 max-w-screen shadow">crates/frontend/src/pages/organisations.rs (1)
68-68: Fix typo in heading text.The heading text contains a typo: "Oraganisations" should be "Organisations".
🔎 Proposed fix
- <Stat - heading="Oraganisations" - icon="ri-building-fill" - number=organisations.len().to_string() - /> + <Stat + heading="Organisations" + icon="ri-building-fill" + number=organisations.len().to_string() + />crates/frontend/src/components/webhook_form.rs (1)
266-266: Fix typo in label text.Line 266 contains a typo: "Paylaod Version" should be "Payload Version".
🔎 Proposed fix
- <Label title="Paylaod Version" /> + <Label title="Payload Version" />crates/frontend/src/components/experiment_form.rs (1)
379-385: Inconsistent naming:change_log_summaryshould beChangeLogSummary.This internal component function is still using snake_case, which contradicts the PR objective of converting all Leptos component function names to PascalCase. While Leptos's
#[component]macro does auto-convert the usage, the function definition itself should be renamed for consistency with the rest of the refactor.🔎 Proposed fix
#[component] -fn change_log_summary( +fn ChangeLogSummary( experiment_id: String, update_request: OverrideKeysUpdateRequest, #[prop(into)] on_confirm: Callback<()>, #[prop(into)] on_close: Callback<()>, ) -> impl IntoView {
🧹 Nitpick comments (7)
scripts/check_component_names.sh (1)
30-30: Use portable sed flag for broader compatibility.The
-rflag is GNU sed-specific. On BSD/macOS systems, you should use-Einstead for extended regex. Consider using a portable approach.🔎 Proposed fix for portability
- pascal_name=$(echo "$func_name" | sed -r 's/(^|_)([a-z])/\U\2/g') + pascal_name=$(echo "$func_name" | sed -E 's/(^|_)([a-z])/\U\2/g')Note: Both
-r(GNU) and-E(BSD/GNU) enable extended regex, but-Eis more portable as it's supported by both GNU sed and BSD sed (macOS).crates/frontend/src/pages/webhook.rs (1)
26-26: Consider renaming private component for consistency.The private component function
webhook_infoat Line 26 wasn't renamed to PascalCase, though it's used as<WebhookInfo />at Line 200. While private components may have been intentionally excluded from this refactor, renaming it toWebhookInfowould ensure all component definitions match their JSX usage, as stated in the PR objectives.🔎 Proposed refactor
#[component] -fn webhook_info(webhook: Webhook) -> impl IntoView { +fn WebhookInfo(webhook: Webhook) -> impl IntoView {crates/frontend/src/components/info_modal.rs (1)
4-4: Consider renaming private component for consistency.Similar to other private components in the codebase,
info_sectionis used as<InfoSection />(line 52), creating a definition/usage mismatch. Renaming toInfoSectionwould provide complete consistency with the PR's stated goal of matching component definitions to their usage in view macros.🔎 Proposed refactor
#[component] -fn info_section( +fn InfoSection( title: &'static str, icon: &'static str, content: String, ) -> impl IntoView {crates/frontend/src/pages/experiment_groups.rs (1)
130-130: Rename private component to match linter's scope expectations (optional).The private component
experiment_group_infois used as<ExperimentGroupInfo />(line 270), but the added linter script (scripts/check_component_names.sh) only enforces PascalCase naming for public components (those withpub fn). Since this is a private component, it is not caught by the linter. Renaming toExperimentGroupInfowould improve consistency with the usage pattern, though it remains optional.crates/frontend/src/pages/variable.rs (1)
20-20: Consider renaming private component to PascalCase for consistency.While the public
Variablecomponent was correctly renamed to PascalCase, the privatevariable_infocomponent remains in snake_case. For consistency within the file and alignment with the Leptos component convention, consider renaming it toVariableInfo.crates/frontend/src/components/experiment.rs (1)
29-29: Consider renaming private components for consistency.While Leptos automatically converts snake_case component names to PascalCase in view! macros, renaming these private components (
experiment_info,create_actions,inprogress_actions,conclude_actions,discard_actions,pause_actions) to PascalCase would improve consistency with the refactoring goal and make the component definitions match their usage patterns.Also applies to: 148-148, 181-181, 222-222, 237-237, 242-242
crates/frontend/src/components/context_card.rs (1)
20-44: Rename private components to PascalCase for consistency with JSX usage.The
optionandcontext_optionsfunctions are private components but are used in the view as<Option>and<ContextOptions>. While the linter script only enforces PascalCase on public components, these private components should still follow PascalCase naming for consistency with how they appear in JSX templates. Rename them toOptionandContextOptionsrespectively.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (82)
crates/frontend/src/app.rscrates/frontend/src/components/alert.rscrates/frontend/src/components/badge.rscrates/frontend/src/components/button.rscrates/frontend/src/components/change_form.rscrates/frontend/src/components/change_summary.rscrates/frontend/src/components/cohort_schema.rscrates/frontend/src/components/condition_pills.rscrates/frontend/src/components/context_card.rscrates/frontend/src/components/context_form.rscrates/frontend/src/components/datetime.rscrates/frontend/src/components/default_config_form.rscrates/frontend/src/components/delete_modal.rscrates/frontend/src/components/description.rscrates/frontend/src/components/dimension_form.rscrates/frontend/src/components/drawer.rscrates/frontend/src/components/dropdown.rscrates/frontend/src/components/experiment.rscrates/frontend/src/components/experiment_action_form.rscrates/frontend/src/components/experiment_conclude_form.rscrates/frontend/src/components/experiment_form.rscrates/frontend/src/components/experiment_group_form.rscrates/frontend/src/components/experiment_ramp_form.rscrates/frontend/src/components/form/label.rscrates/frontend/src/components/function_form.rscrates/frontend/src/components/info_modal.rscrates/frontend/src/components/input.rscrates/frontend/src/components/menu.rscrates/frontend/src/components/metrics_form.rscrates/frontend/src/components/modal.rscrates/frontend/src/components/monaco_editor.rscrates/frontend/src/components/override_form.rscrates/frontend/src/components/pagination.rscrates/frontend/src/components/side_nav.rscrates/frontend/src/components/skeleton.rscrates/frontend/src/components/stat.rscrates/frontend/src/components/table.rscrates/frontend/src/components/tip.rscrates/frontend/src/components/toast.rscrates/frontend/src/components/tooltip.rscrates/frontend/src/components/type_template_form.rscrates/frontend/src/components/variable_form.rscrates/frontend/src/components/variant_form.rscrates/frontend/src/components/webhook_form.rscrates/frontend/src/components/workspace_form.rscrates/frontend/src/hoc/layout.rscrates/frontend/src/pages/audit_log/filter.rscrates/frontend/src/pages/compare_overrides.rscrates/frontend/src/pages/config_version.rscrates/frontend/src/pages/config_version_list.rscrates/frontend/src/pages/context_override.rscrates/frontend/src/pages/context_override/filter.rscrates/frontend/src/pages/default_config.rscrates/frontend/src/pages/default_config_list.rscrates/frontend/src/pages/default_config_list/utils.rscrates/frontend/src/pages/dimension.rscrates/frontend/src/pages/dimensions.rscrates/frontend/src/pages/experiment.rscrates/frontend/src/pages/experiment_group_listing.rscrates/frontend/src/pages/experiment_groups.rscrates/frontend/src/pages/experiment_list.rscrates/frontend/src/pages/function.rscrates/frontend/src/pages/function/function_create.rscrates/frontend/src/pages/function/function_list.rscrates/frontend/src/pages/function/publish_form.rscrates/frontend/src/pages/home.rscrates/frontend/src/pages/not_found.rscrates/frontend/src/pages/organisations.rscrates/frontend/src/pages/type_template.rscrates/frontend/src/pages/type_templates.rscrates/frontend/src/pages/variable.rscrates/frontend/src/pages/variables_list.rscrates/frontend/src/pages/variables_list/filter.rscrates/frontend/src/pages/webhook.rscrates/frontend/src/pages/webhooks.rscrates/frontend/src/pages/workspace.rscrates/frontend/src/providers/alert_provider.rscrates/frontend/src/providers/condition_collapse_provider.rscrates/frontend/src/providers/csr_provider.rscrates/frontend/src/providers/editor_provider.rsmakefilescripts/check_component_names.sh
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2026-01-03T13:25:35.248Z
Learnt from: ayushjain17
Repo: juspay/superposition PR: 816
File: crates/frontend/src/pages/webhook.rs:136-137
Timestamp: 2026-01-03T13:25:35.248Z
Learning: In crates/frontend/src/pages/webhook.rs, Workspace and OrganisationId are newtypes that implement Deref to &str, enabling implicit coercion of &Workspace and &OrganisationId to &str when passed to functions expecting &str. Reviewers should verify this coercion behavior is intentional and documented, and avoid unnecessary manual .0 dereferencing in this file. If similar newtypes exist elsewhere, consider consistent Deref implementations and explicitness of API boundaries.
Applied to files:
crates/frontend/src/pages/webhook.rs
📚 Learning: 2026-01-05T12:37:05.828Z
Learnt from: ayushjain17
Repo: juspay/superposition PR: 815
File: crates/frontend/src/components/datetime.rs:70-95
Timestamp: 2026-01-05T12:37:05.828Z
Learning: Documentation should reflect build-target dependent behavior. For functions that differ between wasm32 and non-wasm32 (e.g., datetime parsing/normalization), explicitly document the intent and the platform-specific logic in the code and/or a nearby comment. Prefer using cfg attributes to clearly separate implementations for wasm32 vs non-wasm32 and add tests that cover both builds. In this case, the function should be noted as: wasm32 -> local midnight interpreted then converted to UTC; non-wasm32 (SSR) -> UTC midnight directly. Ensure any related behavior is consistent with the SSR/CSR architecture and that downstream code relies on the clarified semantics.
Applied to files:
crates/frontend/src/components/experiment_form.rscrates/frontend/src/components/workspace_form.rscrates/frontend/src/components/alert.rscrates/frontend/src/components/experiment_conclude_form.rscrates/frontend/src/components/skeleton.rscrates/frontend/src/components/tip.rscrates/frontend/src/components/experiment_ramp_form.rscrates/frontend/src/components/dropdown.rscrates/frontend/src/components/input.rscrates/frontend/src/components/pagination.rscrates/frontend/src/components/menu.rscrates/frontend/src/components/delete_modal.rscrates/frontend/src/components/tooltip.rscrates/frontend/src/components/context_form.rscrates/frontend/src/components/experiment_action_form.rscrates/frontend/src/components/button.rscrates/frontend/src/components/variant_form.rscrates/frontend/src/components/experiment.rscrates/frontend/src/components/override_form.rscrates/frontend/src/components/datetime.rscrates/frontend/src/components/description.rscrates/frontend/src/components/context_card.rscrates/frontend/src/components/metrics_form.rscrates/frontend/src/components/dimension_form.rscrates/frontend/src/components/change_form.rscrates/frontend/src/components/function_form.rscrates/frontend/src/components/side_nav.rscrates/frontend/src/components/change_summary.rscrates/frontend/src/components/toast.rscrates/frontend/src/components/modal.rscrates/frontend/src/components/experiment_group_form.rscrates/frontend/src/components/monaco_editor.rscrates/frontend/src/components/drawer.rscrates/frontend/src/components/form/label.rscrates/frontend/src/components/type_template_form.rscrates/frontend/src/components/stat.rscrates/frontend/src/components/webhook_form.rscrates/frontend/src/components/variable_form.rscrates/frontend/src/components/info_modal.rscrates/frontend/src/components/condition_pills.rscrates/frontend/src/components/badge.rscrates/frontend/src/components/default_config_form.rscrates/frontend/src/components/cohort_schema.rscrates/frontend/src/components/table.rs
📚 Learning: 2026-01-03T13:27:14.072Z
Learnt from: ayushjain17
Repo: juspay/superposition PR: 816
File: crates/frontend/src/pages/type_template.rs:82-87
Timestamp: 2026-01-03T13:27:14.072Z
Learning: In the frontend crate, both `Workspace` and `OrganisationId` types implement `Deref` trait (via `#[derive(Deref)]`), allowing automatic coercion from `&Workspace` to `&str` and `&OrganisationId` to `&str`. When passing these types to functions expecting `&str`, use `&workspace` or `&org` directly instead of `&workspace.0` or `&org.0`.
Applied to files:
crates/frontend/src/pages/organisations.rscrates/frontend/src/components/workspace_form.rscrates/frontend/src/pages/config_version.rscrates/frontend/src/pages/dimensions.rscrates/frontend/src/pages/home.rscrates/frontend/src/pages/type_templates.rscrates/frontend/src/pages/workspace.rscrates/frontend/src/pages/type_template.rscrates/frontend/src/pages/variable.rs
📚 Learning: 2026-01-03T13:25:40.584Z
Learnt from: ayushjain17
Repo: juspay/superposition PR: 816
File: crates/frontend/src/pages/webhook.rs:136-137
Timestamp: 2026-01-03T13:25:40.584Z
Learning: In the superposition codebase (Rust frontend), the `Workspace` and `OrganisationId` newtype wrappers implement `Deref`, which allows `&Workspace` and `&OrganisationId` to be automatically coerced to `&str` when passed to functions expecting `&str` parameters. Manual `.0` dereferencing is not needed.
Applied to files:
crates/frontend/src/components/workspace_form.rscrates/frontend/src/pages/config_version.rscrates/frontend/src/pages/home.rscrates/frontend/src/pages/workspace.rscrates/frontend/src/pages/variable.rs
🧬 Code graph analysis (8)
crates/frontend/src/components/dimension_form.rs (5)
crates/frontend/src/components/default_config_form.rs (1)
ChangeLogSummary(536-700)crates/frontend/src/components/experiment_group_form.rs (1)
ChangeLogSummary(433-568)crates/frontend/src/components/type_template_form.rs (1)
ChangeLogSummary(215-325)crates/frontend/src/components/variable_form.rs (1)
ChangeLogSummary(212-316)crates/frontend/src/components/webhook_form.rs (1)
ChangeLogSummary(365-529)
crates/frontend/src/components/toast.rs (1)
crates/frontend/src/components/alert.rs (1)
Alert(60-70)
crates/frontend/src/pages/audit_log/filter.rs (1)
crates/frontend/src/pages/variables_list/filter.rs (1)
FilterSummary(17-156)
crates/frontend/src/components/experiment_group_form.rs (5)
crates/frontend/src/components/default_config_form.rs (1)
ChangeLogSummary(536-700)crates/frontend/src/components/dimension_form.rs (1)
ChangeLogSummary(614-767)crates/frontend/src/components/type_template_form.rs (1)
ChangeLogSummary(215-325)crates/frontend/src/components/variable_form.rs (1)
ChangeLogSummary(212-316)crates/frontend/src/components/webhook_form.rs (1)
ChangeLogSummary(365-529)
crates/frontend/src/pages/variables_list/filter.rs (1)
crates/frontend/src/pages/audit_log/filter.rs (1)
FilterSummary(20-169)
crates/frontend/src/components/webhook_form.rs (5)
crates/frontend/src/components/default_config_form.rs (1)
ChangeLogSummary(536-700)crates/frontend/src/components/dimension_form.rs (1)
ChangeLogSummary(614-767)crates/frontend/src/components/experiment_group_form.rs (1)
ChangeLogSummary(433-568)crates/frontend/src/components/type_template_form.rs (1)
ChangeLogSummary(215-325)crates/frontend/src/components/variable_form.rs (1)
ChangeLogSummary(212-316)
crates/frontend/src/components/variable_form.rs (5)
crates/frontend/src/components/default_config_form.rs (1)
ChangeLogSummary(536-700)crates/frontend/src/components/dimension_form.rs (1)
ChangeLogSummary(614-767)crates/frontend/src/components/experiment_group_form.rs (1)
ChangeLogSummary(433-568)crates/frontend/src/components/type_template_form.rs (1)
ChangeLogSummary(215-325)crates/frontend/src/components/webhook_form.rs (1)
ChangeLogSummary(365-529)
crates/frontend/src/components/default_config_form.rs (5)
crates/frontend/src/components/dimension_form.rs (1)
ChangeLogSummary(614-767)crates/frontend/src/components/experiment_group_form.rs (1)
ChangeLogSummary(433-568)crates/frontend/src/components/type_template_form.rs (1)
ChangeLogSummary(215-325)crates/frontend/src/components/variable_form.rs (1)
ChangeLogSummary(212-316)crates/frontend/src/components/webhook_form.rs (1)
ChangeLogSummary(365-529)
🪛 checkmake (0.2.2)
makefile
[warning] 52-52: Missing required phony target "all"
(minphony)
[warning] 52-52: Missing required phony target "clean"
(minphony)
[warning] 52-52: Missing required phony target "test"
(minphony)
[warning] 298-298: Target "check" should be declared PHONY.
(phonydeclared)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Testing
🔇 Additional comments (107)
crates/frontend/src/pages/function/function_list.rs (1)
28-28: LGTM! Component rename aligns with PascalCase convention.The rename from
function_listtoFunctionListsuccessfully aligns the component definition with JSX usage conventions and improves searchability.crates/frontend/src/pages/default_config_list/utils.rs (1)
11-11: LGTM! Component rename follows PascalCase convention.The rename from
bread_crumstoBreadCrumsis consistent with the PR's standardization effort and matches theBreadCrumstype being used.crates/frontend/src/pages/function/function_create.rs (1)
17-17: LGTM! Component rename aligns with PascalCase standard.The rename from
create_function_viewtoCreateFunctionViewis consistent with the broader refactoring effort and improves component naming consistency.crates/frontend/src/pages/context_override/filter.rs (3)
33-33: LGTM! Component rename follows PascalCase convention.The rename from
context_filter_summarytoContextFilterSummaryaligns with the PR's standardization effort.
234-234: LGTM! Component rename follows PascalCase convention.The rename from
context_filter_drawertoContextFilterDraweris consistent with the broader refactoring effort.
37-37: Parameter addition verified at all call sites.The
filter_node_ref: NodeRef<html::Div>parameter is properly passed at the only call site ofContextFilterSummaryincrates/frontend/src/pages/context_override.rs(line 649).crates/frontend/src/components/side_nav.rs (1)
89-89: LGTM! PascalCase component naming is consistent.All four public component functions are correctly renamed from snake_case to PascalCase (WorkspaceSelector, NavItem, NavComponent, SideNav), matching their usage in view macros and improving consistency across the codebase.
Also applies to: 216-216, 252-252, 314-314
crates/frontend/src/pages/audit_log/filter.rs (1)
20-20: LGTM! Component naming is consistent with codebase patterns.Both components (FilterSummary, AuditLogFilterWidget) are correctly renamed to PascalCase, maintaining consistency with similar components elsewhere (e.g., FilterSummary in variables_list/filter.rs).
Also applies to: 172-172
crates/frontend/src/pages/workspace.rs (1)
29-29: LGTM! Clean component rename.The public component function is correctly renamed from
workspacetoWorkspace, aligning with PascalCase conventions.crates/frontend/src/pages/webhook.rs (1)
114-114: LGTM! Public component renamed correctly.The public component function
Webhookis correctly renamed fromwebhookto PascalCase, consistent with the PR's refactoring goals.crates/frontend/src/pages/dimensions.rs (1)
26-26: LGTM! Component renamed correctly.The public component function
Dimensionsis correctly renamed fromdimensionsto PascalCase, maintaining consistency with the refactoring pattern across the codebase.crates/frontend/src/pages/config_version_list.rs (1)
24-24: LGTM! Function rename aligns with PascalCase convention.The rename from
config_version_listtoConfigVersionListis correct and consistent with the PR's objective to standardize component naming.crates/frontend/src/components/toast.rs (1)
6-6: LGTM! Clean rename to PascalCase.The rename from
toasttoToastcorrectly implements the PR's naming standardization objective.crates/frontend/src/components/tip.rs (1)
4-4: LGTM! Function name correctly updated.The rename from
tiptoTipaligns with the PascalCase naming standard established in this PR.crates/frontend/src/pages/variables_list.rs (1)
155-155: LGTM! Rename implements the standardization objective.The rename from
variables_listtoVariablesListis correct and aligns with the PR-wide PascalCase convention.crates/frontend/src/pages/type_template.rs (1)
60-60: LGTM! Public component renamed correctly.The rename from
type_pagetoTypePageis correct and aligns with the PR's PascalCase naming convention.crates/frontend/src/components/delete_modal.rs (1)
6-6: LGTM: Component rename aligns with PascalCase convention.The function rename from
delete_modaltoDeleteModalis consistent with the PR's objective to standardize Leptos component naming.crates/frontend/src/pages/webhooks.rs (1)
39-39: LGTM: Component rename aligns with PascalCase convention.The function rename from
webhookstoWebhooksis consistent with the PR's objective to standardize Leptos component naming.crates/frontend/src/pages/experiment_list.rs (1)
49-49: LGTM: Component rename aligns with PascalCase convention.The function rename from
experiment_listtoExperimentListis consistent with the PR's objective to standardize Leptos component naming.crates/frontend/src/pages/function.rs (1)
91-91: LGTM: Component rename aligns with PascalCase convention.The function rename from
function_pagetoFunctionPageis consistent with the PR's objective to standardize Leptos component naming.crates/frontend/src/components/cohort_schema.rs (1)
71-71: LGTM: Component rename aligns with PascalCase convention.The function rename from
cohort_schematoCohortSchemaat line 71 is consistent with the PR's objective to standardize Leptos component naming. All call sites indimension.rsanddimension_form.rshave been updated to use the new PascalCase name, and no missed snake_case component usages were detected.crates/frontend/src/pages/experiment_groups.rs (1)
157-157: LGTM! Public component renamed to PascalCase.The rename from
experiment_groupstoExperimentGroupssuccessfully aligns the function definition with its usage in view macros, improving consistency and searchability.crates/frontend/src/pages/config_version.rs (1)
13-13: LGTM! Clean PascalCase conversion.The rename from
config_versiontoConfigVersionproperly aligns the component definition with its usage convention.crates/frontend/src/pages/experiment.rs (1)
50-50: LGTM! Component renamed correctly.The rename from
experiment_pagetoExperimentPagemaintains consistency with the PascalCase convention for component functions.crates/frontend/src/components/experiment_conclude_form.rs (1)
17-17: LGTM! Function naming updated correctly.The rename from
experiment_conclude_formtoExperimentConcludeFormproperly follows the PascalCase convention for component functions.crates/frontend/src/components/info_modal.rs (1)
23-23: LGTM! Public component properly renamed.The rename from
info_modaltoInfoModalcorrectly implements the PascalCase naming convention.crates/frontend/src/components/pagination.rs (1)
11-11: LGTM! Component rename follows Leptos conventions.The rename from
paginationtoPaginationaligns with PascalCase naming for Leptos components, improving consistency with JSX usage patterns.crates/frontend/src/components/change_form.rs (1)
6-6: LGTM! Component rename aligns with naming standards.The rename from
change_formtoChangeFormis consistent with the broader refactoring effort and Leptos best practices.crates/frontend/src/components/override_form.rs (1)
119-119: LGTM! Public component renamed to PascalCase.The rename from
override_formtoOverrideFormis appropriate for the public API. Note that private helper components (type_badge,override_input) correctly remain in snake_case, as this refactoring focuses on public component APIs.crates/frontend/src/pages/default_config.rs (1)
125-125: LGTM! Page component rename follows conventions.The rename from
default_configtoDefaultConfigis consistent with the PascalCase convention for public page components. Private helperconfig_infoappropriately remains in snake_case.makefile (2)
52-52: Good: Consolidated PHONY declarations.Consolidating all PHONY targets into a single declaration improves maintainability and reduces duplication.
298-301: LGTM! Linter integration enforces PascalCase convention.The new
check-component-namestarget properly integrates the validation script into the build workflow. The script correctly identifies Leptos components with snake_case naming violations and suggests the appropriate PascalCase alternative, helping prevent future violations of the naming convention.crates/frontend/src/components/workspace_form.rs (1)
23-23: LGTM! Component rename follows PascalCase convention.The function rename from
workspace_formtoWorkspaceFormaligns with the PR's objective to standardize Leptos component naming. The signature and implementation remain unchanged.crates/frontend/src/pages/organisations.rs (1)
17-17: LGTM! Component rename follows PascalCase convention.The function rename from
organisationstoOrganisationscorrectly implements the PR's naming standardization objective.crates/frontend/src/components/stat.rs (1)
4-4: LGTM! Component rename follows PascalCase convention.The function rename from
stattoStatcorrectly standardizes the component naming with PascalCase.crates/frontend/src/pages/context_override.rs (1)
383-383: LGTM! Public component rename follows PascalCase convention.The rename of the public component from
context_overridetoContextOverridealigns with the PR's standardization objective. Note that private component functions (such asform,autofill_form,autofill_experiment_form, andchange_log_summary) appropriately remain in snake_case.crates/frontend/src/pages/default_config_list.rs (1)
44-44: LGTM! Component rename follows PascalCase convention.The function rename from
default_config_listtoDefaultConfigListsuccessfully implements the PascalCase naming standard for Leptos components.crates/frontend/src/components/skeleton.rs (1)
12-15: LGTM! Component renamed to PascalCase.The rename from
skeletontoSkeletonaligns with the PR's objective of standardizing Leptos component names to PascalCase, improving consistency with JSX usage conventions.crates/frontend/src/pages/compare_overrides.rs (1)
107-107: LGTM! Component renamed to PascalCase.The rename from
compare_overridestoCompareOverridesfollows the established PascalCase convention for Leptos components.crates/frontend/src/pages/type_templates.rs (1)
32-32: LGTM! Component renamed to PascalCase.The rename from
types_pagetoTypesPageis consistent with the PR's standardization effort.crates/frontend/src/pages/variable.rs (1)
46-46: LGTM! Component renamed to PascalCase.The rename from
variabletoVariablefollows the established convention.crates/frontend/src/components/metrics_form.rs (1)
14-17: LGTM! Component renamed to PascalCase.The rename from
metrics_formtoMetricsFormis consistent with the PR's standardization of Leptos component naming conventions.crates/frontend/src/components/function_form.rs (2)
152-152: LGTM! Public component renamed to PascalCase.The rename from
function_editortoFunctionEditoraligns with the PR's objective to standardize Leptos component naming conventions and improve consistency with usage in view! macros.
460-460: LGTM! Public component renamed to PascalCase.The rename from
test_formtoTestFormis consistent with the broader refactoring effort and improves component discoverability.crates/frontend/src/providers/condition_collapse_provider.rs (1)
6-6: LGTM! Provider component renamed to PascalCase.The rename from
condition_collapse_providertoConditionCollapseProvideris consistent with the project-wide naming standardization effort.crates/frontend/src/pages/experiment_group_listing.rs (1)
234-234: LGTM! Page component renamed to PascalCase.The rename from
experiment_group_listingtoExperimentGroupListingfollows the established pattern and improves consistency across the page components.crates/frontend/src/components/experiment.rs (1)
292-292: LGTM! Public component renamed to PascalCase.The rename from
experimenttoExperimentaligns with the project-wide refactoring effort and improves naming consistency.crates/frontend/src/pages/function/publish_form.rs (1)
12-12: LGTM! Form component renamed to PascalCase.The rename from
publish_formtoPublishFormis consistent with the standardization effort and improves clarity.crates/frontend/src/components/dropdown.rs (1)
26-42: LGTM! Component rename aligns with Leptos conventions.The rename from
dropdowntoDropdownfollows the standard PascalCase convention for Leptos components, improving consistency between the function definition and its usage inview!macros. The function signature, generic bounds, and all internal logic remain unchanged.crates/frontend/src/providers/csr_provider.rs (1)
8-14: LGTM! Correct distinction between component and hook naming.The rename from
client_side_ready_providertoClientSideReadyProvideris appropriate for the component function. Notably,use_client_side_ready()on line 16 correctly remains in snake_case since it's a hook function, not a component—this distinction aligns with Leptos conventions.crates/frontend/src/components/monaco_editor.rs (1)
76-85: LGTM! Component rename follows conventions.The rename from
monaco_editortoMonacoEditoraligns with PascalCase conventions for Leptos components. The function signature and all props remain unchanged, preserving the component's behavior.crates/frontend/src/components/condition_pills.rs (2)
32-37: LGTM! Consistent component naming.The rename from
condition_expressiontoConditionExpressionaligns with PascalCase conventions. This consistency is demonstrated at line 151 where the component is used as<ConditionExpression>, matching its PascalCase definition.
125-131: LGTM! Component rename follows conventions.The rename from
conditiontoConditionfollows the standard PascalCase convention for Leptos components, improving searchability and consistency with JSX-style usage.crates/frontend/src/pages/not_found.rs (1)
4-19: LGTM! Page component rename follows conventions.The rename from
not_foundtoNotFoundaligns with PascalCase conventions for Leptos components. The function behavior and the 404 rendering logic remain unchanged.crates/frontend/src/pages/variables_list/filter.rs (1)
17-17: LGTM! Component naming aligns with Leptos conventions.The renaming of
filter_summary→FilterSummaryandvariable_filter_widget→VariableFilterWidgetfollows the standard PascalCase convention for Leptos components, improving consistency with component usage in view! macros.Also applies to: 159-159
crates/frontend/src/components/button.rs (1)
13-13: LGTM! Component naming follows conventions.The renaming of
button→Buttonandbutton_anchor→ButtonAnchoradheres to the PascalCase convention for Leptos components.Also applies to: 64-64
crates/frontend/src/components/form/label.rs (1)
32-32: LGTM! Component naming follows conventions.The renaming of
label→Labeladheres to the PascalCase convention for Leptos components.crates/frontend/src/components/webhook_form.rs (1)
62-62: LGTM! Component naming follows conventions.The renaming of
webhook_form→WebhookFormandchange_log_summary→ChangeLogSummaryadheres to the PascalCase convention for Leptos components, consistent with similar components across the codebase.Also applies to: 365-365
crates/frontend/src/components/variable_form.rs (1)
45-45: LGTM! Component naming follows conventions.The renaming of
variable_form→VariableFormandchange_log_summary→ChangeLogSummaryadheres to the PascalCase convention for Leptos components, consistent with similar components across the codebase.Also applies to: 212-212
crates/frontend/src/components/context_form.rs (1)
30-30: LGTM! Clean PascalCase refactor.The component renames (
condition_input→ConditionInputandcontext_form→ContextForm) successfully align function definitions with JSX usage conventions, improving code consistency and searchability.Also applies to: 245-245
crates/frontend/src/components/menu.rs (1)
6-6: LGTM! Generic component rename handled correctly.The rename
selection_menu<T>→SelectionMenu<T>maintains the generic signature and trait bounds while adopting the PascalCase convention.crates/frontend/src/components/variant_form.rs (1)
48-48: LGTM! Consistent PascalCase refactor across variant components.All three component renames (
variant_form→VariantForm,delete_variant→DeleteVariant,delete_variant_form→DeleteVariantForm) correctly preserve generic parameters and maintain function signatures while improving naming consistency.Also applies to: 463-463, 614-614
crates/frontend/src/components/change_summary.rs (1)
89-89: LGTM! Clean component naming refactor.The renames (
change_summary→ChangeSummary,json_change_summary→JsonChangeSummary,change_log_popup→ChangeLogPopup) successfully standardize component naming while preserving all function signatures and logic.Also applies to: 110-110, 202-202
crates/frontend/src/pages/dimension.rs (2)
272-272: LGTM! Public page components successfully refactored.The public component renames (
dimension_page→DimensionPage,edit_dimension→EditDimension,create_dimension→CreateDimension) align with the PascalCase convention.Also applies to: 383-383, 430-430
27-27: The linterscripts/check_component_names.shintentionally enforces PascalCase naming only for public components (those with thepubkeyword). Private components, includingtree_node,dimension_info, anddimension_data, are correctly left in snake_case by design. This is consistent with the codebase pattern where all private #[component] functions use snake_case while all public ones use PascalCase. No changes needed.Likely an incorrect or invalid review comment.
crates/frontend/src/components/tooltip.rs (1)
11-15: LGTM! Component rename follows project convention.The component rename from
tooltiptoTooltipis consistent with the PascalCase standardization effort across the frontend codebase.crates/frontend/src/components/datetime.rs (1)
124-138: LGTM! Component renames align with PascalCase convention.The component renames (
datetime→Datetime,datetime_str→DatetimeStr,datetime_conversion_script→DatetimeConversionScript) are consistent with the project-wide standardization effort. Function signatures and implementations remain unchanged.crates/frontend/src/components/dimension_form.rs (2)
56-68: LGTM! Component rename follows PascalCase convention.The component rename from
dimension_formtoDimensionFormaligns with the project-wide standardization effort. Function signature and implementation remain unchanged.
614-620: LGTM! Component rename and API expansion are consistent with the codebase.The
ChangeLogSummarycomponent is renamed to PascalCase and gains two new props:
on_close: Callback<()>for dismissal handlinginprogress: Signal<bool>with a default value for loading stateThis API expansion is consistent with other
ChangeLogSummaryvariants across the codebase (variable_form.rs, type_template_form.rs, experiment_group_form.rs, webhook_form.rs, and default_config_form.rs all have the same signature). The call site in dimension_form.rs properly provides the requiredon_closecallback.crates/frontend/src/components/default_config_form.rs (2)
59-70: LGTM! Component rename follows PascalCase convention.The component rename from
default_config_formtoDefaultConfigFormaligns with the project-wide standardization effort. The function signature has been updated with additional props while maintaining backward compatibility through defaults.
536-542: LGTM! Component API is consistent across the codebase.The
ChangeLogSummarycomponent rename to PascalCase and API expansion (addingon_closeandinprogressprops) matches the same changes in dimension_form.rs and is consistent with other ChangeLogSummary variants across the codebase.crates/frontend/src/components/experiment_action_form.rs (1)
24-29: Component renamed to PascalCase per standardization—all call sites updated.The rename from
experiment_action_formtoExperimentActionFormis complete and correct. Import and usage across call sites (e.g.,crates/frontend/src/pages/experiment.rs) properly reference the new PascalCase component name. Module naming follows Rust conventions.crates/frontend/src/components/experiment_group_form.rs (3)
33-37: LGTM!The rename from
add_experiment_to_group_formtoAddExperimentToGroupFormaligns with the PR's PascalCase convention. The component logic and props remain unchanged.
170-180: LGTM!The rename from
experiment_group_formtoExperimentGroupFormfollows the established PascalCase pattern. Props and implementation are preserved.
432-439: LGTM!The
ChangeLogSummarycomponent follows the same signature pattern as otherChangeLogSummaryimplementations in the codebase (e.g., invariable_form.rs,type_template_form.rs,dimension_form.rs). Theon_closeandinprogressprops with their defaults are consistent with the established API across similar components.crates/frontend/src/components/input.rs (6)
177-184: LGTM!The
Togglecomponent rename follows PascalCase convention. Props and implementation are unchanged.
197-206: LGTM!The
Selectcomponent rename is consistent with the PR's naming convention.
365-375: LGTM!The
MonacoInputcomponent correctly follows PascalCase. All props and editor integration logic remain intact.
552-564: LGTM!The
DateInputcomponent rename is appropriate. The datetime handling withchronotypes remains unchanged.
604-617: LGTM!The
Inputcomponent rename follows the established pattern. The component correctly dispatches toToggle,Select,MonacoInput, andBasicInputbased on the input type.
731-747: LGTM!Both
NumberArrayInputandStringArrayInputfollow PascalCase convention and correctly delegate to the privateArrayInputhelper.crates/frontend/src/components/drawer.rs (3)
26-50: LGTM!The
DrawerBtncomponent correctly adds an optionalon_clickcallback with a no-op default. The callback is properly invoked after opening the drawer.
52-88: LGTM!The
Drawercomponent now accepts ahandle_closecallback that is properly invoked on both overlay click and close button click. The generic constraintNF: Fn() + 'static + Cloneis appropriate for this use case.
90-124: LGTM!The
PortalDrawercomponent follows the same pattern asDrawerwithhandle_close: Callback<()>. The callback is correctly invoked on overlay and close button interactions.crates/frontend/src/components/type_template_form.rs (2)
34-41: LGTM!The
TypeTemplateFormcomponent correctly addshandle_submitanddescriptionprops. The callback pattern for notifying parent components on submission is consistent with other form components in the codebase.
214-221: LGTM!The
ChangeLogSummarycomponent follows the same signature pattern as otherChangeLogSummaryimplementations across the codebase, with consistenton_confirm,on_close, andinprogressprops.crates/frontend/src/components/table.rs (2)
10-17: LGTM!The
ExpandableTextcomponent is enhanced withclass_nameandis_expandableprops, enabling per-cell customization and controlled expand/collapse behavior. The implementation correctly handles theExpandable::Enabled(len)case for text truncation.
61-71: LGTM!The
Tablecomponent now exposes flexible styling props (class,cell_class,head_class,body_class) and pagination support. All props have sensible defaults, maintaining backward compatibility.crates/frontend/src/pages/home.rs (1)
152-153: LGTM!The
Homepage component is correctly renamed to follow PascalCase convention. No logic changes.crates/frontend/src/components/alert.rs (1)
59-70: LGTM!The
Alertcomponent function rename follows PascalCase convention. The function sharing the same name as theAlertstruct is a valid pattern in Leptos, as the#[component]macro handles the namespace appropriately.crates/frontend/src/components/experiment_form.rs (1)
78-92: LGTM!The
ExperimentFormcomponent function is correctly renamed to PascalCase, aligning with the PR objective. The signature and internal logic remain unchanged.crates/frontend/src/app.rs (1)
30-31: LGTM!The
Appcomponent function is correctly renamed to PascalCase. The function signature and internal routing logic remain unchanged.crates/frontend/src/components/experiment_ramp_form.rs (1)
16-23: LGTM!The
ExperimentRampFormcomponent function is correctly renamed to PascalCase while preserving the generic parameterNFand its trait bounds.crates/frontend/src/components/description.rs (2)
7-11: LGTM!The
InfoDescriptioncomponent function is correctly renamed to PascalCase.
48-58: LGTM!The
ContentDescriptioncomponent function is correctly renamed to PascalCase. The extensive parameter list and view logic remain unchanged.crates/frontend/src/providers/editor_provider.rs (1)
33-44: LGTM!The
EditorProvidercomponent function is correctly renamed to PascalCase while theuse_editorhook appropriately remains in snake_case (hooks are not components).crates/frontend/src/providers/alert_provider.rs (1)
71-82: LGTM!The
AlertProvidercomponent function is correctly renamed to PascalCase. The helper functions (enqueue,enqueue_alert,enqueue_alert_default) appropriately remain in snake_case as they are not components.crates/frontend/src/components/modal.rs (2)
3-13: LGTM!The
Modalcomponent function is correctly renamed to PascalCase while preserving the generic parameterNFand its trait bounds.
32-38: LGTM!The
PortalModalcomponent function is correctly renamed to PascalCase.crates/frontend/src/components/context_card.rs (1)
87-96: LGTM on PascalCase rename.The public component function is correctly renamed to
ContextCard, aligning with the PR's convention standardization goal.crates/frontend/src/hoc/layout.rs (3)
37-51: LGTM on CommonLayout rename and toast integration.The rename to PascalCase is correct. The toast rendering logic gracefully handles the case when
AlertQueuecontext is not provided by falling back to an empty alerts list.
54-58: LGTM on Layout rename and context provisioning.The rename to PascalCase is correct. The added
provide_contextcalls forworkspaceandorgmake these signals available to descendant components, which complements the existingworkspace_settingscontext provision at line 94.
103-109: LGTM on Providers rename.The rename to PascalCase is correct and the component composition structure is unchanged.
crates/frontend/src/components/badge.rs (4)
11-19: LGTM on Badge rename.Correct PascalCase rename with preserved generic type bounds and props.
59-66: LGTM on GrayPill rename.Correct PascalCase rename with preserved signature and callback props.
89-98: LGTM on ListPills rename.Correct PascalCase rename. The internal usage of
GrayPillat line 114 correctly references the renamed component.
128-133: LGTM on GlassyPills rename.Correct PascalCase rename with preserved trait bounds and props.
This commit addresses all coderabbit review feedback: 1. **Fixed sed portability** (scripts/check_component_names.sh:30) - Changed `-r` flag to `-E` for BSD/macOS compatibility - Extended regex now works on both GNU sed and BSD sed 2. **Renamed all private components to PascalCase** (31 components) - webhook_info -> WebhookInfo (pages/webhook.rs:26) - info_section -> InfoSection (components/info_modal.rs:4) - experiment_group_info -> ExperimentGroupInfo (pages/experiment_groups.rs:6) - variable_info -> VariableInfo (pages/variable.rs:20) - option and context_options -> Option, ContextOptions (components/context_card.rs:21,38) - experiment_info and action components (components/experiment.rs:29,148,181,222,237,242) - And 20+ other private components across multiple files 3. **Enhanced linter to check private components** - Now enforces PascalCase for both public and private components - Fixed false positives on nested helper functions - Only matches top-level component function definitions All changes maintain consistency between component definitions and their usage in JSX view macros. Build verified successfully. Resolves all 7 coderabbit nitpick comments on the PR.
| test-py-provider | ||
| test-kotlin-provider | ||
| test-rust-provider | ||
| .PHONY: cac check-component-names ci-test clients db-init grafana-local kill local-docs-view node-dependencies run schema-file setup setup-clients smithy-clean smithy-build smithy-clean-build smithy-api-docs smithy-updates validate-aws-connection validate-psql-connection uniffi-bindings test-js-provider test-py-provider test-kotlin-provider test-rust-provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can keep this multi-lined as well by adding \ at the end of each line
that will allow us to keep it clean as well as correct
| check: fmt leptosfmt lint check-component-names | ||
|
|
||
| check-component-names: | ||
| @./scripts/check_component_names.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is working as intended, because there are 6 more instances in code which are not converted to PascalCase and there is one behind doc comments as well
would have preferred a linter way of achieving this
| next_line=$((line_num + offset)) | ||
| line_content=$(sed -n "${next_line}p" "$file") | ||
| # Match fn at start of line or after 'pub ', not indented helper functions | ||
| if echo "$line_content" | grep -q "^pub fn [a-z_][a-z0-9_]*\|^fn [a-z_][a-z0-9_]*"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this grep is only looking for pub functions or lines which start with fn only
it is not covering all the cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we have to regex way only, then I think this would be a better regex, covering both the lines
#\[component\]\n.*fn (.*)\(without any start or end delimiters
and then what whatever group value is captured, just need to check that the first character is not a lower case alphabet and the entire capture does not include any occurrences of _
which could be represented by a regex like this
^[A-Z][A-Za-z0-9]*$
Examples of changes:
fixes #821
Summary by CodeRabbit
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.