Skip to content

Conversation

@lukasz-hycom
Copy link
Collaborator

@lukasz-hycom lukasz-hycom commented Dec 18, 2025

What does this PR do?

  • Enforces --max-warnings=0 for all packages via the root npm run lint

Key Changes

  • Updated root lint script to turbo lint -- --max-warnings=0.

How to test

  • Run npm run lint in the repo root — it should succeed with zero ESLint warnings across all packages

Summary by CodeRabbit

  • Bug Fixes

    • Fixed apostrophe rendering in multiple UI texts
    • Footer now renders consistently on all pages
  • Improvements

    • External links now include rel="noreferrer"/"noopener noreferrer" for better security
    • Removed several homepage sections and benefit blocks to simplify content
    • Docs lint config added and linting tightened so warnings fail CI
  • Refactor

    • Unified server-side data fetch and render flow across many content blocks

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

Refactors many server-side block components to use a single post-try/catch render path, tightens linting by adding --max-warnings=0 across packages and adding a docs-specific ESLint config, removes unused docs imports/components, applies small JSX/text escapes and anchor attribute tweaks, and converts many runtime imports to type-only imports.

Changes

Cohort / File(s) Summary
ESLint config & lint scripts
apps/docs/eslint.config.mjs, apps/docs/package.json, package.json, apps/frontend/package.json, packages/modules/surveyjs/eslint.config.mjs, packages/modules/surveyjs/package.json, packages/utils/*/package.json, packages/configs/integrations/package.json, packages/*/package.json
Added docs-specific ESLint config and updated many package lint scripts to include --max-warnings=0; small quoting/style edits in one surveyjs config.
Server components — unified return path
`packages/blocks//src/frontend/.(server
renderer).tsx, turbo/generators/templates/block/frontend/server.hbs`
Type-only import conversions (types files & clients)
packages/blocks/**/src/frontend/*.types.ts, `packages/blocks/**/src/frontend/*.(client
types).tsx, turbo/generators/templates/block/frontend/types.hbs`
Docs: remove unused imports & components
apps/docs/src/components/*, apps/docs/src/pages/*, apps/docs/src/theme/* (e.g., apps/docs/src/components/BenefitsSection/index.tsx, apps/docs/src/pages/index.tsx, apps/docs/src/pages/product/starters.tsx, apps/docs/src/theme/Footer/*)
Removed unused imports, deleted/commented private components/data, eliminated conditional footer rendering based on location.
Docs: JSX/text escapes & anchor rel tweaks
apps/docs/src/components/DXPComplexPlatformsSection/index.tsx, apps/docs/src/components/GetStartedButtons/index.tsx, apps/docs/src/pages/contact/index.tsx, apps/docs/src/pages/product/integrations.tsx, apps/docs/src/components/HomepageJoinTheWaitlistSection/index.tsx
Escaped apostrophes, adjusted line breaks, and normalized rel attributes on external anchors (noreferrer / noopener noreferrer).
Docs: small cleanups & lint comment removals
apps/docs/src/components/CookieConsent/index.tsx, apps/docs/src/theme/Footer/*, apps/docs/src/theme/Blog/*, apps/docs/src/theme/BlogPostItem/Header/Info/index.tsx, apps/docs/src/theme/Footer/Links/*
Commented-out stylesheet import, removed several react/no-danger eslint-disable comments, removed unused theme/type imports.
Unused parameter renames / prop suppression
apps/docs/src/components/HubspotForm/index.tsx, apps/docs/src/components/SubscribeSection/index.tsx, apps/docs/src/components/WaitlistForm/index.tsx, apps/docs/src/theme/NavbarItem/DropdownNavbarItem/index.tsx
Renamed unused catch params to _error and renamed unused props to _onClick/_position to suppress lint warnings.
Asset import changes
apps/docs/src/components/HomepageFeatures/index.tsx
Replaced dynamic require(...).default SVG usage with static named SVG imports assigned to feature entries.
Renderer signature change
packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.renderer.tsx
Removed slug prop from renderer signature and removed unused createNavigation import.
ESLint-disable additions for mutability
packages/modules/surveyjs/src/frontend/Questions/CustomSurveyQuestionText.tsx
Added // eslint-disable-next-line react-hooks/immutability before in-place question.value mutations.
Other minor removals
packages/blocks/*/src/frontend/*renderer.tsx (e.g., packages/blocks/invoice-list/src/frontend/InvoiceList.renderer.tsx, packages/blocks/ticket-recent/src/frontend/TicketRecent.renderer.tsx)
Removed unused Container import from @o2s/ui/components/Container.
Changeset
.changeset/evil-results-nail.md
Added changeset listing many patch updates and noting data-fetching refactor to reduce ESLint warnings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Areas to focus on:
    • Verify each refactored server block ensures data is assigned before usage and types align (many files moved render outside try).
    • Confirm removal of slug prop in FeaturedServiceList.renderer has no upstream consumers depending on it.
    • Validate CI behavior after adding --max-warnings=0 across packages (lint may now fail on previous warnings).
    • Review removed/changed ESLint suppressions around dangerouslySetInnerHTML and added immutability disables for potential security/maintainability concerns.

Possibly related PRs

Poem

🐇 I hopped through code with nimble paws,

Replaced returns and tidied up the laws.
Apostrophes escaped, links now sealed tight,
ESLint keeps watch through day and night.
A small clean patch — a rabbit's quiet delight.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix: handling various linter warnings' accurately reflects the main objective of enforcing zero ESLint warnings across the codebase.
Description check ✅ Passed The PR description covers the main objective and key changes, but lacks detail in 'How to test' section and omits related ticket information from the template.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/handling-various-linter-warnings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a16f6b2 and e65d612.

📒 Files selected for processing (27)
  • package.json (1 hunks)
  • packages/blocks/article-list/package.json (1 hunks)
  • packages/blocks/article-search/package.json (1 hunks)
  • packages/blocks/article/package.json (1 hunks)
  • packages/blocks/category-list/package.json (1 hunks)
  • packages/blocks/category/package.json (1 hunks)
  • packages/blocks/faq/package.json (1 hunks)
  • packages/blocks/featured-service-list/package.json (1 hunks)
  • packages/blocks/invoice-list/package.json (1 hunks)
  • packages/blocks/notification-details/package.json (1 hunks)
  • packages/blocks/notification-list/package.json (1 hunks)
  • packages/blocks/notification-summary/package.json (1 hunks)
  • packages/blocks/order-details/package.json (1 hunks)
  • packages/blocks/order-list/package.json (1 hunks)
  • packages/blocks/orders-summary/package.json (1 hunks)
  • packages/blocks/payments-history/package.json (1 hunks)
  • packages/blocks/payments-summary/package.json (1 hunks)
  • packages/blocks/product-list/package.json (1 hunks)
  • packages/blocks/quick-links/package.json (1 hunks)
  • packages/blocks/service-details/package.json (1 hunks)
  • packages/blocks/service-list/package.json (1 hunks)
  • packages/blocks/surveyjs-form/package.json (1 hunks)
  • packages/blocks/ticket-details/package.json (1 hunks)
  • packages/blocks/ticket-list/package.json (1 hunks)
  • packages/blocks/ticket-recent/package.json (1 hunks)
  • packages/blocks/ticket-summary/package.json (1 hunks)
  • packages/blocks/user-account/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/blocks/notification-summary/package.json
🚧 Files skipped from review as they are similar to previous changes (19)
  • packages/blocks/surveyjs-form/package.json
  • packages/blocks/category-list/package.json
  • packages/blocks/service-list/package.json
  • packages/blocks/ticket-recent/package.json
  • packages/blocks/ticket-details/package.json
  • packages/blocks/ticket-list/package.json
  • packages/blocks/payments-history/package.json
  • package.json
  • packages/blocks/user-account/package.json
  • packages/blocks/notification-list/package.json
  • packages/blocks/article-list/package.json
  • packages/blocks/featured-service-list/package.json
  • packages/blocks/article-search/package.json
  • packages/blocks/category/package.json
  • packages/blocks/quick-links/package.json
  • packages/blocks/faq/package.json
  • packages/blocks/service-details/package.json
  • packages/blocks/order-details/package.json
  • packages/blocks/notification-details/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: deploy-preview
🔇 Additional comments (7)
packages/blocks/article/package.json (1)

19-19: LGTM! Stricter linting enforcement added.

The lint script now includes:

  • tsc --noEmit for type checking before linting, catching type errors early
  • --max-warnings=0 to enforce zero ESLint warnings, which aligns perfectly with the PR objectives

These changes improve code quality enforcement and are consistent with the repository-wide linting improvements described in the PR.

packages/blocks/order-list/package.json (1)

19-19: LGTM! Stricter linting enforcement added.

The addition of --max-warnings=0 correctly enforces a zero-warning policy, ensuring that all ESLint warnings are treated as failures. The flag order is appropriate—--fix auto-resolves fixable issues before the warning check.

packages/blocks/orders-summary/package.json (1)

19-19: LGTM! Enforces stricter linting standards.

The addition of --max-warnings=0 ensures that ESLint warnings are treated as errors, preventing them from accumulating in the codebase. The flag placement after --fix is correct, allowing automatic fixes to be applied before checking for remaining warnings.

packages/blocks/ticket-summary/package.json (1)

19-19: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 to the lint script aligns with the PR's objective to enforce stricter linting across all packages. This is a best practice that ensures warnings are addressed rather than accumulating over time.

packages/blocks/invoice-list/package.json (1)

19-19: LGTM! Zero-warnings enforcement added correctly.

The addition of --max-warnings=0 to the ESLint command enforces a strict no-warnings policy, which is a best practice for maintaining code quality. The script structure (type checking first via tsc --noEmit, then linting with --fix and --max-warnings=0) ensures that auto-fixable issues are resolved before checking the warning count.

packages/blocks/payments-summary/package.json (1)

19-19: LGTM! Stricter linting enforced.

Adding --max-warnings=0 correctly treats ESLint warnings as errors, ensuring higher code quality standards. The flag placement after --fix is correct.

packages/blocks/product-list/package.json (1)

19-19: LGTM! Stricter linting enforcement added.

The addition of --max-warnings=0 correctly enforces zero ESLint warnings for this package, aligning with the PR's objective to tighten linting standards across the repository. If --max-warnings is specified and the total warning count is greater than the specified threshold, ESLint exits with an error status.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
o2s-docs Skipped Skipped Dec 18, 2025 3:32pm

@vercel vercel bot temporarily deployed to Preview – o2s-docs December 18, 2025 15:32 Inactive
@lukasz-hycom lukasz-hycom self-assigned this Dec 18, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (12)
packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (1)

19-41: Unified return pattern looks good; consider adding type annotation.

The refactoring to use a unified return-path pattern (declare → fetch → return component) improves consistency across the codebase and likely addresses linter warnings about control flow.

However, let data; lacks an explicit type annotation, which may reduce type safety in strict TypeScript configurations.

💡 Consider adding an explicit type annotation:
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getFeaturedServiceList>>;
     try {
         data = await sdk.blocks.getFeaturedServiceList(
packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (1)

13-13: Add explicit type annotation for type safety.

The untyped let data; declaration may prevent TypeScript from properly inferring types, which could allow prop mismatches when spreading {...data} into PaymentsHistoryDynamic to go undetected.

🔎 Add explicit type annotation:
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getPaymentsHistory>>;

This ensures TypeScript validates the spread props against PaymentsHistoryDynamic's expected prop types.

packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (1)

19-31: LGTM! Clean refactoring to unified data flow.

The pattern correctly separates data fetching from rendering. The control flow ensures data is always assigned before use (early return on error prevents undefined access).

Optional: Add explicit type annotation for improved clarity

While TypeScript's control flow analysis handles this correctly, an explicit type annotation can improve code clarity:

-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getPricingSection>>;

This makes the intended type immediately visible to readers.

packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (1)

20-34: Verify TypeScript type inference for the uninitialized variable.

The refactored pattern with let data; declared outside the try block is safe from a control-flow perspective. However, without an explicit type annotation, TypeScript must infer the type solely from the assignment on line 22, which may reduce type precision or IDE support.

Consider adding an explicit type annotation to improve maintainability:

🔎 Suggested refactor with explicit typing:
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getTicketDetails>>;
     try {
         data = await sdk.blocks.getTicketDetails(

Additionally, please verify which specific ESLint rule this pattern addresses, as documenting the rationale would help future maintainers understand why this pattern was chosen over the more concise early-return approach.

packages/modules/surveyjs/src/frontend/Questions/CustomSurveyQuestionText.tsx (1)

113-116: Same direct mutation pattern repeated.

This handler also directly mutates question.value with the same ESLint suppression. If the verification confirms that direct mutation is the correct SurveyJS pattern, consider adding a shared comment at the component level explaining this design decision, rather than repeating suppressions throughout the code.

packages/blocks/order-details/src/frontend/OrderDetails.server.tsx (2)

21-21: Add explicit type annotation to improve type safety.

The data variable is declared without a type annotation, which may compromise type safety in strict TypeScript environments. Consider adding an explicit type annotation to ensure TypeScript can properly validate the usage of data throughout the function.

🔎 Apply this diff to add explicit type annotation:
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getOrderDetails>>;

21-47: Verify the benefits of the unified return-path pattern.

This refactor introduces a single return path by moving the final render outside the try-catch block. While this creates consistency across similar components (as mentioned in the PR summary), it also introduces some tradeoffs:

Tradeoffs to consider:

  • Requires a mutable let data variable instead of a more idiomatic const data = await ... with return inside try
  • The early-return pattern (returning inside try-catch blocks) is more common in React server components and arguably more readable
  • The control flow is slightly less obvious compared to explicit returns in each code path

Questions:

  • Which specific ESLint rule or coding standard is this pattern addressing?
  • Has the team evaluated whether the consistency benefit outweighs the readability tradeoff?

The pattern is functional and logically sound, but consider documenting the rationale in your team's coding guidelines if this becomes the standard pattern for server components.

apps/docs/src/components/CookieConsent/index.tsx (1)

7-7: Consider removing the commented import instead of leaving it.

Commented-out code adds noise and should generally be removed rather than preserved. If this import is no longer needed, delete the line entirely. If it may be needed in the future, version control already tracks the history.

🔎 Suggested fix
-// import styles from '../../css/cookie-consent.css';
apps/docs/eslint.config.mjs (1)

10-11: Consider keeping the react/no-unescaped-entities rule enabled.

While the comment indicates this is to "Allow unescaped entities (apostrophes) in documentation text," the codebase already properly escapes apostrophes (e.g., using &apos; in HomepageFeatures/index.tsx line 34). Disabling this rule may allow unescaped entities to slip through in future changes, reducing consistency and potentially causing issues with certain characters.

🔎 Consider this adjustment:
-            // Allow unescaped entities (apostrophes) in documentation text
-            'react/no-unescaped-entities': 'off',
apps/docs/src/components/DXPFeaturesSection/index.tsx (1)

10-17: Consider removing unused buttonText and buttonUrl props entirely.

The buttonText and buttonUrl properties are defined in the FeatureCardProps interface (lines 14-15), provided in the features array (lines 28-29, 40-41, 52-53), but are now commented out in the component's destructuring (lines 62-63) and not used since the button UI is also commented out (lines 92-94). This creates dead code that should be cleaned up.

🔎 Complete the cleanup by removing these unused props:

Update the interface:

 interface FeatureCardProps {
     title: string;
     icon: React.ReactNode;
     features: string[];
-    buttonText: string;
-    buttonUrl: string;
     borderColor?: 'gradient' | 'blue' | 'green' | 'light';
 }

Remove from each feature in the array:

     {
         title: 'Modern Frontend Foundation',
         icon: (
             <div className="absolute inset-[16.67%_8.33%]">
                 <CodeIcon className="w-7 h-7 text-[#21d99a]" />
             </div>
         ),
         features: ['Next.js based frontend', 'UI components & content types', 'Optimized for SEO, a11y & web perf'],
-        buttonText: 'Learn more',
-        buttonUrl: '/docs/app-starters/dxp/overview',
         borderColor: 'light',
     },

And remove the commented destructuring in the component:

 const FeatureCard: React.FC<FeatureCardProps> = ({
     title,
     icon,
     features,
-    // buttonText,
-    // buttonUrl,
     borderColor = 'blue',
 }) => {

Also applies to: 19-56, 58-65

packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx (1)

19-43: Refactoring maintains correctness.

The control-flow refactor is functionally equivalent and safe—since the catch block returns early, data is guaranteed to be assigned before the final render. This pattern aligns with the PR objective of resolving linter warnings.

Optional improvement for type safety:

Consider adding a type annotation to data for better TypeScript inference:

🔎 View suggestion
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getPaymentsSummary>>;

Note: This same pattern appears across all 8 files in this review; subsequent file comments will be brief.

packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (1)

13-13: Add explicit type annotation to data for better type safety.

Declaring data without a type annotation means TypeScript will initially infer it as undefined. While control flow analysis should understand that data is assigned before line 27 (since the catch block returns early), adding an explicit type annotation improves clarity and type safety.

🔎 Apply this diff to add a type annotation:
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getTicketSummary>>;
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f25c4cb and 4b4d706.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (66)
  • apps/docs/eslint.config.mjs (1 hunks)
  • apps/docs/package.json (1 hunks)
  • apps/docs/src/components/BenefitsSection/index.tsx (0 hunks)
  • apps/docs/src/components/CookieConsent/index.tsx (1 hunks)
  • apps/docs/src/components/DXPComplexPlatformsSection/index.tsx (1 hunks)
  • apps/docs/src/components/DXPFeaturesSection/index.tsx (1 hunks)
  • apps/docs/src/components/GetStartedButtons/index.tsx (1 hunks)
  • apps/docs/src/components/HomepageArchitectureSection/index.tsx (0 hunks)
  • apps/docs/src/components/HomepageFeatures/index.tsx (4 hunks)
  • apps/docs/src/components/HomepageFeaturesSection/index.tsx (1 hunks)
  • apps/docs/src/components/HomepageJoinTheWaitlistSection/index.tsx (2 hunks)
  • apps/docs/src/components/HubspotForm/index.tsx (1 hunks)
  • apps/docs/src/components/SubscribeSection/index.tsx (1 hunks)
  • apps/docs/src/components/WaitlistForm/index.tsx (1 hunks)
  • apps/docs/src/pages/contact/index.tsx (1 hunks)
  • apps/docs/src/pages/dxp/index.tsx (0 hunks)
  • apps/docs/src/pages/index.tsx (1 hunks)
  • apps/docs/src/pages/product/features.tsx (1 hunks)
  • apps/docs/src/pages/product/integrations.tsx (1 hunks)
  • apps/docs/src/pages/product/starters.tsx (1 hunks)
  • apps/docs/src/pages/support/developers.tsx (0 hunks)
  • apps/docs/src/theme/Blog/Components/Author/index.tsx (0 hunks)
  • apps/docs/src/theme/BlogPostItem/Header/Info/index.tsx (0 hunks)
  • apps/docs/src/theme/Footer/Copyright/index.tsx (0 hunks)
  • apps/docs/src/theme/Footer/Layout/index.tsx (0 hunks)
  • apps/docs/src/theme/Footer/Links/MultiColumn/index.tsx (1 hunks)
  • apps/docs/src/theme/Footer/Links/Simple/index.tsx (1 hunks)
  • apps/docs/src/theme/Footer/index.tsx (0 hunks)
  • apps/docs/src/theme/NavbarItem/DropdownNavbarItem/index.tsx (2 hunks)
  • package.json (1 hunks)
  • packages/blocks/article-list/src/frontend/ArticleList.server.tsx (1 hunks)
  • packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx (1 hunks)
  • packages/blocks/article/src/frontend/Article.server.tsx (1 hunks)
  • packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1 hunks)
  • packages/blocks/category/src/frontend/Category.server.tsx (1 hunks)
  • packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1 hunks)
  • packages/blocks/document-list/src/frontend/DocumentList.server.tsx (1 hunks)
  • packages/blocks/faq/src/frontend/Faq.server.tsx (1 hunks)
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx (1 hunks)
  • packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx (1 hunks)
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.renderer.tsx (1 hunks)
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (1 hunks)
  • packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (1 hunks)
  • packages/blocks/invoice-list/src/frontend/InvoiceList.renderer.tsx (0 hunks)
  • packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (1 hunks)
  • packages/blocks/media-section/src/frontend/MediaSection.server.tsx (1 hunks)
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (2 hunks)
  • packages/blocks/notification-list/src/frontend/NotificationList.server.tsx (1 hunks)
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (1 hunks)
  • packages/blocks/order-details/src/frontend/OrderDetails.server.tsx (2 hunks)
  • packages/blocks/order-list/src/frontend/OrderList.server.tsx (1 hunks)
  • packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (2 hunks)
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (2 hunks)
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx (2 hunks)
  • packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (1 hunks)
  • packages/blocks/product-list/src/frontend/ProductList.server.tsx (1 hunks)
  • packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (2 hunks)
  • packages/blocks/service-list/src/frontend/ServiceList.server.tsx (1 hunks)
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx (1 hunks)
  • packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (2 hunks)
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.renderer.tsx (0 hunks)
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx (1 hunks)
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (1 hunks)
  • packages/blocks/user-account/src/frontend/UserAccount.server.tsx (1 hunks)
  • packages/modules/surveyjs/eslint.config.mjs (1 hunks)
  • packages/modules/surveyjs/src/frontend/Questions/CustomSurveyQuestionText.tsx (2 hunks)
💤 Files with no reviewable changes (11)
  • apps/docs/src/pages/dxp/index.tsx
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.renderer.tsx
  • apps/docs/src/components/BenefitsSection/index.tsx
  • apps/docs/src/theme/Footer/Layout/index.tsx
  • packages/blocks/invoice-list/src/frontend/InvoiceList.renderer.tsx
  • apps/docs/src/components/HomepageArchitectureSection/index.tsx
  • apps/docs/src/theme/BlogPostItem/Header/Info/index.tsx
  • apps/docs/src/theme/Footer/index.tsx
  • apps/docs/src/pages/support/developers.tsx
  • apps/docs/src/theme/Blog/Components/Author/index.tsx
  • apps/docs/src/theme/Footer/Copyright/index.tsx
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-11-13T15:35:13.879Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 348
File: packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts:23-27
Timestamp: 2025-11-13T15:35:13.879Z
Learning: In the notification-summary block service (packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts), the hardcoded limit of 1000 notifications when calling notificationService.getNotificationList() is intentional, as there is no server-side aggregation API available for fetching notification counts by priority.

Applied to files:

  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx
📚 Learning: 2025-11-13T15:40:10.528Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 348
File: packages/blocks/notification-summary/src/frontend/NotificationSummary.renderer.tsx:1-15
Timestamp: 2025-11-13T15:40:10.528Z
Learning: In next-intl 3.0+, hook-style APIs like useLocale(), useTranslations(), and useFormatter() can be used in non-async Server Components without the 'use client' directive. The library provides server-optimized implementations automatically. Only async Server Components need to use the await-based APIs like getLocale() from next-intl/server.

Applied to files:

  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.renderer.tsx
📚 Learning: 2025-12-03T12:34:20.707Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 419
File: apps/frontend/package.json:52-52
Timestamp: 2025-12-03T12:34:20.707Z
Learning: In the openselfservice repository, the application does not use Next.js cache components (use cache/cacheComponents), so next-intl compatibility limitations related to those experimental features are not a concern.

Applied to files:

  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.renderer.tsx
📚 Learning: 2025-11-14T14:34:25.489Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 357
File: packages/blocks/ticket-summary/eslint.config.mjs:1-18
Timestamp: 2025-11-14T14:34:25.489Z
Learning: ESLint v9+ provides `defineConfig` as an export from 'eslint/config' module, which supports an `extends` array property in flat config objects for composing configurations.

Applied to files:

  • packages/modules/surveyjs/eslint.config.mjs
  • apps/docs/eslint.config.mjs
🧬 Code graph analysis (12)
packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (1)
packages/blocks/notification-summary/src/sdk/index.ts (1)
  • sdk (24-28)
packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/product-list/src/frontend/ProductList.server.tsx (1)
packages/blocks/product-list/src/sdk/index.ts (1)
  • sdk (24-28)
packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/order-details/src/frontend/OrderDetails.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/faq/src/frontend/Faq.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (3)
packages/blocks/notification-summary/src/sdk/index.ts (1)
  • sdk (24-28)
packages/blocks/ticket-summary/src/sdk/index.ts (1)
  • sdk (24-28)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/user-account/src/frontend/UserAccount.server.tsx (2)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
apps/frontend/src/auth/auth.config.ts (1)
  • onSignOut (41-41)
packages/blocks/article-list/src/frontend/ArticleList.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
🪛 ast-grep (0.40.0)
apps/docs/src/theme/Footer/Links/Simple/index.tsx

[warning] 16-16: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

apps/docs/src/theme/Footer/Links/MultiColumn/index.tsx

[warning] 15-15: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: deploy-preview
🔇 Additional comments (50)
apps/docs/src/components/DXPComplexPlatformsSection/index.tsx (1)

31-31: LGTM! Apostrophe properly escaped in JSX text.

This change correctly escapes the apostrophe using the HTML entity &apos;, addressing the ESLint react/no-unescaped-entities warning. While functionally equivalent to the literal apostrophe, this follows JSX best practices and aligns with the PR's goal of achieving zero linter warnings.

packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.renderer.tsx (1)

9-9: LGTM! Unused prop removed.

Removing the unused slug prop appropriately addresses the linter warning without affecting functionality.

apps/docs/src/theme/NavbarItem/DropdownNavbarItem/index.tsx (2)

43-43: LGTM: Correct prop filtering to prevent forwarding.

The underscore-prefixed destructuring (_onClick) correctly prevents the onClick prop from being forwarded via ...props to NavbarNavLink. Since line 87 already defines its own onClick handler, this avoids potential prop conflicts while satisfying the linter's unused-variable check.


124-124: LGTM: Proper prop exclusion for mobile context.

The underscore-prefixed destructuring (_position) correctly prevents the position prop from being forwarded in the mobile context where it's not applicable. The inline comment clearly documents the intent, and this pattern aligns with standard ESLint conventions for intentionally unused variables.

packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (1)

28-30: LGTM! Single return path maintains correct error handling.

The refactored control flow correctly preserves the error handling semantics while providing a unified return path. The early return in the catch block (line 25) ensures data is always defined when reaching this return statement.

packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (1)

33-42: LGTM! Unified return path improves code clarity.

Moving the render logic outside the try/catch block creates a cleaner separation of concerns: data fetching → error handling → rendering. This pattern enhances readability and makes the component's flow easier to follow.

packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (1)

36-46: LGTM—Consistent unified return pattern.

The single return statement after the try-catch block successfully unifies the rendering path. The control flow guarantees that data is assigned before reaching this point, and spreading the data props into TicketDetailsDynamic is safe and correct.

packages/modules/surveyjs/src/frontend/Questions/CustomSurveyQuestionText.tsx (1)

92-96: SurveyJS uses direct property mutation—the ESLint suppression is correct.

SurveyJS documentation confirms that to access and update a question value, you assign a new value to the question's value property. Official SurveyJS examples for custom widgets use direct assignment (e.g., question.value = editor.getData()). The question object is a mutable model from survey-core, not an immutable React prop, so the ESLint suppression is appropriate and correctly applied.

Likely an incorrect or invalid review comment.

packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (1)

36-46: Pattern aligns with PR goals.

The single-return refactor successfully addresses linter warnings while maintaining correct runtime behavior. The control flow ensures data is properly initialized before spreading (catch block returns early). With the type annotation suggested above, this pattern provides both linter compliance and type safety.

apps/docs/src/components/SubscribeSection/index.tsx (1)

100-109: Underscore convention for unused catch parameter is appropriate.

The _error rename correctly signals the intentionally unused variable and silences the linter. However, consider whether logging the actual error (even to console in development) would aid debugging network failures.

apps/docs/src/components/WaitlistForm/index.tsx (1)

73-79: LGTM!

Consistent use of the underscore prefix convention to indicate an intentionally unused catch parameter, matching the pattern in SubscribeSection.

package.json (1)

11-11: Good enforcement of zero-warning policy.

Adding --max-warnings=0 ensures that warnings are treated as errors, preventing gradual accumulation of linter warnings across the codebase. This aligns well with the PR objectives.

packages/modules/surveyjs/eslint.config.mjs (1)

1-17: LGTM!

The quote style normalization is consistent with the broader PR changes. The ESLint flat config structure using defineConfig with the extends array property is appropriate for ESLint v9+. Based on learnings, this pattern is the correct approach for composing configurations.

apps/docs/src/components/HubspotForm/index.tsx (1)

225-225: LGTM! Proper handling of unused catch parameter.

Prefixing the unused error parameter with an underscore follows TypeScript/ESLint conventions and eliminates linter warnings without changing behavior.

apps/docs/src/pages/product/features.tsx (1)

289-291: LGTM! Proper apostrophe escaping in JSX.

Using the HTML entity &apos; for apostrophes in JSX text content is correct and prevents potential parsing issues. This change aligns with the broader text escaping improvements across the docs site.

apps/docs/package.json (1)

16-16: LGTM! Enhanced lint script with TypeScript and ESLint.

The updated lint script now runs both TypeScript type-checking and ESLint with auto-fix, which aligns perfectly with the PR's goal of enforcing stricter linting standards across the codebase.

apps/docs/src/pages/contact/index.tsx (1)

46-49: LGTM! Proper apostrophe escaping in JSX.

The change to use &apos; HTML entity and wrap the content in a JSX fragment is correct and consistent with the text escaping improvements throughout this PR.

apps/docs/src/pages/product/integrations.tsx (1)

271-272: LGTM! Proper apostrophe escaping in JSX.

The change to use &apos; HTML entity for the apostrophe in "That's" is correct and consistent with the text escaping improvements applied throughout the docs site in this PR.

apps/docs/src/components/HomepageFeaturesSection/index.tsx (1)

7-7: LGTM! Clean removal of unused import.

The removal of H4 from the Typography imports aligns with the file's actual usage and contributes to the linting cleanup goals of this PR.

apps/docs/eslint.config.mjs (1)

8-9: LGTM! Appropriate rule override for Docusaurus.

Disabling @next/next/no-img-element is correct since Docusaurus doesn't use Next.js's optimized Image component.

apps/docs/src/components/HomepageJoinTheWaitlistSection/index.tsx (1)

35-35: LGTM! Security best practice applied.

Adding rel="noreferrer" to external links with target="_blank" prevents the new page from accessing window.opener and prevents referrer information leakage, improving the security posture of the application.

Also applies to: 45-45

apps/docs/src/components/GetStartedButtons/index.tsx (2)

2-2: LGTM! Unused import removed.

Removing the unused useState import cleans up the code and aligns with the linting improvements in this PR.


11-16: LGTM! Security attributes properly applied.

The addition of rel="noreferrer" (line 15) and updating to rel="noopener noreferrer" (line 23) on external links follows security best practices by preventing referrer leakage and blocking access to window.opener.

Also applies to: 23-23

apps/docs/src/components/HomepageFeatures/index.tsx (2)

4-7: LGTM! Cleaner static imports replace dynamic require().

Replacing require(...) with static named imports improves code clarity, enables better tree-shaking, and provides better TypeScript support.


21-21: LGTM! Svg assignments updated correctly.

The Svg properties now reference the statically imported components, consistent with the import changes at the top of the file.

Also applies to: 31-31, 41-41

apps/docs/src/pages/index.tsx (1)

19-19: LGTM! Unused import removed.

Removing BodyBold from the Typography imports aligns with the linting cleanup, as the component is not used in the active code.

packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx (1)

13-27: The control flow refactoring is logically sound.

The success path assigns data and returns the component on Line 27, while the error path returns null from the catch block. However, I could not identify which specific ESLint rule from the repository's configuration (TypeScript ESLint recommended) requires this single-return-path pattern over the previous approach of returning directly from within the try block. Both patterns are valid and commonly used in JavaScript/TypeScript projects. If this change was made to satisfy a linter warning, consider documenting which rule it addresses for future maintainers.

packages/blocks/user-account/src/frontend/UserAccount.server.tsx (1)

25-50: The current code is type-safe and does not require an explicit type annotation.

With strict: true enabled in the project's TypeScript configuration, control flow analysis correctly recognizes that data is always assigned before use because the catch block returns early. No explicit type annotation is needed for correctness, and the code compiles without errors.

Likely an incorrect or invalid review comment.

packages/blocks/product-list/src/frontend/ProductList.server.tsx (2)

26-26: Final return is functionally correct.

The return statement correctly spreads the fetched data to ProductListDynamic. This will work as expected if the type safety issue with the data variable (flagged above) is addressed.


13-24: This pattern is not a type safety concern—TypeScript's control flow analysis handles this correctly.

The let data; declaration without explicit type annotation is safe here because:

  1. TypeScript's control flow analysis recognizes that data is always assigned in the try block before reaching the return statement (line 26), since the catch block returns early.
  2. The function signature specifies strict: true in tsconfig, enabling full type checking.
  3. This pattern is consistently used across 34+ server components in this codebase without type errors.
  4. At line 26, TypeScript correctly infers data as ProductListBlock, matching the expected type for spreading into ProductListDynamic.

The refactor maintains the same type safety as the original code.

packages/blocks/category/src/frontend/Category.server.tsx (1)

33-45: This pattern is type-safe and consistent across the codebase—no action needed.

The early return in the catch block (line 30) prevents data from being used uninitialized, making the control flow safe. This guard-clause pattern is consistently applied across 30+ block components and appears to be an intentional architectural choice. No ESLint rule in the project configuration enforces or necessitates this pattern, confirming it is a deliberate design decision rather than a workaround for a linter warning.

Likely an incorrect or invalid review comment.

packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (1)

13-36: Refactoring pattern looks good.

The control-flow restructuring to use a single return path after try-catch is consistent with the broader PR pattern and successfully addresses linter warnings. The catch block ensures data is never used uninitialized.

Optional: Add explicit TypeScript typing for better type safety
-    let data;
+    let data: Awaited<ReturnType<typeof sdk.blocks.getHeroSection>>;
     try {

This preserves type information that would otherwise be inferred.

packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx (1)

17-39: LGTM - Consistent refactoring pattern.

This follows the same unified return-path pattern as other server components in the PR, successfully addressing linter requirements while maintaining functional equivalence.

packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (1)

20-46: LGTM - Consistent with PR pattern.

The refactoring aligns with the unified return-path approach used across all server components in this PR.

packages/blocks/order-list/src/frontend/OrderList.server.tsx (1)

11-33: LGTM - Refactoring pattern applied correctly.

This maintains the consistent single-return-path approach used throughout the PR.

packages/blocks/article-list/src/frontend/ArticleList.server.tsx (1)

20-43: LGTM - Consistent refactoring approach.

The unified return path successfully addresses linter warnings while maintaining functional equivalence.

packages/blocks/notification-list/src/frontend/NotificationList.server.tsx (1)

19-41: LGTM - Pattern applied correctly.

This follows the consistent refactoring pattern used across all server components in the PR.

packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx (1)

19-41: LGTM - Refactoring pattern consistent.

The single-return-path approach aligns with the PR-wide pattern and successfully addresses linter requirements.

packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (1)

13-27: LGTM - Refactoring pattern applied correctly.

This completes the consistent refactoring across all server components, maintaining the unified return-path approach while preserving error logging.

packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1)

11-25: LGTM—consistent refactoring pattern.

Same control-flow refactor as other files in this PR. Functionally correct. Optionally add type annotation to data as suggested in PaymentsSummary.server.tsx.

packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (1)

19-41: LGTM—consistent refactoring pattern.

Control-flow refactor is correct. Optionally add type annotation to data for improved type safety.

packages/blocks/faq/src/frontend/Faq.server.tsx (1)

18-41: LGTM—consistent refactoring pattern.

Functionally equivalent refactor. Optionally add type annotation to data.

packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1)

11-25: LGTM—consistent refactoring pattern.

Refactor is correct. Optionally add type annotation to data.

packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx (1)

13-27: LGTM—consistent refactoring pattern.

Functionally correct. Optionally add type annotation to data.

packages/blocks/service-list/src/frontend/ServiceList.server.tsx (1)

13-35: LGTM—consistent refactoring pattern.

Refactor maintains correctness. Optionally add type annotation to data.

packages/blocks/document-list/src/frontend/DocumentList.server.tsx (1)

13-36: LGTM—consistent refactoring pattern.

Final file with the same control-flow refactor. Functionally correct. Optionally add type annotation to data.

packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (1)

38-47: LGTM! Consistent refactoring pattern.

The control flow refactor matches the pattern applied across other server components in this PR, providing a single return path and improving code consistency. The error handling is preserved correctly with the early return in the catch block.

packages/blocks/article/src/frontend/Article.server.tsx (1)

24-33: Single return path improves control flow clarity, but the specific ESLint warning it addresses remains unclear.

The refactoring from returning inside the try block to a single return path after try-catch is a valid code clarity improvement. However, after examining the ESLint configuration and standard rule sets (js.configs.recommended, tseslint.configs.recommended, and React/Next plugins), I cannot definitively identify which specific ESLint rule would flag the original pattern. The change itself is sound—moving the return statement outside the try block creates a clearer control flow—but verification of the exact linter warning driving this change is needed to ensure it satisfies the --max-warnings=0 enforcement.

packages/blocks/media-section/src/frontend/MediaSection.server.tsx (1)

13-27: The code pattern is type-safe and compiles without errors in strict mode. TypeScript's control flow analysis correctly narrows the type after the catch block's early return, so data is proven defined at the spread point. With strict: true enabled (including strictNullChecks and noImplicitAny) and an explicit return type (Promise<Model.MediaSectionBlock>) on sdk.blocks.getMediaSection, TypeScript successfully validates that data cannot be undefined when used on line 27. The pattern appears 34 times across the codebase with no type suppressions, confirming the refactor compiles successfully.

Likely an incorrect or invalid review comment.

packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (1)

13-27: This TypeScript pattern compiles without errors.

TypeScript 3.9+ fixed control flow analysis for try/catch blocks, and the project uses TypeScript 5.9.3, which properly handles this pattern. Since the catch block returns null (exiting the function), the only way to reach line 27 is if the try block completes successfully, guaranteeing data is assigned. TypeScript's control flow analysis recognizes this path, and the type inference correctly identifies data as Model.TicketSummaryBlock, which aligns with what TicketSummaryDynamic expects when spread alongside the additional props.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (7)
packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1)

4-4: Consider reverting to the original early-return pattern.

The refactoring introduces an uninitialized variable (data) that relies on control-flow analysis to prove it's always assigned before use. While TypeScript should handle this correctly (the catch block always returns, so line 26 is only reachable if data was assigned), the original pattern—returning directly inside the try block—is more idiomatic, maintainable, and safer:

try {
    const data = await sdk.blocks.getCtaSection(
        { id },
        { 'x-locale': locale },
        accessToken,
    );
    return <CtaSectionDynamic {...data} id={id} accessToken={accessToken} locale={locale} routing={routing} />;
} catch (error) {
    console.error('Error fetching CtaSection block', error);
    return null;
}

Benefits of the original pattern:

  • No uninitialized variables
  • Clearer data flow (fetch → use immediately)
  • Less fragile (if someone later modifies the catch block to not always return, the current code would use an uninitialized variable)

Since the PR objective is to resolve linter warnings, please verify that this specific refactoring actually addresses a concrete linter rule (e.g., a rule requiring single return points). If this change is resolving a warning, that warning might indicate a broader configuration issue worth revisiting.

Could you confirm which specific linter warning this refactoring resolves? If it's a rule enforcing single return points, consider whether that rule aligns with modern JavaScript/TypeScript best practices (where early returns are generally preferred for clarity and safety).

Also applies to: 12-12, 14-26

packages/blocks/ticket-list/src/frontend/TicketList.server.tsx (1)

4-4: LGTM! Type annotations correctly fix linter warnings.

The explicit type import and annotation on data resolve implicit-any warnings, which aligns with the PR objective to enforce --max-warnings=0. The control flow is sound—TypeScript's definite assignment analysis correctly recognizes that data is always assigned before use or the function returns early on error.

💡 Optional: Refactor to use const and simplify control flow

Consider moving the return statement into the try block for slightly cleaner code:

-    let data: Model.TicketListBlock;
     try {
-        data = await sdk.blocks.getTicketList(
+        const data = await sdk.blocks.getTicketList(
             {
                 id,
                 preview: isDraftModeEnabled,
             },
             { 'x-locale': locale },
             accessToken,
         );
+        return (
+            <TicketListDynamic
+                {...data}
+                id={id}
+                accessToken={accessToken}
+                locale={locale}
+                routing={routing}
+                hasPriority={hasPriority}
+            />
+        );
     } catch (_error) {
         return null;
     }
-
-    return (
-        <TicketListDynamic
-            {...data}
-            id={id}
-            accessToken={accessToken}
-            locale={locale}
-            routing={routing}
-            hasPriority={hasPriority}
-        />
-    );

Benefits: uses const instead of let, eliminates the need for explicit type annotation (type is inferred), and makes the control flow more explicit. However, the current implementation is perfectly valid.

Also applies to: 19-19

packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (1)

20-42: Refactor looks good; consider adding error logging for consistency.

The unified return path successfully addresses the linter requirements. The pattern is safe because the catch block returns early, ensuring data is always assigned before the final render.

However, unlike HeroSection and DocumentList which log fetch errors, this catch block silently suppresses errors. Consider logging the error to aid debugging in production.

🔎 Optional: Add error logging for consistency
-    } catch (_error) {
+    } catch (error) {
+        console.error('Error fetching InvoiceList block', error);
         return null;
     }
packages/blocks/article-list/src/frontend/ArticleList.server.tsx (1)

21-44: Refactor achieves the goal; consider error logging.

The single return path refactor is correct and safe. TypeScript ensures data is assigned before use since the catch block exits early.

Like InvoiceList, this file suppresses errors (via _error) while HeroSection and DocumentList log them. Adding logging would improve observability across all blocks.

🔎 Optional: Add error logging for consistency
-    } catch (_error) {
+    } catch (error) {
+        console.error('Error fetching ArticleList block', error);
         return null;
     }
packages/blocks/faq/src/frontend/Faq.server.tsx (1)

19-42: Refactor is correct; error logging would enhance observability.

The unified return path meets the linter requirements and is type-safe. The catch block's early return ensures data is always initialized before the final render.

For consistency with HeroSection and DocumentList, consider logging the fetch error to aid production debugging.

🔎 Optional: Add error logging for consistency
-    } catch (_error) {
+    } catch (error) {
+        console.error('Error fetching Faq block', error);
         return null;
     }
turbo/generators/templates/block/frontend/server.hbs (1)

14-28: Consider initializing data for safer control flow.

The refactored pattern declares data without initialization (line 14), relying on TypeScript's control flow analysis to ensure it's assigned before use on line 28. While functionally correct (since the catch block always returns on line 25), this pattern is fragile:

  1. Implicit assumption: The code safety depends on the catch block always returning, which isn't enforced by the type system.
  2. Future modifications: If someone later modifies the catch block to conditionally return, data could be used uninitialized.
  3. Readability: The original pattern (const declaration inside try) was clearer about data's scope and lifetime.

If this refactor addresses specific ESLint rules (e.g., no-return-in-try or prefer-single-return), consider these alternatives:

🔎 Safer alternative: Initialize with undefined
-    let data: Model.{{ pascalCase name }}Block;
+    let data: Model.{{ pascalCase name }}Block | undefined;
     try {
         data = await sdk.blocks.get{{ pascalCase name }}(
             {
                 id,
             },
             { 'x-locale': locale },
             accessToken,
         );
     } catch (error) {
         console.error('Error fetching {{ pascalCase name }} block', error);
         return null;
     }
+    if (!data) {
+        return null;
+    }

     return <{{ pascalCase name }}Dynamic {...data} id={id} accessToken={accessToken} locale={locale} routing={routing} />;

This makes the control flow explicit and doesn't rely on catch always returning.

Since this is a template file, the pattern will be replicated across all generated blocks. Please verify which specific linting rule this refactor addresses, as that context would help evaluate whether the trade-off is justified.

packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx (1)

14-28: Clarify which ESLint rule requires this refactored pattern.

The refactor moves from an early return inside the try block to a hoisted let variable with a single return after try/catch. While technically correct (TypeScript's control flow analysis recognizes that data is definitely assigned at line 28 since the catch always returns), this pattern is less intuitive than an early return.

Can you confirm which specific ESLint rule (from the --max-warnings=0 enforcement) necessitates this pattern? If no linter rule requires it, the original pattern would be clearer:

try {
    const data = await sdk.blocks.getFeatureSection(...);
    return <FeatureSectionDynamic {...data} ... />;
} catch (error) {
    console.error('Error fetching FeatureSection block', error);
    return null;
}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b4d706 and 9fc66e6.

📒 Files selected for processing (67)
  • .changeset/evil-results-nail.md (1 hunks)
  • apps/docs/package.json (1 hunks)
  • apps/frontend/package.json (2 hunks)
  • packages/blocks/article-list/package.json (1 hunks)
  • packages/blocks/article-list/src/frontend/ArticleList.server.tsx (2 hunks)
  • packages/blocks/article-search/package.json (1 hunks)
  • packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx (2 hunks)
  • packages/blocks/article/package.json (1 hunks)
  • packages/blocks/article/src/frontend/Article.server.tsx (1 hunks)
  • packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1 hunks)
  • packages/blocks/category-list/package.json (1 hunks)
  • packages/blocks/category-list/src/frontend/CategoryList.server.tsx (2 hunks)
  • packages/blocks/category/package.json (1 hunks)
  • packages/blocks/category/src/frontend/Category.server.tsx (2 hunks)
  • packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1 hunks)
  • packages/blocks/document-list/src/frontend/DocumentList.server.tsx (2 hunks)
  • packages/blocks/faq/package.json (1 hunks)
  • packages/blocks/faq/src/frontend/Faq.server.tsx (2 hunks)
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx (2 hunks)
  • packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx (2 hunks)
  • packages/blocks/featured-service-list/package.json (1 hunks)
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (2 hunks)
  • packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (2 hunks)
  • packages/blocks/invoice-list/package.json (1 hunks)
  • packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (2 hunks)
  • packages/blocks/media-section/src/frontend/MediaSection.server.tsx (2 hunks)
  • packages/blocks/notification-details/package.json (1 hunks)
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (3 hunks)
  • packages/blocks/notification-list/package.json (1 hunks)
  • packages/blocks/notification-list/src/frontend/NotificationList.server.tsx (2 hunks)
  • packages/blocks/notification-summary/package.json (1 hunks)
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (2 hunks)
  • packages/blocks/order-details/package.json (1 hunks)
  • packages/blocks/order-details/src/frontend/OrderDetails.server.tsx (3 hunks)
  • packages/blocks/order-list/package.json (1 hunks)
  • packages/blocks/order-list/src/frontend/OrderList.server.tsx (1 hunks)
  • packages/blocks/orders-summary/package.json (1 hunks)
  • packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (3 hunks)
  • packages/blocks/payments-history/package.json (1 hunks)
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (3 hunks)
  • packages/blocks/payments-summary/package.json (1 hunks)
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx (3 hunks)
  • packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (2 hunks)
  • packages/blocks/product-list/src/frontend/ProductList.server.tsx (2 hunks)
  • packages/blocks/quick-links/package.json (1 hunks)
  • packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx (2 hunks)
  • packages/blocks/service-details/package.json (1 hunks)
  • packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (3 hunks)
  • packages/blocks/service-list/package.json (1 hunks)
  • packages/blocks/service-list/src/frontend/ServiceList.server.tsx (2 hunks)
  • packages/blocks/surveyjs-form/package.json (1 hunks)
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx (2 hunks)
  • packages/blocks/ticket-details/package.json (1 hunks)
  • packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (3 hunks)
  • packages/blocks/ticket-list/package.json (1 hunks)
  • packages/blocks/ticket-list/src/frontend/TicketList.server.tsx (2 hunks)
  • packages/blocks/ticket-recent/package.json (1 hunks)
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx (2 hunks)
  • packages/blocks/ticket-summary/package.json (1 hunks)
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (2 hunks)
  • packages/blocks/user-account/package.json (1 hunks)
  • packages/blocks/user-account/src/frontend/UserAccount.server.tsx (2 hunks)
  • packages/configs/integrations/package.json (2 hunks)
  • packages/modules/surveyjs/package.json (1 hunks)
  • packages/utils/api-harmonization/package.json (1 hunks)
  • packages/utils/frontend/package.json (1 hunks)
  • turbo/generators/templates/block/frontend/server.hbs (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/blocks/ticket-summary/package.json
  • packages/blocks/order-details/package.json
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx
  • packages/blocks/product-list/src/frontend/ProductList.server.tsx
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx
  • apps/docs/package.json
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx
  • packages/blocks/user-account/src/frontend/UserAccount.server.tsx
  • packages/blocks/order-details/src/frontend/OrderDetails.server.tsx
  • packages/blocks/media-section/src/frontend/MediaSection.server.tsx
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx
  • packages/blocks/category/src/frontend/Category.server.tsx
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx
  • packages/blocks/order-list/src/frontend/OrderList.server.tsx
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-13T15:35:13.879Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 348
File: packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts:23-27
Timestamp: 2025-11-13T15:35:13.879Z
Learning: In the notification-summary block service (packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts), the hardcoded limit of 1000 notifications when calling notificationService.getNotificationList() is intentional, as there is no server-side aggregation API available for fetching notification counts by priority.

Applied to files:

  • packages/blocks/notification-summary/package.json
  • packages/blocks/notification-list/src/frontend/NotificationList.server.tsx
📚 Learning: 2025-11-26T11:57:00.632Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 411
File: packages/framework/src/modules/cms/models/blocks/product-list.model.ts:29-46
Timestamp: 2025-11-26T11:57:00.632Z
Learning: In the framework layer (packages/framework/src/modules/cms/models/blocks/*.model.ts), block classes like ProductListBlock should NOT include explicit __typename discriminators. The __typename field is added at the API harmonization layer (packages/blocks/*/src/api-harmonization/*.model.ts) where it's needed for discriminated unions. The framework maintains normalized data models without these discriminators.

Applied to files:

  • packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx
  • packages/blocks/document-list/src/frontend/DocumentList.server.tsx
  • turbo/generators/templates/block/frontend/server.hbs
  • packages/blocks/category-list/src/frontend/CategoryList.server.tsx
  • packages/blocks/ticket-list/src/frontend/TicketList.server.tsx
🧬 Code graph analysis (5)
packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (1)
packages/framework/src/modules/cms/models/blocks/service-details.model.ts (1)
  • ServiceDetailsBlock (6-18)
packages/blocks/service-list/src/frontend/ServiceList.server.tsx (1)
packages/framework/src/modules/cms/models/blocks/service-list.model.ts (1)
  • ServiceListBlock (6-23)
packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (2)
packages/framework/src/modules/cms/models/blocks/ticket-details.model.ts (1)
  • TicketDetailsBlock (5-19)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/faq/src/frontend/Faq.server.tsx (1)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
🔇 Additional comments (53)
packages/blocks/faq/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 correctly enforces that ESLint warnings will fail the lint script, preventing code with warnings from being committed. This aligns with the PR objective to enforce stricter linting standards across all packages.

packages/blocks/featured-service-list/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

Adding --max-warnings=0 to the lint script aligns with the PR objective and ensures that ESLint warnings are treated as errors. This is a best practice for maintaining code quality and preventing warning accumulation in the codebase.

packages/blocks/service-list/package.json (1)

18-18: LGTM! Stricter linting improves code quality.

The addition of --max-warnings=0 enforces zero-tolerance for ESLint warnings, which aligns with the PR's goal of consistent code quality across all packages.

packages/blocks/ticket-recent/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 ensures ESLint warnings are treated as errors, preventing technical debt from accumulating. This change aligns with the PR objective of enforcing stricter linting standards across all packages.

packages/utils/frontend/package.json (1)

16-16: LGTM! Zero-warning enforcement aligns with PR objectives.

The addition of --max-warnings=0 successfully implements the stricter linting policy described in the PR objectives. This ensures that any future ESLint warnings will cause the lint script to fail, helping maintain consistent code quality.

packages/blocks/payments-summary/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

Adding --max-warnings=0 to the lint script is a best practice that prevents warning accumulation and ensures consistent code quality. The script properly sequences type checking, auto-fixing, and warning enforcement.

packages/blocks/quick-links/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 correctly enforces stricter linting standards and aligns with the PR objective. The command structure is optimal: type checking first, then auto-fixing, then failing on any remaining warnings.

packages/blocks/invoice-list/package.json (1)

18-18: LGTM! Zero-warnings enforcement added correctly.

The addition of --max-warnings=0 enforces strict linting and prevents warnings from accumulating, which aligns perfectly with the PR objectives. The flag placement is correct.

packages/blocks/notification-summary/package.json (1)

18-18: LGTM! Zero-warnings policy correctly enforced.

The addition of --max-warnings=0 aligns with the PR objective to enforce stricter linting standards across all packages.

packages/blocks/payments-history/package.json (1)

18-18: LGTM! Stricter linting enforced.

The addition of --max-warnings=0 correctly enforces a zero-warning policy, treating all ESLint warnings as errors. This aligns with the PR objective to tighten code quality standards across all packages.

packages/modules/surveyjs/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 aligns with the PR objective and ensures stricter linting enforcement. This prevents warnings from accumulating and maintains consistent code quality across the package.

packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx (1)

4-4: LGTM! Type annotation correctly fixes implicit any warning.

The explicit type annotation on data resolves ESLint warnings while maintaining type safety. TypeScript's control flow analysis correctly recognizes that data is definitely assigned before use, thanks to the early return in the catch block at line 30.

Also applies to: 19-19

packages/blocks/orders-summary/package.json (1)

18-18: LGTM! Enforces zero-warning policy.

The addition of --max-warnings=0 aligns with the PR objective to treat ESLint warnings as errors across the repository, ensuring consistent code quality enforcement.

packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1)

4-26: LGTM! Clean refactoring to unify return paths.

The changes successfully consolidate the component's success path into a single return statement outside the try/catch block, which aligns with the PR objective of resolving ESLint warnings. TypeScript's control flow analysis correctly handles this pattern—since the catch block returns early, the compiler understands that data is always assigned when execution reaches line 26.

The explicit Model.BentoGridBlock type annotation improves type safety, and the error handling logic remains intact.

packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (2)

4-4: LGTM: Import added for type annotation.

The import is necessary to type the data variable on line 20.


20-43: LGTM: Refactor unifies the render path.

The refactor correctly separates data fetching from rendering by:

  1. Declaring a typed variable to hold the fetched data
  2. Handling errors with an early return
  3. Rendering the component in a single path after the try/catch

This pattern addresses linter requirements for consistent return paths while maintaining correct control flow—data is guaranteed to be assigned when the render path is reached because any error triggers an early return in the catch block.

packages/blocks/service-list/src/frontend/ServiceList.server.tsx (3)

4-4: LGTM: Type import added correctly.

The Model type import is necessary for typing the data variable and follows proper import conventions.


14-25: Verify TypeScript accepts the uninitialized variable pattern.

The variable data is declared without initialization and assigned only within the try block. While the control flow ensures data is always assigned before use (since the catch block returns), TypeScript's definite assignment analysis may flag this as an error depending on strictness settings.

Please verify that this pattern compiles without errors in your TypeScript configuration. If issues arise, consider one of these alternatives:

Alternative approaches if TypeScript complains

Option 1: Initialize with undefined and add type guard

-let data: Model.ServiceListBlock;
+let data: Model.ServiceListBlock | undefined;
 try {
     data = await sdk.blocks.getServiceList(
         {
             id,
         },
         { 'x-locale': locale },
         accessToken,
     );
 } catch (_error) {
     return null;
 }
+
+if (!data) {
+    return null;
+}

 return (
     <ServiceListDynamic
         {...data}
         id={id}
         accessToken={accessToken}
         locale={locale}
         routing={routing}
         hasPriority={hasPriority}
     />
 );

Option 2: Use const with immediate return (more explicit)

-let data: Model.ServiceListBlock;
+let data: Model.ServiceListBlock | null = null;
 try {
     data = await sdk.blocks.getServiceList(
         {
             id,
         },
         { 'x-locale': locale },
         accessToken,
     );
 } catch (_error) {
     return null;
 }

+if (data === null) {
+    return null;
+}
+
 return (
     <ServiceListDynamic
         {...data}
         id={id}
         accessToken={accessToken}
         locale={locale}
         routing={routing}
         hasPriority={hasPriority}
     />
 );

27-36: LGTM: Single return path improves consistency.

The refactoring successfully unifies the component's return path by moving the render logic outside the try block. This approach:

  • Addresses the linter requirements mentioned in the PR objectives
  • Improves code consistency and readability
  • Correctly spreads the fetched data and passes through the required props
packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (1)

14-37: LGTM! Refactor unifies return path successfully.

The introduction of the hoisted data variable and single return path after try/catch aligns with the PR's goal of addressing linter warnings. TypeScript's control flow analysis ensures data is always assigned before use (the catch block returns early), making this pattern safe.

packages/blocks/document-list/src/frontend/DocumentList.server.tsx (1)

14-37: LGTM! Pattern is safe and consistent.

The refactor successfully consolidates the return path while maintaining proper error handling with logging. TypeScript's control flow ensures the final return is only reachable when data has been assigned.

packages/blocks/article/src/frontend/Article.server.tsx (4)

4-4: LGTM! Import supports the explicit type annotation.

The import of Model is necessary for the type annotation on line 12 and addresses the previous review feedback.


12-12: Explicit type annotation successfully addresses previous feedback.

The type annotation Model.ArticleBlock resolves the previous concern about implicit any type inference. TypeScript's control flow analysis correctly recognizes that data is definitely assigned before use at line 27 (either assigned in the try block or early return in catch).


21-23: Verify silent error handling is intentional.

The catch block returns null without logging or reporting errors. While this may be intentional for graceful degradation (e.g., hiding unavailable articles), it could also mask important issues like network failures, authentication problems, or API errors that should be surfaced.

Consider whether errors should be logged for debugging purposes, especially in server components where error visibility is limited.


25-34: LGTM! Clean single return path.

The refactored rendering with a single return statement improves code clarity and aligns with ESLint best practices. The spread of data followed by explicit props is correct and maintains the component's contract.

packages/blocks/ticket-details/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

This change directly implements the PR objective to enforce --max-warnings=0 across all packages, ensuring that ESLint warnings are treated as errors and preventing warning accumulation.

packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (2)

21-35: LGTM! Control flow ensures type safety.

The refactoring moves the return statement outside the try/catch block while maintaining type safety. TypeScript's control flow analysis recognizes that data is always assigned before use because the catch block returns early on error.

This pattern change addresses linter warnings (per PR objective) and unifies the return paths across server components.


37-47: LGTM! Clean return statement.

The return statement correctly renders the dynamic component with all necessary props. Spreading data first followed by explicit props is a good pattern that allows explicit props to override any conflicting properties from the data object.

packages/blocks/surveyjs-form/package.json (1)

18-18: LGTM! Enforcing zero-warnings policy.

The addition of --max-warnings=0 correctly implements the PR objective of treating all ESLint warnings as errors across packages. This is a good practice for maintaining consistent code quality.

turbo/generators/templates/block/frontend/server.hbs (1)

4-4: Appropriate import addition for type safety.

The Model import from the api-harmonization layer is correctly added to support the type annotation on line 14.

packages/blocks/notification-list/src/frontend/NotificationList.server.tsx (1)

4-4: LGTM! Solid refactoring that unifies the return path.

The refactoring successfully addresses the PR objectives by:

  • Adding type safety via Model.NotificationListBlock
  • Moving to a unified return pattern (single return after try/catch instead of early return in try)
  • Improving code maintainability and consistency across the codebase

TypeScript's control flow analysis correctly handles the uninitialized data variable since the catch block returns null, ensuring data is always assigned when execution reaches line 33.

The prop spreading pattern ({...data} followed by explicit props) is intentional—explicit props take precedence over spread properties, which ensures the component always receives the correct id, accessToken, locale, routing, and hasPriority values.

Also applies to: 20-42

packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (2)

5-5: Type safety concern from previous review has been addressed.

The explicit type annotation Model.OrdersSummaryBlock for the data variable successfully addresses the type safety concern raised in the previous review. Using the Model import is a cleaner, more maintainable approach than using Awaited<ReturnType<...>>, as it's more explicit and decouples the type from the SDK implementation details.

Also applies to: 22-22


38-48: LGTM: Cleaner control flow with return outside try/catch.

Moving the return statement outside the try/catch block improves readability and maintains a clear separation of concerns: data fetching, error handling, and rendering. TypeScript's control flow analysis correctly recognizes that data is definitely assigned when reaching this return statement, since the catch block returns early on errors.

packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx (2)

4-4: LGTM! Clean refactoring to unify return paths.

The refactoring improves code clarity by separating data fetching from rendering. The pattern of hoisting data, assigning it within the try block, and rendering after the try/catch is consistent and maintainable. TypeScript's control flow analysis correctly handles the definite assignment—if the assignment succeeds, data is defined; if it fails, the function returns early on line 30.

Also applies to: 20-28, 33-42


29-31: Verify error handling and logging approach.

The catch block returns null silently without explicit logging. While this may be intentional for optional blocks (allowing the page to continue rendering without this component), confirm that:

  • Silent failure is the desired UX for missing article search data
  • Error logging is handled by the SDK or a global error boundary if needed for production debugging
packages/blocks/category-list/src/frontend/CategoryList.server.tsx (2)

4-4: LGTM! Proper import for type safety.

The import of Model from the API harmonization layer is appropriate and enables explicit typing of the block data.


21-21: Excellent type safety improvement!

The explicit type annotation correctly matches the return type of sdk.blocks.getCategoryList and improves code clarity. The control flow ensures TypeScript recognizes that data is definitely assigned before use on line 37, with the catch block's early return preventing undefined variable access.

packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (3)

4-4: LGTM - Variable hoisting pattern for unified return.

The import and hoisted variable declaration correctly set up the pattern where data is fetched in a try block and rendered after. TypeScript's control flow analysis should recognize that the catch block returns, ensuring data is assigned when reaching the final return.

Also applies to: 21-21


37-47: LGTM - Clean unified return pattern.

The final return statement correctly renders the dynamic component with both the fetched data (spread) and the additional props. This unification of the return path after data fetching improves code clarity and aligns with the PR's objective to standardize block components.


23-35: Code pattern is correct.

The explicit type annotation on line 21 (let data: Model.ServiceDetailsBlock;) combined with the try-catch structure allows TypeScript's control flow analysis to correctly determine that data is definitely assigned before use. The catch block's early return ensures data is never accessed in the error path. This compiles without errors under strict mode.

packages/blocks/category-list/package.json (1)

18-18: LGTM! Stricter linting enforced.

The addition of --max-warnings=0 ensures ESLint warnings are treated as errors, preventing warning accumulation and maintaining code quality. This aligns with the PR's objective to enforce strict linting across all packages.

packages/blocks/article-search/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/blocks/order-list/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/blocks/article-list/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/blocks/service-details/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/blocks/notification-details/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/blocks/article/package.json (1)

18-18: LGTM! Consistent with repo-wide linting policy.

packages/utils/api-harmonization/package.json (1)

16-16: LGTM! Consistent with repo-wide linting policy.

packages/blocks/category/package.json (1)

18-18: LGTM! Enforcing zero warnings improves code quality.

The addition of --max-warnings=0 to the lint script aligns with the PR objective and is a best practice for maintaining strict code quality standards. The change is syntactically correct and the flag is a valid ESLint option.

packages/blocks/ticket-list/package.json (1)

18-18: Lint script execution timed out—investigate before merging.

The lint script execution exceeded the timeout threshold (120+ seconds), which suggests either the script is hanging or takes an unusually long time to complete. This needs investigation before the --max-warnings=0 flag change can be verified.

Please verify that:

  1. The lint script completes successfully in a reasonable timeframe
  2. No ESLint warnings exist that would cause the zero-warnings check to fail
packages/configs/integrations/package.json (1)

15-15: LGTM: Consistent enforcement of zero-warning policy.

The lint script update matches the pattern applied across other packages in this PR, maintaining consistency in lint enforcement.

packages/blocks/user-account/package.json (1)

18-18: LGTM: Consistent with PR-wide lint enforcement.

The lint script update correctly applies the --max-warnings=0 flag, aligning with the zero-warning policy being enforced across all packages.

packages/blocks/notification-list/package.json (1)

18-18: LGTM: Completes consistent lint enforcement across packages.

The lint script update correctly includes --max-warnings=0, maintaining consistency with the other package updates in this PR.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (5)
packages/blocks/media-section/src/frontend/MediaSection.types.ts (1)

15-17: Consider cleaning up the no-op Omit.

Omit<MediaSectionProps, ''> with an empty string doesn't omit any properties—it's effectively equivalent to MediaSectionProps. While this isn't a changed line, you might consider simplifying it in a follow-up if the intent was to extend without omitting:

🔎 Suggested simplification
-export type MediaSectionRendererProps = Omit<MediaSectionProps, ''> & {
+export type MediaSectionRendererProps = MediaSectionProps & {
     slug: string[];
 };
packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (1)

20-42: Refactoring to single return path looks good.

The control flow is correct: the catch block returns null, ensuring data is always assigned when the final return executes. This pattern provides consistency across block components.

Optional observation: The original pattern (declaring const data inside the try block and returning immediately) was more idiomatic and avoided mutable state. However, given this is part of a deliberate consistency effort across multiple blocks, the trade-off is acceptable.

packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx (1)

4-4: Refactor to single return path works correctly.

The changes successfully move the render logic outside the try/catch block using a mutable data variable. The control flow is correct: errors return null early, and the success path renders the component with the fetched data.

The previous pattern (declaring const data inside the try block with an immediate return) was slightly more explicit and avoided mutable variables, but the current approach is valid and aligns with the PR's goal of standardizing the pattern across similar server components.

Alternative: inline const pattern (optional)

If the linter rules permit, consider keeping the previous pattern for slightly better immutability and explicitness:

try {
    const data = await sdk.blocks.getSurveyjsBlock(
        { id },
        { 'x-locale': locale },
        accessToken,
    );
    return (
        <SurveyJsDynamic
            {...data}
            id={id}
            accessToken={accessToken}
            locale={locale}
            routing={routing}
            hasPriority={hasPriority}
        />
    );
} catch (_error) {
    return null;
}

This avoids let, keeps data scoped to where it's used, and doesn't rely on control flow analysis to prove initialization.

Also applies to: 18-40

packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (1)

14-28: Consider reverting to the original pattern for clarity and type safety.

The refactoring from declaring const data inside the try block with an early return to pre-declaring let data and returning after the catch works correctly, but introduces subtle maintainability risks:

  1. Less idiomatic: Modern TypeScript favors const and early returns over mutable let variables
  2. Fragile control flow: Future modifications to the catch block (removing return null; or adding logic between catch and return) could introduce bugs where data is used uninitialized
  3. Unclear motivation: The original pattern is standard for async error handling in React Server Components

Since the PR aims to fix linter warnings, could you clarify which ESLint rule this pattern addresses? Without a compelling linting or functional reason, the original pattern may be preferable.

🔎 Alternative: original pattern
-    let data: Model.TicketSummaryBlock;
     try {
-        data = await sdk.blocks.getTicketSummary(
+        const data = await sdk.blocks.getTicketSummary(
             {
                 id,
             },
             { 'x-locale': locale },
             accessToken,
         );
+        return <TicketSummaryDynamic {...data} id={id} accessToken={accessToken} locale={locale} routing={routing} />;
     } catch (error) {
         console.error('Error fetching TicketSummary block', error);
         return null;
     }
-
-    return <TicketSummaryDynamic {...data} id={id} accessToken={accessToken} locale={locale} routing={routing} />;
packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (1)

21-47: Consider restructuring for improved clarity—alternative patterns are more idiomatic.

The current uninitialized variable pattern is less explicit than alternatives and requires readers to trace control flow to understand the guarantee that data is assigned before use.

Option 1 (Recommended): Return inside try block

try {
    const data = await sdk.blocks.getTicketDetails(...);
    return <TicketDetailsDynamic {...data} ... />;
} catch (_error) {
    return null;
}

Option 2: Initialize with explicit type union

let data: Model.TicketDetailsBlock | undefined;
try {
    data = await sdk.blocks.getTicketDetails(...);
} catch (_error) {
    return null;
}
return <TicketDetailsDynamic {...data} ... />;

Option 1 is more idiomatic for React Server Components and eliminates the need to reason about control flow guarantees.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc66e6 and b78d54d.

📒 Files selected for processing (72)
  • packages/blocks/article-list/src/frontend/ArticleList.server.tsx (2 hunks)
  • packages/blocks/article-list/src/frontend/ArticleList.types.ts (1 hunks)
  • packages/blocks/article-search/src/frontend/ArticleSearch.client.tsx (1 hunks)
  • packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx (2 hunks)
  • packages/blocks/article-search/src/frontend/ArticleSearch.types.ts (1 hunks)
  • packages/blocks/article/src/frontend/Article.server.tsx (1 hunks)
  • packages/blocks/article/src/frontend/Article.types.ts (1 hunks)
  • packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx (1 hunks)
  • packages/blocks/bento-grid/src/frontend/BentoGrid.types.ts (1 hunks)
  • packages/blocks/category-list/src/frontend/CategoryList.server.tsx (2 hunks)
  • packages/blocks/category-list/src/frontend/CategoryList.types.ts (1 hunks)
  • packages/blocks/category/src/frontend/Category.server.tsx (2 hunks)
  • packages/blocks/category/src/frontend/Category.types.ts (1 hunks)
  • packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1 hunks)
  • packages/blocks/cta-section/src/frontend/CtaSection.types.ts (1 hunks)
  • packages/blocks/document-list/src/frontend/DocumentList.server.tsx (2 hunks)
  • packages/blocks/document-list/src/frontend/DocumentList.types.ts (1 hunks)
  • packages/blocks/faq/src/frontend/Faq.server.tsx (2 hunks)
  • packages/blocks/faq/src/frontend/Faq.types.ts (1 hunks)
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx (2 hunks)
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.types.ts (1 hunks)
  • packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx (2 hunks)
  • packages/blocks/feature-section/src/frontend/FeatureSection.types.ts (1 hunks)
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (2 hunks)
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.types.ts (1 hunks)
  • packages/blocks/hero-section/src/frontend/HeroSection.server.tsx (2 hunks)
  • packages/blocks/hero-section/src/frontend/HeroSection.types.ts (1 hunks)
  • packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (2 hunks)
  • packages/blocks/invoice-list/src/frontend/InvoiceList.types.ts (1 hunks)
  • packages/blocks/media-section/src/frontend/MediaSection.server.tsx (2 hunks)
  • packages/blocks/media-section/src/frontend/MediaSection.types.ts (1 hunks)
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (3 hunks)
  • packages/blocks/notification-details/src/frontend/NotificationDetails.types.ts (1 hunks)
  • packages/blocks/notification-list/src/frontend/NotificationList.server.tsx (2 hunks)
  • packages/blocks/notification-list/src/frontend/NotificationList.types.ts (1 hunks)
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (2 hunks)
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.types.ts (1 hunks)
  • packages/blocks/order-details/src/frontend/OrderDetails.server.tsx (3 hunks)
  • packages/blocks/order-details/src/frontend/OrderDetails.types.ts (1 hunks)
  • packages/blocks/order-list/src/frontend/OrderList.server.tsx (1 hunks)
  • packages/blocks/order-list/src/frontend/OrderList.types.ts (1 hunks)
  • packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (3 hunks)
  • packages/blocks/orders-summary/src/frontend/OrdersSummary.types.ts (1 hunks)
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (3 hunks)
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.types.ts (1 hunks)
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx (3 hunks)
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.types.ts (1 hunks)
  • packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (2 hunks)
  • packages/blocks/pricing-section/src/frontend/PricingSection.types.ts (1 hunks)
  • packages/blocks/product-list/src/frontend/ProductList.client.tsx (1 hunks)
  • packages/blocks/product-list/src/frontend/ProductList.server.tsx (2 hunks)
  • packages/blocks/product-list/src/frontend/ProductList.types.ts (1 hunks)
  • packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx (2 hunks)
  • packages/blocks/quick-links/src/frontend/QuickLinks.types.ts (1 hunks)
  • packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (3 hunks)
  • packages/blocks/service-details/src/frontend/ServiceDetails.types.ts (1 hunks)
  • packages/blocks/service-list/src/frontend/ServiceList.server.tsx (2 hunks)
  • packages/blocks/service-list/src/frontend/ServiceList.types.ts (1 hunks)
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.server.tsx (2 hunks)
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.types.ts (1 hunks)
  • packages/blocks/ticket-details/src/frontend/TicketDetails.server.tsx (3 hunks)
  • packages/blocks/ticket-details/src/frontend/TicketDetails.types.ts (1 hunks)
  • packages/blocks/ticket-list/src/frontend/TicketList.server.tsx (2 hunks)
  • packages/blocks/ticket-list/src/frontend/TicketList.types.ts (1 hunks)
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx (2 hunks)
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.types.ts (1 hunks)
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.server.tsx (2 hunks)
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.types.ts (1 hunks)
  • packages/blocks/user-account/src/frontend/UserAccount.server.tsx (2 hunks)
  • packages/blocks/user-account/src/frontend/UserAccount.types.ts (1 hunks)
  • turbo/generators/templates/block/frontend/server.hbs (1 hunks)
  • turbo/generators/templates/block/frontend/types.hbs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/blocks/article-search/src/frontend/ArticleSearch.client.tsx
🚧 Files skipped from review as they are similar to previous changes (13)
  • packages/blocks/faq/src/frontend/Faq.server.tsx
  • packages/blocks/article-list/src/frontend/ArticleList.server.tsx
  • packages/blocks/ticket-list/src/frontend/TicketList.server.tsx
  • packages/blocks/notification-list/src/frontend/NotificationList.server.tsx
  • packages/blocks/order-details/src/frontend/OrderDetails.server.tsx
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.server.tsx
  • packages/blocks/article-search/src/frontend/ArticleSearch.server.tsx
  • packages/blocks/feature-section/src/frontend/FeatureSection.server.tsx
  • packages/blocks/bento-grid/src/frontend/BentoGrid.server.tsx
  • packages/blocks/user-account/src/frontend/UserAccount.server.tsx
  • packages/blocks/service-list/src/frontend/ServiceList.server.tsx
  • packages/blocks/hero-section/src/frontend/HeroSection.server.tsx
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.server.tsx
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-11-26T11:57:00.632Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 411
File: packages/framework/src/modules/cms/models/blocks/product-list.model.ts:29-46
Timestamp: 2025-11-26T11:57:00.632Z
Learning: In the framework layer (packages/framework/src/modules/cms/models/blocks/*.model.ts), block classes like ProductListBlock should NOT include explicit __typename discriminators. The __typename field is added at the API harmonization layer (packages/blocks/*/src/api-harmonization/*.model.ts) where it's needed for discriminated unions. The framework maintains normalized data models without these discriminators.

Applied to files:

  • packages/blocks/orders-summary/src/frontend/OrdersSummary.types.ts
  • packages/blocks/ticket-details/src/frontend/TicketDetails.types.ts
  • packages/blocks/ticket-list/src/frontend/TicketList.types.ts
  • packages/blocks/service-list/src/frontend/ServiceList.types.ts
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx
  • packages/blocks/document-list/src/frontend/DocumentList.server.tsx
  • packages/blocks/product-list/src/frontend/ProductList.server.tsx
  • packages/blocks/article-search/src/frontend/ArticleSearch.types.ts
  • packages/blocks/category/src/frontend/Category.server.tsx
  • packages/blocks/order-details/src/frontend/OrderDetails.types.ts
  • packages/blocks/order-list/src/frontend/OrderList.types.ts
  • packages/blocks/category-list/src/frontend/CategoryList.server.tsx
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx
  • packages/blocks/product-list/src/frontend/ProductList.client.tsx
  • packages/blocks/invoice-list/src/frontend/InvoiceList.types.ts
  • packages/blocks/document-list/src/frontend/DocumentList.types.ts
  • packages/blocks/order-list/src/frontend/OrderList.server.tsx
  • packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx
  • packages/blocks/notification-list/src/frontend/NotificationList.types.ts
  • packages/blocks/service-details/src/frontend/ServiceDetails.types.ts
  • packages/blocks/quick-links/src/frontend/QuickLinks.types.ts
  • packages/blocks/pricing-section/src/frontend/PricingSection.types.ts
  • turbo/generators/templates/block/frontend/server.hbs
  • packages/blocks/category-list/src/frontend/CategoryList.types.ts
  • packages/blocks/feature-section/src/frontend/FeatureSection.types.ts
  • packages/blocks/user-account/src/frontend/UserAccount.types.ts
  • packages/blocks/hero-section/src/frontend/HeroSection.types.ts
  • packages/blocks/article/src/frontend/Article.types.ts
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.types.ts
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.types.ts
  • packages/blocks/category/src/frontend/Category.types.ts
  • turbo/generators/templates/block/frontend/types.hbs
  • packages/blocks/product-list/src/frontend/ProductList.types.ts
  • packages/blocks/faq/src/frontend/Faq.types.ts
  • packages/blocks/article-list/src/frontend/ArticleList.types.ts
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx
📚 Learning: 2025-11-14T14:24:34.907Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 357
File: packages/blocks/ticket-summary/src/frontend/TicketSummary.types.ts:14-16
Timestamp: 2025-11-14T14:24:34.907Z
Learning: In the openselfservice repository, the pattern `Omit<PropsType, ''>` in TypeScript type definitions is intentionally used as a template for future prop omissions, even though it currently does nothing. This convention is preferred for consistency across blocks, making it easier to add omissions when needed later.

Applied to files:

  • packages/blocks/service-details/src/frontend/ServiceDetails.types.ts
📚 Learning: 2025-11-13T15:35:13.879Z
Learnt from: marcinkrasowski
Repo: o2sdev/openselfservice PR: 348
File: packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts:23-27
Timestamp: 2025-11-13T15:35:13.879Z
Learning: In the notification-summary block service (packages/blocks/notification-summary/src/api-harmonization/notification-summary.service.ts), the hardcoded limit of 1000 notifications when calling notificationService.getNotificationList() is intentional, as there is no server-side aggregation API available for fetching notification counts by priority.

Applied to files:

  • packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx
  • packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx
🧬 Code graph analysis (7)
packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (2)
packages/blocks/cta-section/src/frontend/CtaSection.types.ts (1)
  • CtaSectionProps (5-11)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/product-list/src/frontend/ProductList.server.tsx (2)
packages/blocks/product-list/src/api-harmonization/product-list.model.ts (1)
  • ProductListBlock (7-29)
packages/blocks/product-list/src/sdk/index.ts (1)
  • sdk (24-28)
packages/blocks/category/src/frontend/Category.server.tsx (2)
packages/framework/src/modules/cms/models/blocks/category.model.ts (1)
  • CategoryBlock (5-19)
apps/frontend/src/blocks/renderBlocks.tsx (1)
  • renderBlocks (56-89)
packages/blocks/article/src/frontend/Article.server.tsx (2)
packages/blocks/article/src/frontend/Article.types.ts (1)
  • ArticleProps (5-12)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/order-list/src/frontend/OrderList.server.tsx (2)
packages/blocks/order-list/src/frontend/OrderList.types.ts (1)
  • OrderListProps (5-12)
apps/frontend/src/i18n/routing.ts (1)
  • routing (8-18)
packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (1)
packages/framework/src/modules/cms/models/blocks/payments-history.model.ts (1)
  • PaymentsHistoryBlock (3-10)
packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (1)
packages/framework/src/modules/cms/models/blocks/notification-details.model.ts (1)
  • NotificationDetailsBlock (5-14)
🔇 Additional comments (60)
packages/blocks/order-details/src/frontend/OrderDetails.types.ts (1)

3-3: LGTM! Type-only import reduces bundle size.

Converting to a type-only import is correct since Model is only used in type positions (line 14). This follows TypeScript best practices, reduces the runtime bundle size, and likely addresses the ESLint warning this PR aims to fix.

packages/blocks/surveyjs-form/src/frontend/SurveyJs.types.ts (1)

3-3: LGTM! Proper type-only import optimization.

Converting to import type is appropriate since Model is only used in type positions (line 13: Model.SurveyjsBlock). This improves bundle optimization and aligns with TypeScript best practices and the @typescript-eslint/consistent-type-imports rule.

packages/blocks/notification-details/src/frontend/NotificationDetails.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is appropriate here since Model is used exclusively in type positions (line 14). This reduces the runtime bundle size and aligns with the PR's objective to eliminate linter warnings.

packages/blocks/payments-summary/src/frontend/PaymentsSummary.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is appropriate since Model is only used in type positions (line 13). This follows TypeScript best practices, eliminates unnecessary runtime imports, and aligns with the PR's goal of addressing linter warnings.

packages/blocks/user-account/src/frontend/UserAccount.types.ts (1)

3-3: LGTM! Type-only import correctly optimizes the code.

Changing to import type is appropriate since Model is only used in type positions (line 15). This eliminates the unnecessary runtime import, reduces bundle size, and addresses the ESLint warning that the PR aims to fix.

packages/blocks/service-list/src/frontend/ServiceList.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is appropriate since Model is only used in type positions (line 13's type alias). This change improves tree-shaking, makes the intent explicit, and aligns with TypeScript best practices for addressing linter warnings.

packages/blocks/ticket-list/src/frontend/TicketList.types.ts (1)

3-3: LGTM: Type-only import correctly applied.

Converting Model to a type-only import is correct since it's only used in type positions (line 15). This follows TypeScript best practices, improves tree-shaking, and aligns with the PR's goal of eliminating linter warnings.

packages/blocks/bento-grid/src/frontend/BentoGrid.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is the appropriate fix since Model is only used in type positions (line 13). This eliminates an unnecessary runtime import and resolves the ESLint warning, aligning with the PR's objective to enforce --max-warnings=0.

turbo/generators/templates/block/frontend/types.hbs (1)

3-3: LGTM! Type-only import is appropriate here.

Converting to import type is correct since Model is used only in a type position (line 12). This template change will ensure all future generated blocks follow TypeScript best practices for type-only imports and satisfy the @typescript-eslint/consistent-type-imports linter rule.

packages/blocks/order-list/src/frontend/OrderList.types.ts (1)

3-3: LGTM! Correct use of type-only import.

Converting to import type is appropriate since Model is only used in type positions (line 18). This improves tree-shaking, clarifies intent, and resolves the linter warning.

packages/blocks/media-section/src/frontend/MediaSection.server.tsx (2)

4-4: Good use of type-only import.

Using import type for Model ensures the import is erased at runtime since it's only used for type annotations. This aligns with the linter warning fixes and TypeScript best practices.


14-28: LGTM! Clean refactor to unified post-try/catch render pattern.

The control flow is correct: TypeScript's flow analysis ensures data is definitely assigned when line 28 is reached, since the catch block returns early. This pattern aligns with the consistent approach adopted across other blocks in the repository.

packages/blocks/media-section/src/frontend/MediaSection.types.ts (1)

3-3: Good use of type-only import.

Since Model is only used in type positions (Model.MediaSectionBlock), the import type syntax is correct and ensures the import is stripped at compile time.

packages/blocks/article-search/src/frontend/ArticleSearch.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is appropriate since Model is used exclusively in type positions (line 13). This follows TypeScript best practices, improves tree-shaking, and aligns with the PR's objective to eliminate ESLint warnings.

packages/blocks/notification-list/src/frontend/NotificationList.types.ts (1)

3-3: LGTM! Type-only import is correctly applied.

The change to import type is appropriate since Model is only used in type positions (line 14). This follows TypeScript best practices and aligns with the PR's objective to eliminate linter warnings.

packages/blocks/quick-links/src/frontend/QuickLinks.types.ts (1)

3-3: LGTM! Type-only import is correct.

Converting to import type is appropriate since Model is only used in type positions (line 14). This follows TypeScript best practices and likely resolves an ESLint warning from @typescript-eslint/consistent-type-imports.

packages/blocks/feature-section/src/frontend/FeatureSection.types.ts (1)

3-3: LGTM! Type-only import correctly applied.

Converting to import type is the right approach since Model is only referenced in type positions. This improves clarity and can reduce bundle size.

packages/blocks/quick-links/src/frontend/QuickLinks.server.tsx (1)

4-4: LGTM! Type-only import and explicit type annotation correctly address linter warnings.

The changes improve type safety and reduce runtime dependencies:

  • Line 4: Using import type clarifies that Model is only needed at compile time, reducing bundle size.
  • Line 19: Explicit type annotation on data prevents implicit any and ensures type safety.

The control flow remains safe: if the fetch fails, the function returns null before data is accessed, so TypeScript's control flow analysis correctly validates that data is always assigned when used.

Also applies to: 19-19

packages/blocks/notification-summary/src/frontend/NotificationSummary.types.ts (1)

3-3: LGTM!

Correct use of import type since Model is only referenced in type positions (line 12). This change satisfies the @typescript-eslint/consistent-type-imports rule and helps bundlers with dead-code elimination.

packages/blocks/notification-summary/src/frontend/NotificationSummary.server.tsx (2)

4-4: LGTM!

Type-only import is appropriate since Model is solely used for the type annotation on line 14.


14-28: LGTM!

The refactored pattern correctly leverages TypeScript's control flow analysis—since the catch block returns early, data is guaranteed to be assigned when line 28 executes. This single-return approach improves readability and aligns with the consistent pattern applied across other block components in this PR.

packages/blocks/notification-details/src/frontend/NotificationDetails.server.tsx (1)

4-4: LGTM! Type safety improvement addresses previous review feedback.

The explicit type annotation Model.NotificationDetailsBlock for the data variable successfully addresses the past review comment and improves type safety. The refactored single-return pattern is cleaner and more maintainable than the previous immediate-return approach.

The control flow is safe: TypeScript's control flow analysis correctly recognizes that data is always assigned before use (the catch block returns early, so the final return statement only executes when assignment succeeds).

Also applies to: 21-47

packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.types.ts (1)

3-3: LGTM! Type-only import is the correct choice.

Since Model is used exclusively in type position (line 13), converting to a type-only import improves tree-shaking and reduces the runtime bundle size.

packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.server.tsx (1)

4-4: LGTM! Type-only import is appropriate.

The Model type is used only for type annotation (line 20), so a type-only import is correct and helps with bundle optimization.

packages/blocks/pricing-section/src/frontend/PricingSection.types.ts (1)

3-3: LGTM: Type-only import improves tree-shaking.

Converting to import type is a best practice when Model is only used for type annotations. This enables TypeScript to elide the import at runtime, improving bundle size.

packages/blocks/pricing-section/src/frontend/PricingSection.server.tsx (1)

4-4: LGTM: Single return path pattern addresses linter requirements.

The refactoring consolidates rendering logic to a single return statement after error handling. TypeScript's control flow analysis correctly recognizes that data is always assigned when reaching line 34, since the catch block provides an early return.

This pattern aligns with ESLint rules that prefer consistent return structures and is applied uniformly across block components in this PR.

Also applies to: 20-43

packages/blocks/ticket-recent/src/frontend/TicketRecent.types.ts (1)

3-3: LGTM! Type-only import improves build optimization.

Converting to import type is the correct approach since Model is only used in type positions. This eliminates unnecessary runtime imports and aligns with TypeScript best practices.

packages/blocks/ticket-recent/src/frontend/TicketRecent.server.tsx (1)

4-4: LGTM! Improved type safety and cleaner control flow.

The refactored pattern addresses the previous type safety concern and improves code clarity:

  • Type-only import reduces bundle size
  • Explicit type annotation (Model.TicketRecentBlock) provides compile-time safety
  • Single return path after try-catch makes the control flow more explicit and easier to reason about

This pattern aligns well with the broader refactoring across other block components in this PR.

Also applies to: 14-36

packages/blocks/payments-history/src/frontend/PaymentsHistory.types.ts (1)

1-1: LGTM! Type-only import is the correct approach.

Converting to a type-only import is best practice since Model is used exclusively as a type. This improves tree-shaking and makes the intent explicit.

packages/blocks/payments-history/src/frontend/PaymentsHistory.server.tsx (2)

4-4: LGTM! Type-only import aligns with usage.

The type-only import is correct since Model is used exclusively for type annotation.


14-31: LGTM! Refactoring improves code structure.

The refactoring successfully separates data fetching from rendering logic. The control flow is sound: if the API call fails, the function returns null early (line 26), and if it succeeds, data is definitely assigned before being used in the render (line 30).

packages/blocks/ticket-summary/src/frontend/TicketSummary.types.ts (1)

3-3: LGTM! Proper use of type-only import.

Since Model is only used in type positions (line 12), making it a type-only import correctly eliminates the runtime dependency and reduces bundle size.

packages/blocks/document-list/src/frontend/DocumentList.types.ts (1)

3-3: LGTM! Type-only import optimization.

Converting to import type is the correct approach since Model is only used in type positions. This helps with tree-shaking and reduces bundle size.

packages/blocks/cta-section/src/frontend/CtaSection.types.ts (1)

3-3: LGTM! Type-only import optimization.

The type-only import is correct since Model is only referenced in type annotations (line 13).

packages/blocks/service-details/src/frontend/ServiceDetails.types.ts (1)

3-3: LGTM! Type-only import optimization.

Correctly uses import type since Model is only used in type positions (line 14).

packages/blocks/service-details/src/frontend/ServiceDetails.server.tsx (1)

21-47: LGTM! Clean refactoring to single return path.

The control flow is safe: data is assigned in the try block, and the catch block returns early with null, ensuring data is always initialized when reaching the final return statement. This pattern improves consistency across the codebase.

packages/blocks/invoice-list/src/frontend/InvoiceList.types.ts (1)

3-3: LGTM! Type-only import optimization.

Correct use of import type since Model appears only in type annotations (line 13).

packages/blocks/hero-section/src/frontend/HeroSection.types.ts (1)

3-3: LGTM! Type-only import optimization.

The type-only import is appropriate since Model is only used in type positions (line 13).

packages/blocks/category/src/frontend/Category.types.ts (1)

6-6: LGTM! Type-only import optimization.

Correctly converts to import type since Model is only referenced in type annotations (line 19).

packages/blocks/faq/src/frontend/Faq.types.ts (1)

3-3: LGTM! Type-only import optimization.

The type-only import is correct since Model is only used in type annotations (line 14).

packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.types.ts (1)

3-3: LGTM! Proper type-only import optimization.

Converting to a type-only import is correct since Model is only used in type positions (line 13). This reduces the runtime bundle size.

packages/blocks/category/src/frontend/Category.server.tsx (1)

21-46: LGTM! Type-safe refactoring with proper control flow.

This refactoring addresses the previous type safety concern correctly. The explicit type annotation on line 21 combined with the early return in the catch block (line 31) ensures TypeScript's control flow analysis can prove data is definitely assigned when rendering occurs (lines 34-46).

The pattern is valid because:

  • If an error occurs, execution returns null and never reaches the render code
  • If no error occurs, data is assigned and the render proceeds with a guaranteed non-undefined value

This approach is cleaner than alternatives like let data: Model.CategoryBlock | undefined because it avoids unnecessary undefined handling in the render path.

packages/blocks/invoice-list/src/frontend/InvoiceList.server.tsx (1)

20-42: LGTM! Consistent type-safe pattern.

The refactoring follows the same type-safe pattern as other blocks in this PR, with proper control flow ensuring data is definitely assigned when rendering.

packages/blocks/document-list/src/frontend/DocumentList.server.tsx (1)

14-37: LGTM! Consistent refactoring with error logging.

This follows the same type-safe pattern as other blocks, with the added benefit of error logging (line 24) for debugging purposes.

packages/blocks/cta-section/src/frontend/CtaSection.server.tsx (1)

12-26: LGTM! Clean refactoring with consistent pattern.

The refactoring maintains type safety while creating a unified return path, consistent with the PR-wide improvements to server components.

packages/blocks/article-list/src/frontend/ArticleList.types.ts (1)

3-3: LGTM! Proper type-only import.

Correctly converts to a type-only import since Model is only used in type positions.

packages/blocks/category-list/src/frontend/CategoryList.server.tsx (1)

21-44: LGTM! Consistent type-safe refactoring.

The refactoring follows the established pattern with proper typing and control flow, ensuring type safety through the early return in the catch block.

packages/blocks/orders-summary/src/frontend/OrdersSummary.types.ts (1)

3-3: LGTM! Proper type-only import optimization.

Converting to a type-only import is correct since Model is only used in type positions (line 13).

packages/blocks/category-list/src/frontend/CategoryList.types.ts (1)

3-3: LGTM! Type-only import improves tree-shaking.

Converting to import type is correct since Model is only referenced in type positions (line 14). This prevents the Model namespace from being included in the runtime bundle.

packages/blocks/product-list/src/frontend/ProductList.server.tsx (1)

4-27: LGTM! Clean separation of data fetching and rendering.

The refactor improves code structure:

  • Type-only import reduces bundle size
  • Explicit typing on the data variable provides clear type safety
  • Single return path after try/catch makes control flow more maintainable
  • TypeScript's definite assignment analysis correctly tracks that data is always assigned before use (try assigns, catch exits early)

This pattern is consistent across other server components in the PR.

packages/blocks/orders-summary/src/frontend/OrdersSummary.server.tsx (1)

5-48: LGTM! Addresses previous review feedback.

The explicit type annotation let data: Model.OrdersSummaryBlock on line 22 properly addresses the concern raised in the previous review. The refactored control flow with a single return path after try/catch is clean and maintainable.

packages/blocks/product-list/src/frontend/ProductList.types.ts (1)

3-3: LGTM! Correct use of type-only import.

The import type syntax is appropriate since Model is only used in type positions throughout the file, ensuring it won't be included in the runtime bundle.

packages/blocks/article/src/frontend/Article.types.ts (1)

3-3: LGTM! Consistent type-only import pattern.

This change aligns with the repository-wide migration to type-only imports for Model, improving tree-shaking across all block types files.

packages/blocks/product-list/src/frontend/ProductList.client.tsx (1)

19-19: LGTM! Type-only import is correct.

Model is only used in type positions (lines 87 and 92: Model.Product), so the type-only import correctly ensures it's not bundled in the client JavaScript.

packages/blocks/article/src/frontend/Article.server.tsx (1)

4-34: LGTM! Well-structured refactor with explicit typing.

The changes address the previous review feedback by adding explicit type annotation on line 12. The refactored control flow with:

  • Type-only import for better tree-shaking
  • Explicitly typed data variable
  • Single return path after error handling

makes the code more maintainable and type-safe.

turbo/generators/templates/block/frontend/server.hbs (2)

4-28: Request verification that this refactor addresses ESLint warnings.

The PR objectives state this change enforces --max-warnings=0 by addressing various linter warnings. However, the refactoring from an in-try return to a final return outside the try-catch block doesn't obviously correlate with common ESLint rules.

Please confirm which specific ESLint rule(s) or warning(s) this pattern change resolves (e.g., no-useless-return, a custom rule about try-catch patterns, etc.) to ensure the template generates code that passes the stricter linting requirements.


14-28: The pre-declared data variable pattern is valid and preferred.

The control flow in this template is sound. TypeScript's flow analysis correctly handles the pattern where let data: Type; is declared, assigned in the try block, and used after the try-catch because the catch block returns early (preventing data from being undefined at the usage point). This approach avoids non-null assertion operators, which aligns with strict ESLint rules that discourage their use. The refactor leverages TypeScript's definite assignment analysis to achieve type safety without unsafe ! operators.

packages/blocks/order-list/src/frontend/OrderList.server.tsx (2)

4-4: LGTM! Good type import.

Adding the Model type import from the API harmonization layer provides proper type safety for the data variable.


12-34: Refactoring to single-return pattern is correct.

The code successfully uses a valid control flow pattern: declaring data before the try block, assigning it inside the try block, and returning in the catch block. Since the catch block always returns, TypeScript's control flow analysis recognizes that data is definitely assigned before being used on line 25. With strict: true enabled in your TypeScript configuration, this pattern compiles without errors.

packages/blocks/ticket-details/src/frontend/TicketDetails.types.ts (1)

3-3: LGTM! Type-only import improves tree-shaking.

Converting to a type-only import is correct since Model is only used in type positions. This eliminates unnecessary runtime dependencies and likely resolves an ESLint warning.

…linter-warnings

# Conflicts:
#	package-lock.json
…linter-warnings

# Conflicts:
#	package-lock.json
#	package.json
#	packages/blocks/article-list/package.json
#	packages/blocks/article-search/package.json
#	packages/blocks/article/package.json
#	packages/blocks/category-list/package.json
#	packages/blocks/category/package.json
#	packages/blocks/faq/package.json
#	packages/blocks/featured-service-list/package.json
#	packages/blocks/invoice-list/package.json
#	packages/blocks/notification-details/package.json
#	packages/blocks/notification-list/package.json
#	packages/blocks/notification-summary/package.json
#	packages/blocks/order-details/package.json
#	packages/blocks/order-list/package.json
#	packages/blocks/orders-summary/package.json
#	packages/blocks/payments-history/package.json
#	packages/blocks/payments-summary/package.json
#	packages/blocks/quick-links/package.json
#	packages/blocks/service-details/package.json
#	packages/blocks/service-list/package.json
#	packages/blocks/surveyjs-form/package.json
#	packages/blocks/ticket-details/package.json
#	packages/blocks/ticket-list/package.json
#	packages/blocks/ticket-recent/package.json
#	packages/blocks/ticket-summary/package.json
#	packages/blocks/user-account/package.json
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.

3 participants