Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inheritance-report): Adding prepaid inheritance form flow #14677

Merged
merged 48 commits into from
Jun 4, 2024

Conversation

juni-haukur
Copy link
Member

@juni-haukur juni-haukur commented May 2, 2024

WIP - part of the inheritance report

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced marital status data provider for inheritance reports.
    • Added support for prepaid inheritance applications, including specific forms and sections.
  • Bug Fixes

    • Corrected import paths for constants to improve consistency.
  • Enhancements

    • Updated logic in various components to handle prepaid inheritance scenarios.
    • Enhanced data mapping and conditional rendering based on application type.
  • Refactor

    • Streamlined import statements and reorganized code for better maintainability.

Copy link
Contributor

coderabbitai bot commented May 2, 2024

Walkthrough

The changes enhance the InheritanceReport module by integrating the NationalRegistryXRoadService to fetch marital status, updating constants imports, introducing new sections and fields for prepaid inheritance, and adding conditional logic to handle different inheritance scenarios. Additionally, new form sections and data providers are introduced to support the prepaid inheritance application process.

Changes

File(s) Change Summary
inheritance-report.module.ts, inheritance-report.service.ts Added NationalRegistryXRoadService to fetch marital status and removed unnecessary imports.
mappers.ts Updated expandAnswers function to include new executor structures.
DeceasedShare/index.tsx, CalculateShare/index.tsx, FuneralCost/index.tsx, SpouseEstateShare/index.tsx Updated import paths for constants.
MaritalStatusProvider.ts, index.ts (dataProviders) Introduced MaritalStatusProvider and exported it.
AssetsRepeater/index.tsx, OtherAssetsRepeater/index.tsx Added conditional logic and imports for handling PREPAID_INHERITANCE.
HeirsAndPartitionRepeater/AdditionalHeir.tsx, HeirsAndPartitionRepeater/index.tsx Updated logic and imports for handling prepaid inheritance and spouse relations.
OverviewAssets/index.tsx Added conditional rendering and new imports for PREPAID_INHERITANCE.
OverviewAssets/rows.ts Modified data row functions to handle deceasedShare values conditionally.
ReportFieldsRepeater/index.tsx Updated imports and conditional logic for ReportFieldsRepeater component.
done.ts, form.ts, prerequisites.ts Added new form sections and constants for prepaid inheritance.
applicant.ts, applicationTypeSelection.ts, assets.ts, deceased.ts, finalStep.ts Added new constants and updated conditional logic for inheritance types.
prepaidInheritance/applicant.ts, prepaidInheritance/dataCollection.ts, prepaidInheritance/heirs.ts Introduced new form sections for prepaid inheritance scenarios.
types.ts Added GRANTOR value to RelationEnum enum.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant InheritanceReportService
    participant NationalRegistryXRoadService
    User ->> InheritanceReportService: Request marital status
    InheritanceReportService ->> NationalRegistryXRoadService: Fetch marital status
    NationalRegistryXRoadService -->> InheritanceReportService: Return marital status
    InheritanceReportService -->> User: Provide marital status
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 4.02685% with 286 lines in your changes missing coverage. Please review.

Project coverage is 37.07%. Comparing base (ee1be2d) to head (99ccd19).

Current head 99ccd19 differs from pull request most recent head 7ae967d

Please upload reports for the commit 7ae967d to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14677      +/-   ##
==========================================
- Coverage   37.15%   37.07%   -0.09%     
==========================================
  Files        6406     6402       -4     
  Lines      130347   130353       +6     
  Branches    37175    37244      +69     
==========================================
- Hits        48430    48325     -105     
- Misses      81917    82028     +111     
Flag Coverage Δ
air-discount-scheme-backend 53.75% <ø> (+0.11%) ⬆️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.44% <ø> (ø)
api-catalogue-services 77.85% <ø> (ø)
api-domains-air-discount-scheme 35.89% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 57.91% <ø> (ø)
api-domains-communications 40.57% <ø> (-0.04%) ⬇️
api-domains-criminal-record 43.44% <ø> (ø)
api-domains-driving-license 44.28% <ø> (+0.07%) ⬆️
api-domains-education 33.54% <ø> (+0.05%) ⬆️
api-domains-health-insurance 27.15% <ø> (ø)
api-domains-mortgage-certificate 34.76% <ø> (ø)
api-domains-payment-schedule 40.26% <ø> (ø)
application-api-files 56.40% <ø> (+0.23%) ⬆️
application-core 72.16% <ø> (+0.66%) ⬆️
application-system-api 41.96% <57.14%> (-0.04%) ⬇️
application-template-api-modules 24.25% <0.00%> (+<0.01%) ⬆️
application-templates-accident-notification 19.67% <ø> (-0.21%) ⬇️
application-templates-car-recycling 4.23% <ø> (ø)
application-templates-criminal-record 21.84% <ø> (-0.41%) ⬇️
application-templates-driving-license 16.47% <ø> (-0.28%) ⬇️
application-templates-estate 11.79% <ø> (-0.11%) ⬇️
application-templates-example-payment 20.49% <ø> (-0.42%) ⬇️
application-templates-financial-aid 11.92% <ø> (-0.17%) ⬇️
application-templates-general-petition 19.14% <ø> (-0.30%) ⬇️
application-templates-health-insurance 23.10% <ø> (-0.21%) ⬇️
application-templates-inheritance-report 4.11% <2.74%> (-0.23%) ⬇️
application-templates-marriage-conditions 10.07% <ø> (-0.41%) ⬇️
application-templates-mortgage-certificate 44.18% <ø> (-0.17%) ⬇️
application-templates-parental-leave 28.43% <ø> (-0.05%) ⬇️
application-types 7.39% <ø> (ø)
application-ui-components 1.44% <ø> (+0.01%) ⬆️
application-ui-shell 21.73% <ø> (-0.06%) ⬇️
auth-admin-web 2.43% <ø> (ø)
auth-api-lib 9.62% <ø> (+0.12%) ⬆️
auth-nest-tools 30.44% <ø> (ø)
auth-react 23.00% <ø> (-0.06%) ⬇️
auth-shared 75.00% <ø> (ø)
clients-charge-fjs-v2 22.58% <ø> (ø)
clients-driving-license 40.15% <ø> (ø)
clients-driving-license-book 43.63% <ø> (ø)
clients-financial-statements-inao 48.40% <ø> (ø)
clients-license-client 1.84% <ø> (ø)
clients-middlewares 73.00% <ø> (-0.01%) ⬇️
clients-regulations 41.85% <ø> (ø)
clients-rsk-company-registry 29.24% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.44% <ø> (ø)
clients-zendesk 55.26% <ø> (ø)
cms 0.44% <ø> (+<0.01%) ⬆️
cms-translations 39.68% <ø> (-0.03%) ⬇️
content-search-index-manager 95.65% <ø> (ø)
content-search-toolkit 8.57% <ø> (ø)
contentful-apps 6.24% <ø> (ø)
dokobit-signing 61.76% <ø> (ø)
download-service 44.38% <ø> (+0.07%) ⬆️
email-service 61.42% <ø> (ø)
feature-flags 89.74% <ø> (ø)
file-storage 51.55% <ø> (ø)
financial-aid-backend 56.45% <ø> (+0.01%) ⬆️
financial-aid-shared 18.13% <ø> (+0.21%) ⬆️
icelandic-names-registry-backend 53.95% <ø> (ø)
infra-nest-server 48.33% <ø> (ø)
infra-tracing 43.24% <ø> (ø)
island-ui-core 28.88% <ø> (-0.03%) ⬇️
judicial-system-api 17.70% <ø> (ø)
judicial-system-audit-trail 67.13% <ø> (ø)
judicial-system-formatters 80.92% <ø> (+0.02%) ⬆️
judicial-system-message 65.65% <ø> (ø)
judicial-system-message-handler 65.60% <ø> (ø)
judicial-system-scheduler 57.48% <ø> (ø)
judicial-system-types 49.12% <ø> (ø)
license-api 43.01% <ø> (+0.04%) ⬆️
localization 10.15% <ø> (ø)
logging 48.43% <ø> (ø)
message-queue 68.39% <ø> (ø)
nest-audit 68.20% <ø> (ø)
nest-config 77.27% <ø> (ø)
nest-feature-flags 51.13% <ø> (ø)
nest-problem 46.08% <ø> (ø)
nest-sequelize 94.44% <ø> (ø)
nest-swagger 52.06% <ø> (ø)
nova-sms 63.41% <ø> (ø)
portals-admin-regulations-admin 2.06% <ø> (ø)
portals-core 16.20% <ø> (-0.08%) ⬇️
reference-backend 50.31% <ø> (ø)
regulations 16.78% <ø> (ø)
residence-history 85.00% <ø> (ø)
services-auth-admin-api 52.01% <ø> (+0.04%) ⬆️
services-auth-delegation-api 61.83% <ø> (+0.05%) ⬆️
services-auth-ids-api 54.65% <ø> (+0.05%) ⬆️
services-documents 60.81% <ø> (ø)
services-endorsements-api 55.20% <ø> (+0.12%) ⬆️
services-sessions 65.30% <ø> (ø)
services-university-gateway 48.18% <ø> (-0.14%) ⬇️
services-user-notification 47.55% <ø> (+<0.01%) ⬆️
services-user-profile 62.72% <ø> (+0.12%) ⬆️
shared-components 27.88% <ø> (-0.04%) ⬇️
shared-form-fields 31.90% <ø> (-0.02%) ⬇️
shared-mocking 64.62% <ø> (ø)
shared-pii 92.85% <ø> (ø)
shared-problem 87.50% <ø> (ø)
shared-utils 26.14% <ø> (-4.76%) ⬇️
skilavottord-ws 23.78% <ø> (ø)
web 1.91% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...es/inheritance-report/inheritance-report.module.ts 100.00% <100.00%> (ø)
...ules/templates/inheritance-report/utils/mappers.ts 3.22% <ø> (ø)
...ance-report/src/components/DeceasedShare/index.tsx 0.00% <ø> (ø)
...ates/inheritance-report/src/dataProviders/index.ts 0.00% <ø> (ø)
...ritance-report/src/fields/CalculateShare/index.tsx 0.00% <ø> (ø)
...nheritance-report/src/fields/FuneralCost/index.tsx 0.00% <ø> (ø)
...ance-report/src/fields/SpouseEstateShare/index.tsx 0.00% <ø> (ø)
...inheritance-report/src/forms/sections/applicant.ts 0.00% <ø> (ø)
.../inheritance-report/src/forms/sections/deceased.ts 0.00% <ø> (ø)
.../templates/inheritance-report/src/lib/constants.ts 100.00% <100.00%> (ø)
... and 25 more

... and 65 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee1be2d...7ae967d. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented May 2, 2024

Datadog Report

All test runs 1c3da50 🔗

101 Total Test Services: 0 Failed, 99 Passed
🔻 Test Sessions change in coverage: 4 decreased, 2 increased, 191 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 34.73s N/A Link
air-discount-scheme-web 0 0 0 2 0 11.75s N/A Link
api 0 0 0 4 0 4.94s N/A Link
api-catalogue-services 0 0 0 23 0 17.48s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 36.05s N/A Link
api-domains-assets 0 0 0 3 0 23.91s N/A Link
api-domains-auth-admin 0 0 0 18 0 12.6s N/A Link
api-domains-communications 0 0 0 5 0 44.81s N/A Link
api-domains-criminal-record 0 0 0 5 0 16.05s N/A Link
api-domains-driving-license 0 0 0 23 0 54.51s N/A Link

🔻 Code Coverage Decreases vs Default Branch (4)

  • auth-api-lib - jest 10.69% (-0.05%) - Details
  • services-university-gateway - jest 44.58% (-0.03%) - Details
  • services-user-notification - jest 48.68% (-0.02%) - Details
  • services-auth-ids-api - jest 49.8% (-0.01%) - Details

@albinagu albinagu added the deploy-feature Deploys features to dev label May 13, 2024
@albinagu albinagu changed the title feat(inheritance-report): allow pre paid inheritance feat(inheritance-report): Adding prepaid inheritance form flow May 13, 2024
Copy link
Contributor

Affected services are: api,application-system-api,application-system-form,

@juni-haukur juni-haukur added deploy-feature Deploys features to dev and removed deploy-feature Deploys features to dev labels May 22, 2024
@juni-haukur juni-haukur added the deploy-feature Deploys features to dev label May 27, 2024
@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Jun 4, 2024
@albinagu albinagu marked this pull request as ready for review June 4, 2024 14:15
@albinagu albinagu requested a review from a team as a code owner June 4, 2024 14:15
@albinagu albinagu removed deploy-feature Deploys features to dev automerge Merge this PR as soon as all checks pass labels Jun 4, 2024
@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Jun 4, 2024
@kodiakhq kodiakhq bot merged commit 427d86d into main Jun 4, 2024
31 checks passed
@kodiakhq kodiakhq bot deleted the feat/prepaid-inheritance branch June 4, 2024 14:36
Copy link
Contributor

@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: 29

Outside diff range and nitpick comments (22)
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.module.ts (1)

Line range hint 9-24: Consider refactoring the class to use simple functions instead of a class with only static members.

- export class InheritanceReportModule {
-   static register(config: BaseTemplateAPIModuleConfig): DynamicModule {
-     return {
-       module: InheritanceReportModule,
-       imports: [
-         SharedTemplateAPIModule.register(config),
-         SyslumennClientModule,
-         NationalRegistryXRoadModule,
-       ],
-       providers: [InheritanceReportService],
-       exports: [InheritanceReportService],
-     }
-   }
- }
+ export function registerInheritanceReportModule(config: BaseTemplateAPIModuleConfig): DynamicModule {
+   return {
+     module: InheritanceReportModule,
+     imports: [
+       SharedTemplateAPIModule.register(config),
+       SyslumennClientModule,
+       NationalRegistryXRoadModule,
+     ],
+     providers: [InheritanceReportService],
+     exports: [InheritanceReportService],
+   }
+ }
libs/application/templates/inheritance-report/src/lib/constants.ts (1)

Line range hint 62-62: Avoid using any type to ensure type safety.

- export type ErrorValue = { [key: string]: any }
+ export type ErrorValue = { [key: string]: unknown }
libs/application/templates/inheritance-report/src/components/DeceasedShare/index.tsx (1)

Line range hint 54-54: Optimize the useEffect hook by removing unnecessary dependencies.

- }, [checked, defaultValue, inputFieldName, setValue, watchedInputField])
+ }, [checked, defaultValue, inputFieldName, setValue])
libs/application/templates/inheritance-report/src/fields/FuneralCost/index.tsx (2)

Line range hint 99-99: Remove unnecessary dependency from useEffect.

-  const getUpdatedValues = useCallback(() => getValues(id), [getValues, id])
+  const getUpdatedValues = useCallback(() => getValues(id), [getValues])

Line range hint 141-141: Avoid using array index as a key in React lists.

Consider using a unique identifier or a combination of properties that are guaranteed to be unique.

libs/application/templates/inheritance-report/src/fields/SpouseEstateShare/index.tsx (2)

Line range hint 107-107: Include all dependencies in useEffect to avoid bugs related to stale closures.

-  }, [assetsTotal, hadSeparateProperty, localSpouseTotalDeduction, spouseTotalDeductionField, wasInCohabitation])
+  }, [assetsTotal, hadSeparateProperty, localSpouseTotalDeduction, spouseTotalDeductionField, wasInCohabitation, clearHadSeparateProperty, setValue])

Line range hint 181-181: Avoid using array indices as keys in React lists to prevent UI issues on re-renders.

Consider using a unique property of the items as keys.

libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx (1)

Line range hint 180-180: Refactor to use unique identifiers instead of array indices as keys.

This will help maintain stable identities across re-renders and prevent unnecessary DOM operations.

Also applies to: 186-186, 224-224, 227-227

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx (2)

Line range hint 243-269: Refactor to use optional chaining for better safety and readability.

- defaultValue={currentHeir?.relation ?? ''}
+ defaultValue={currentHeir?.relation}

245-245: Avoid using array indices as keys in React components to prevent issues with component state and performance.

Consider using unique identifiers or other properties as keys instead of array indices.

Tools
Biome

[error] 245-245: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx (3)

Line range hint 66-66: Refactor to avoid using any as a type. Specify more precise types for better type safety.

- useFieldArray<any>({
+ useFieldArray<FieldType>({

Also applies to: 82-82, 137-137, 157-157, 175-175, 257-257


Line range hint 75-75: Add missing dependencies in the useEffect hooks to ensure correct re-rendering behavior.

- }, [id])
+ }, [id, calcWithShareValue, props.sumField, getValues, setValue])

Also applies to: 102-102, 127-127


Line range hint 187-187: Avoid using array indices as keys in React components to prevent issues with component state and performance.

Consider using unique identifiers or other properties as keys instead of array indices.

libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx (3)

Line range hint 110-110: Add missing dependencies in the useEffect hook to ensure correct re-rendering behavior.

- }, [answers.assets])
+ }, [answers.assets, deceasedWasInCohabitation, shareValues.bankAccounts, shareValues.money, shareValues.vehicles, shareValues.stocks, shareValues.realEstate, shareValues.inventory, shareValues.otherAssets, shareValues.guns, getShareValue, shareValues.claims])

Line range hint 329-329: Address the missing dependencies in the useEffect hooks to ensure they are triggered correctly.

- }, [])
+ }, [forceUpdate])

Also applies to: 441-441


Line range hint 44-44: Remove unused variables to clean up the code.

Consider removing or using the assigned variables to avoid potential confusion and maintain clean code.

Also applies to: 449-449

libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx (2)

Line range hint 90-90: Address missing dependencies in useEffect hook.

The useEffect hook is missing dependencies. This can lead to unexpected behavior or bugs. Include all used props and state variables in the dependency array.

- }, [getValues, id, props.sumField])
+ }, [getValues, id, props.sumField, props.sumField2, props.calcWithShareValue, setValue])

Line range hint 71-71: Replace any type with more specific types.

Using any type disables TypeScript's type checking, which can lead to runtime errors. Replace any with more specific types to enhance type safety.

- const [foreignBankAccountIndexes, setForeignBankAccountIndexes] = useState<any[]>([])
+ const [foreignBankAccountIndexes, setForeignBankAccountIndexes] = useState<number[]>([])

- const { fields, append, remove, replace } = useFieldArray<any>({
+ const { fields, append, remove, replace } = useFieldArray<{ [key: string]: any }>({

Also applies to: 96-96, 128-128, 215-215, 277-277, 294-294

libs/application/templates/inheritance-report/src/lib/dataSchema.ts (2)

Line range hint 500-500: Simplify conditional expression.

The use of a ternary operator here is unnecessary and can be simplified for better readability.

- return !!other ? true : false
+ return !!other

Line range hint 81-81: Use Number.isNaN for safer type checking.

Replace isNaN with Number.isNaN to avoid type coercion issues, which can lead to bugs.

- const num = parseInt(share, 10)
- const value = isNaN(num) ? 0 : num
+ const num = parseInt(share, 10)
+ const value = Number.isNaN(num) ? 0 : num
libs/application/templates/inheritance-report/src/forms/sections/assets.ts (1)

14-15: Ensure consistent import grouping and separation.

Consider grouping similar imports together for better readability. For example, all imports from @island.is/application/types and @island.is/application/core can be grouped together.

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx (1)

Line range hint 180-223: Refactor the complex logic in updateValues to improve readability and maintainability.

-      const isPrePaid = answers.applicationFor === PREPAID_INHERITANCE
-      const numValue = isNaN(value) ? 0 : value
-      const percentage = numValue > 0 ? numValue / 100 : 0
-      const heirs = getValues()?.heirs?.data as EstateMember[]
-      let currentHeir = isPrePaid
-        ? heirs[index ?? 0]
-        : (getValueViaPath(answers, updateIndex) as EstateMember)
+      const isPrePaid = answers.applicationFor === PREPAID_INHERITANCE;
+      const numValue = isNaN(value) ? 0 : value;
+      const percentage = numValue > 0 ? numValue / 100 : 0;
+      const heirs = getValues()?.heirs?.data as EstateMember[];
+      let currentHeir = isPrePaid ? heirs[index ?? 0] : getValueViaPath<EstateMember>(answers, updateIndex);

Consider breaking down this function into smaller, more focused functions to handle specific parts of the logic.

Tools
Biome

[error] 213-216: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ee1be2d and 7ae967d.

Files selected for processing (36)
  • libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.module.ts (2 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.service.ts (4 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/components/DeceasedShare/index.tsx (1 hunks)
  • libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/dataProviders/index.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx (6 hunks)
  • libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx (2 hunks)
  • libs/application/templates/inheritance-report/src/fields/FuneralCost/index.tsx (1 hunks)
  • libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx (5 hunks)
  • libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx (5 hunks)
  • libs/application/templates/inheritance-report/src/fields/OtherAssetsRepeater/index.tsx (3 hunks)
  • libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx (1 hunks)
  • libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts (13 hunks)
  • libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx (7 hunks)
  • libs/application/templates/inheritance-report/src/fields/SpouseEstateShare/index.tsx (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/done.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/form.ts (3 hunks)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/applicant.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/applicationTypeSelection.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/assets.ts (18 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/deceased.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/finalStep.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/dataCollection.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/overview.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts (5 hunks)
  • libs/application/templates/inheritance-report/src/lib/constants.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/lib/dataSchema.ts (4 hunks)
  • libs/application/templates/inheritance-report/src/lib/messages.ts (18 hunks)
  • libs/application/templates/inheritance-report/src/lib/utils/helpers.ts (3 hunks)
  • libs/application/templates/inheritance-report/src/types.ts (1 hunks)
Files not reviewed due to errors (1)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (no review received)
Files skipped from review due to trivial changes (4)
  • libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts
  • libs/application/templates/inheritance-report/src/dataProviders/index.ts
  • libs/application/templates/inheritance-report/src/forms/sections/deceased.ts
  • libs/application/templates/inheritance-report/src/types.ts
Additional context used
Path-based instructions (32)
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.module.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/done.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/dataCollection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/finalStep.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/lib/constants.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/prerequisites.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/form.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/applicationTypeSelection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/applicant.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/components/DeceasedShare/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/OtherAssetsRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/lib/utils/helpers.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/FuneralCost/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/overview.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/SpouseEstateShare/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/lib/dataSchema.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/assets.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.module.ts

[error] 11-24: Avoid classes that contain only static members. (lint/complexity/noStaticOnlyClass)

Prefer using simple functions instead of classes with only static members.

libs/application/templates/inheritance-report/src/lib/constants.ts

[error] 62-62: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/templates/inheritance-report/src/components/DeceasedShare/index.tsx

[error] 54-54: This hook specifies more dependencies than necessary: watchedInputField (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts

[error] 74-74: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 82-82: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 92-92: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 101-101: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.service.ts

[error] 27-27: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

libs/application/templates/inheritance-report/src/fields/OtherAssetsRepeater/index.tsx

[error] 49-49: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 63-63: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 97-97: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 115-115: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/templates/inheritance-report/src/lib/utils/helpers.ts

[error] 109-109: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 110-110: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 123-123: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 167-167: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/templates/inheritance-report/src/fields/FuneralCost/index.tsx

[error] 99-99: This hook specifies more dependencies than necessary: id (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.


[error] 141-141: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/overview.ts

[error] 189-189: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 193-193: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/templates/inheritance-report/src/fields/SpouseEstateShare/index.tsx

[error] 107-107: This hook does not specify all of its dependencies: clearHadSeparateProperty (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 107-107: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 181-181: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx

[error] 180-180: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 186-186: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 224-224: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 227-227: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx

[error] 242-242: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 283-283: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 288-288: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 309-309: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 103-103: This hook does not specify all of its dependencies: advocateEmailField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: advocatePhoneField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: getValues (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook specifies more dependencies than necessary: foreignCitizenship (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.


[error] 103-103: This hook does not specify all of its dependencies: unregister (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: relationField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: fieldIndex (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: nameField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: dateOfBirthField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: advocateField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 103-103: This hook does not specify all of its dependencies: clearErrors (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 245-245: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx

[error] 66-66: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 82-82: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 137-137: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 157-157: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 175-175: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 257-257: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 75-75: This hook does not specify all of its dependencies: calcWithShareValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook does not specify all of its dependencies: props.sumField (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook does not specify all of its dependencies: getValues (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 75-75: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 102-102: This hook does not specify all of its dependencies: calculateTotal (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 102-102: This hook specifies more dependencies than necessary: fields (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.


[error] 127-127: This hook does not specify all of its dependencies: application (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 127-127: This hook does not specify all of its dependencies: application?.answers (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 127-127: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 127-127: This hook does not specify all of its dependencies: replace (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 127-127: This hook does not specify all of its dependencies: application.answers.applicationFor (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 127-127: This hook does not specify all of its dependencies: fields.length (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 187-187: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 410-410: This hook does not specify all of its dependencies: descriptionFieldName (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx

[error] 110-110: This hook does not specify all of its dependencies: deceasedWasInCohabitation (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.bankAccounts (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.money (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.vehicles (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.stocks (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.realEstate (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.inventory (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.otherAssets (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.guns (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: getShareValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 110-110: This hook does not specify all of its dependencies: shareValues.claims (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 329-329: This hook does not specify all of its dependencies: forceUpdate (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 346-346: This hook specifies more dependencies than necessary: total (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.


[error] 441-441: This hook specifies more dependencies than necessary: customSpouseSharePercentage, hasCustomSpouseSharePercentage (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

This dependency can be removed from the list.

libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx

[error] 71-71: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 96-96: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 128-128: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 215-215: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 277-277: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 294-294: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 90-90: This hook does not specify all of its dependencies: props?.calcWithShareValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 90-90: This hook does not specify all of its dependencies: props?.sumField2 (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 90-90: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 191-191: This hook does not specify all of its dependencies: calculateTotal (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 201-201: This hook does not specify all of its dependencies: answers.applicationFor (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: application?.answers (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: replace (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: props?.fromExternalData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

Either include them or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: props.fromExternalData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

Either include them or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: application (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: fields.length (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 225-225: This hook does not specify all of its dependencies: answers (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 225-225: This hook does not specify all of its dependencies: fields.reduce (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

libs/application/templates/inheritance-report/src/lib/dataSchema.ts

[error] 500-500: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 81-81: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

libs/application/templates/inheritance-report/src/forms/sections/assets.ts

[error] 25-25: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 26-26: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 105-105: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 171-171: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 240-240: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 306-306: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 393-393: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 455-455: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 456-456: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 541-541: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 542-542: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 622-622: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 623-623: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx

[error] 139-139: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 139-139: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 166-166: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 213-216: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 260-260: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 297-297: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 298-298: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 301-301: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 302-302: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 389-389: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 415-415: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 430-430: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 437-437: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 438-438: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 472-472: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 477-477: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 496-496: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 563-565: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 580-582: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 625-625: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

GitHub Check: linting (application-system-form,application-template-api-modules,application-template-loader,app...
libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx

[warning] 104-104:
React Hook useEffect has a missing dependency: 'calculateTotal'. Either include it or remove the dependency array

libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx

[warning] 44-44:
'formatMessage' is assigned a value but never used. Allowed unused vars must match /^_[a-zA-Z0-9]*$/u


[warning] 449-449:
'inputError' is assigned a value but never used. Allowed unused vars must match /^_[a-zA-Z0-9]*$/u

Additional comments not posted (39)
libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.module.ts (1)

9-9: Integration of NationalRegistryXRoadModule aligns with the new feature requirements.

Also applies to: 18-18

libs/application/templates/inheritance-report/src/forms/done.ts (1)

5-5: Proper use of conditional logic to handle different inheritance scenarios in the form's completion message.

Also applies to: 14-24

libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/dataCollection.ts (1)

1-11: Enhanced data collection capabilities for the prepaid inheritance form with the integration of multiple data providers.

Also applies to: 13-38

libs/application/templates/inheritance-report/src/forms/sections/finalStep.ts (1)

1-10: Effective use of conditional logic in the final step of the form to ensure users are correctly informed based on their specific inheritance type.

Also applies to: 12-52

libs/application/templates/inheritance-report/src/lib/constants.ts (1)

2-2: Well-defined constants and enums to support new functionalities in the inheritance report application.

Also applies to: 4-5, 13-42, 52-53

libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts (1)

1-1: Enhanced user interaction in the prepaid inheritance form by allowing users to specify different asset types.

Also applies to: 9-70

libs/application/templates/inheritance-report/src/forms/prerequisites.ts (1)

12-59: The new form configuration for prerequisites is well-structured and adheres to the project's standards.

libs/application/templates/inheritance-report/src/forms/form.ts (1)

26-41: The structure for the prepaidInheritanceForm is comprehensive and aligns with the new feature requirements. Ensure that all sections are thoroughly tested, especially with the new conditional logic introduced.

libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1)

13-68: The prePaidApplicant section is well-defined with necessary fields and validations. Consider adding more descriptive titles and labels to enhance user experience.

- title: m.applicantsInfo,
+ title: m.detailedApplicantsInfoTitle,

Likely invalid or redundant comment.

libs/application/templates/inheritance-report/src/forms/sections/applicationTypeSelection.ts (1)

Line range hint 11-35: The conditional rendering based on ESTATE_INHERITANCE is a good use of dynamic form capabilities. Ensure that the condition accurately reflects all possible states to avoid runtime errors.

libs/application/templates/inheritance-report/src/forms/sections/applicant.ts (1)

12-12: The import of PREPAID_INHERITANCE should be utilized in the form to handle different inheritance scenarios effectively.

libs/application/templates/inheritance-report/src/components/DeceasedShare/index.tsx (1)

13-13: The import of YES and getErrorViaPath is correctly used for form validations and conditions. Good adherence to modular design.

libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/inheritance-report.service.ts (1)

27-27: Correct the usage of decorators.

- @Inject(LOGGER_PROVIDER) private logger: Logger,
+ @Inject(LOGGER_PROVIDER) private readonly logger: Logger,

Ensure that decorators are used correctly by placing them directly above the constructor parameter they are meant to decorate. This change corrects the placement and also marks the logger as readonly for immutability.

Likely invalid or redundant comment.

Tools
Biome

[error] 27-27: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

libs/application/templates/inheritance-report/src/fields/FuneralCost/index.tsx (1)

24-24: Update import path for YES constant to maintain consistency.

libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts (2)

15-15: Correct import for PREPAID_INHERITANCE to align with project standards.


35-35: Ensure deceased share calculations are correct and optimized.

Also applies to: 67-67, 99-99, 123-123, 160-160, 198-198, 234-234, 267-267, 291-291

libs/application/templates/inheritance-report/src/fields/SpouseEstateShare/index.tsx (1)

27-27: Update import paths for constants NO and YES.

libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx (1)

27-27: Ensure new constants and utility functions are correctly imported and used.

Also applies to: 28-28

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx (3)

24-28: Ensure the newly added constants are used appropriately throughout the component.


100-102: Verify the conditional logic for disabling fields based on the PREPAID_INHERITANCE value.

Verification successful

The search results show multiple instances where PREPAID_INHERITANCE is used in conditional statements across various files. This includes the specific line in AdditionalHeir.tsx that was under review. The conditional logic appears to be consistent with the intended use of PREPAID_INHERITANCE.

  • libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx: values.applicationFor === PREPAID_INHERITANCE ? false : !currentHeir.enabled

The logic checks if values.applicationFor is equal to PREPAID_INHERITANCE. If true, it sets isDisabledField to false; otherwise, it sets it to the negation of currentHeir.enabled. This logic seems correct based on the context provided.

  • Other instances in the codebase also follow similar conditional checks, ensuring consistency.

Therefore, the conditional logic for disabling fields based on the PREPAID_INHERITANCE value is correctly implemented.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the conditional logic for disabling fields based on the `PREPAID_INHERITANCE` value.
# Test: Search for the usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Correct implementation.
rg --type typescript $'PREPAID_INHERITANCE'

Length of output: 77



Script:

#!/bin/bash
# Description: Verify the conditional logic for disabling fields based on the `PREPAID_INHERITANCE` value.
# Test: Search for the usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Correct implementation.
rg --type ts 'PREPAID_INHERITANCE'

Length of output: 8528


295-302: Ensure the conditional rendering logic for taxFreeInheritance is correct and optimized.

Verification successful

The conditional rendering logic for taxFreeInheritance appears to be correct and optimized. The relevant code snippet is:

) : customField.id === 'taxFreeInheritance' &&
    currentHeir?.relation !== PrePaidHeirsRelationTypes.SPOUSE ? null : (
    <GridColumn span={['1/2']} paddingBottom={2}>
        <InputController
            id={`${fieldIndex}.${customField.id}`}
            name={`${fieldIndex}.${customField.id}`}
            disabled={isDisabledField}

This logic ensures that if customField.id is taxFreeInheritance and currentHeir?.relation is not PrePaidHeirsRelationTypes.SPOUSE, it renders null. Otherwise, it renders the GridColumn component.

  • PrePaidHeirsRelationTypes.SPOUSE should be correctly defined and used.
  • currentHeir?.relation and customField.id should be correctly set and used in the context.

Based on the gathered information, the conditional rendering logic is correct and optimized.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `taxFreeInheritance`.
# Test: Search for the usage of `taxFreeInheritance` in conditional statements. Expect: Correct implementation.
rg --type typescript $'taxFreeInheritance'

Length of output: 76



Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `taxFreeInheritance`.
# Test: Search for the usage of `taxFreeInheritance` in conditional statements. Expect: Correct implementation.
rg --type ts 'taxFreeInheritance'

Length of output: 4054

libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx (2)

33-38: Ensure the newly added constants are used appropriately throughout the component.


129-131: Verify the conditional logic for handling PREPAID_INHERITANCE in estate data fetching.

Verification successful

The search results indicate multiple instances of PREPAID_INHERITANCE being used in conditional statements. Specifically, in the file libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx, we need to verify the conditional logic around PREPAID_INHERITANCE.

Here are the relevant lines from the file:

application.answers.applicationFor === PREPAID_INHERITANCE
  ? {}
  : getEstateDataFromApplication(application)?.inheritanceReportInfo ?? {}

This conditional logic appears to handle the case where application.answers.applicationFor is equal to PREPAID_INHERITANCE by returning an empty object. Otherwise, it fetches estate data from the application.

Based on the context provided, the conditional logic seems correctly implemented. However, to ensure comprehensive verification, you may want to manually review the surrounding code and other instances where PREPAID_INHERITANCE is used.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the conditional logic for handling `PREPAID_INHERITANCE` in estate data fetching.
# Test: Search for the usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Correct implementation.
rg --type typescript $'PREPAID_INHERITANCE'

Length of output: 77



Script:

#!/bin/bash
# Description: Verify the conditional logic for handling `PREPAID_INHERITANCE` in estate data fetching.
# Test: Search for the usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Correct implementation.
rg --type ts 'PREPAID_INHERITANCE'

Length of output: 8528

libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx (1)

1-1: Ensure the newly added constants are used appropriately throughout the component.

libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx (1)

28-33: Ensure consistent import paths.

Verify that the import paths for constants and utility functions are consistent and correct across all files in the project. This helps in maintaining a clean and error-free codebase.

libs/application/templates/inheritance-report/src/forms/sections/assets.ts (3)

33-36: Ensure dynamic descriptions are clear and informative.

The use of conditional logic to display different descriptions based on the inheritance type is a good practice. Ensure that the messages are clear and provide sufficient information to the user.


536-544: Ensure dynamic section titles are clear and informative.

The use of conditional logic to display different section titles based on the inheritance type is a good practice. Ensure that the titles are clear and provide sufficient information to the user.

Tools
Biome

[error] 541-541: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 542-542: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


82-85: Validate dynamic title assignments for consistency.

Verification successful

The search results indicate that m.propertyValuation is used in multiple files, while m.propertyValuationPrePaid is only used in assets.ts. To ensure consistency, we need to verify that these variables are correctly assigned and used in their respective contexts.

  • libs/application/templates/inheritance-report/src/forms/sections/assets.ts: Both m.propertyValuation and m.propertyValuationPrePaid are assigned to titles based on inheritance type.
  • libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts: m.propertyValuation is used to assign a value to propertyValuation.
  • libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx: m.propertyValuation is used to assign a value to propertyValuation.

Given the context, it appears that m.propertyValuation is consistently used across multiple files, while m.propertyValuationPrePaid is specific to the assets.ts file. This suggests that the dynamic title assignments are consistent within their respective contexts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the dynamic titles in the form fields are consistent and correctly displayed in the UI.

# Test: Check the UI for the display of these titles.
echo "Manual verification needed: Check the UI for the display of property valuation titles based on inheritance type."

Length of output: 234



Script:

#!/bin/bash
# Search for the usage of `m.propertyValuation` in the codebase
rg 'm\.propertyValuation'

# Search for the usage of `m.propertyValuationPrePaid` in the codebase
rg 'm\.propertyValuationPrePaid'

Length of output: 2192

libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx (1)

116-136: Verify the conditional logic for handling PREPAID_INHERITANCE.

Verification successful

The search results indicate that the conditional logic for handling PREPAID_INHERITANCE is consistently used across the codebase. The pattern answers.applicationFor === PREPAID_INHERITANCE appears frequently, suggesting that the logic is applied uniformly.

  • libs/application/templates/inheritance-report/src/forms/done.ts
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts
  • libs/application/templates/inheritance-report/src/forms/sections/finalStep.ts
  • libs/application/templates/inheritance-report/src/forms/sections/assets.ts
  • libs/application/templates/inheritance-report/src/forms/sections/applicant.ts
  • libs/application/templates/inheritance-report/src/lib/constants.ts
  • libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts
  • libs/application/templates/inheritance-report/src/fields/ReportFieldsRepeater/index.tsx
  • libs/application/templates/inheritance-report/src/fields/OtherAssetsRepeater/index.tsx
  • libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts
  • libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/index.tsx
  • libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx
  • libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx
  • libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx

The conditional logic for PREPAID_INHERITANCE is verified to be consistent across the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the conditional logic for handling `PREPAID_INHERITANCE`.

# Test: Search for usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Consistent usage across the codebase.
rg --type typescript $'PREPAID_INHERITANCE'

Length of output: 77



Script:

#!/bin/bash
# Description: Verify the conditional logic for handling `PREPAID_INHERITANCE`.

# Test: Search for usage of `PREPAID_INHERITANCE` in conditional statements. Expect: Consistent usage across the codebase.
rg --type ts $'PREPAID_INHERITANCE'

Length of output: 8528

libs/application/templates/inheritance-report/src/lib/messages.ts (10)

4-8: The message definition for prerequisitesTitle is clear and concise.


94-108: New message definitions related to inheritance selection for prepaid scenarios. Ensure these messages are used in the correct context within the application.


1608-1612: New message definition for the completion title in prepaid inheritance scenarios. It's crucial to ensure that this message is used in the appropriate sections of the UI.


64-68: New message definition for the prepaid inheritance application name. Confirm that this is displayed in the appropriate sections of the application.


1496-1500: New message definition for other documents in prepaid inheritance scenarios. Confirm that this message is used correctly in the document upload sections.


1644-1669: New message definitions for prepaid inheritance relation types. Confirm that these messages are used correctly in the relationship sections of the application.


808-812: New message definition for total value in prepaid inheritance scenarios. It's important to ensure that this message is used in the appropriate sections of the UI.


400-401: New message definition for property valuation in prepaid inheritance scenarios. Confirm that this message is used correctly in the valuation sections.


1620-1624: New message definition for the completion description in prepaid inheritance scenarios. Ensure this message is used in the correct context within the application.


629-634: New message definition for stock descriptions in prepaid inheritance scenarios. It's crucial to ensure that this message is used in the appropriate sections of the UI.

Comment on lines +296 to +302
estateData &&
(estateData as any)?.inheritanceReportInfo?.heirs &&
!(application.answers as any)?.heirs?.hasModified
) {
// Keeping this in for now, it may not be needed, will find out later
const heirsData = estateData?.inheritanceReportInfo?.heirs?.map(
(heir) => {
const heirsData = (estateData as any)?.inheritanceReportInfo?.heirs?.map(
(heir: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor the use of any type to more specific types to enhance type safety.

Consider specifying more explicit types instead of using any to improve type safety and maintainability.

Tools
Biome

[error] 297-297: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 298-298: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 301-301: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 302-302: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

titleVariant: 'h3',
space: 'containerGutter',
condition: (answers) =>
!!((answers.executors as any)?.includeSpouse as Array<string>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using any type for better type safety.

- condition: (answers) => !!((answers.executors as any)?.includeSpouse as Array<string>)?.length,
+ condition: (answers: Answers) => !!((answers.executors as Answers)?.includeSpouse as Array<string>)?.length,

This change ensures that the answers parameter is explicitly typed, enhancing type safety and maintainability.

Also applies to: 82-82, 92-92, 101-101

Committable suggestion was skipped due to low confidence.

Tools
Biome

[error] 74-74: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.

Comment on lines +27 to +35
getPrePaidTotalValueFromApplication,
valueToNumber,
} from '../../lib/utils/helpers'
import { HeirsAndPartitionRepeaterProps } from './types'
import { DEFAULT_TAX_FREE_LIMIT } from '../../lib/constants'
import {
DEFAULT_TAX_FREE_LIMIT,
PREPAID_INHERITANCE,
PrePaidHeirsRelations,
} from '../../lib/constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure the newly added constants and utility functions are properly documented.

Would you like assistance in documenting these changes?

Comment on lines +20 to +24
import {
YES,
getErrorViaPath,
getValueViaPath,
} from '@island.is/application/core'
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor imports to improve maintainability.

Consider grouping imports from the same module to improve code readability and maintainability. For example:

- import { YES } from '@island.is/application/core'
- import { getErrorViaPath } from '@island.is/application/core'
- import { getValueViaPath } from '@island.is/application/core'
+ import { YES, getErrorViaPath, getValueViaPath } from '@island.is/application/core'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
import {
YES,
getErrorViaPath,
getValueViaPath,
} from '@island.is/application/core'
import {
YES,
getErrorViaPath,
getValueViaPath,
} from '@island.is/application/core'

@@ -195,7 +200,9 @@
/* ------ Set fields from external data (realEstate, vehicles) ------ */
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the useEffect dependencies.

The dependencies for this useEffect are incomplete, which might lead to bugs if the omitted dependencies change between render cycles.

- }, [])
+ }, [answers.applicationFor, application?.answers, replace, props?.fromExternalData, setValue, fields.length])
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
useEffect(() => {
useEffect(() => {
}, [answers.applicationFor, application?.answers, replace, props?.fromExternalData, setValue, fields.length])
Tools
Biome

[error] 201-201: This hook does not specify all of its dependencies: answers.applicationFor (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: application?.answers (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: replace (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: props?.fromExternalData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

Either include them or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: setValue (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: props.fromExternalData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

Either include them or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: application (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 201-201: This hook does not specify all of its dependencies: fields.length (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

Comment on lines +43 to +52
preDataCollectionApplicationFor: {
id: 'ir.application:preDataCollectionApplicationFor',
defaultMessage: 'Tegund umsóknar',
description: 'Get application for',
},
preDataCollectionApplicationForPrepaid: {
id: 'ir.application:preDataCollectionApplicationForPrepaid',
defaultMessage: 'Fyrirframgreiddur arfur',
description: '',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The new message ID ir.application:preDataCollectionApplicationForPrepaid is not integrated into any UI components or other parts of the codebase, as it is only found in the messages.ts file.

  • Ensure that the new message definitions are correctly integrated into the UI components where they are used.
Analysis chain

Added new message definitions for prepaid inheritance application types. Ensure these are correctly integrated into the UI components where they are used.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of new message definitions into UI components.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'ir.application:preDataCollectionApplicationForPrepaid'

Length of output: 97



Script:

#!/bin/bash
# Description: Verify integration of new message definitions into UI components.

# Test: Search for the usage of new message IDs in the project.
rg --glob '*.tsx' 'ir.application:preDataCollectionApplicationForPrepaid'

Length of output: 73



Script:

#!/bin/bash
# Description: Verify integration of new message definitions into UI components.

# Test: Search for the usage of new message IDs in the project.
rg --glob '*.{ts,tsx,js}' 'ir.application:preDataCollectionApplicationForPrepaid'

Length of output: 212

Comment on lines +1276 to +1285
heirsTitlePrePaid: {
id: 'ir.application:heirsTitlePrePaid',
defaultMessage: 'Hver á að fá arfinn?',
description: '',
},
heirsDescriptionPrePaid: {
id: 'ir.application:heirsDescriptionPrePaid',
defaultMessage: 'Lorem ipsum lorem ipsum',
description: '',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The new message definitions for heirs in prepaid inheritance scenarios (ir.application:heirsTitlePrePaid and ir.application:heirsDescriptionPrePaid) are not used anywhere in the codebase outside of their definitions in messages.ts.

  • ir.application:heirsTitlePrePaid found only in libs/application/templates/inheritance-report/src/lib/messages.ts
  • ir.application:heirsDescriptionPrePaid found only in libs/application/templates/inheritance-report/src/lib/messages.ts

Please ensure these messages are integrated and used in the appropriate context within the application.

Analysis chain

New message definitions for heirs in prepaid inheritance scenarios. Ensure these messages are used in the correct context within the application.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of new heirs messages.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'ir.application:heirsTitlePrePaid'

Length of output: 76



Script:

#!/bin/bash
# Description: Verify the correct usage of new heirs messages.

# Test: Search for the usage of new message IDs in the project.
rg --type ts 'ir.application:heirsTitlePrePaid'
rg --type ts 'ir.application:heirsDescriptionPrePaid'

Length of output: 327



Script:

#!/bin/bash
# Description: Verify the correct usage of new heirs messages.

# Test: Search for the usage of new message IDs in the project.
rg 'ir.application:heirsTitlePrePaid'
rg 'ir.application:heirsDescriptionPrePaid'

Length of output: 307

Comment on lines +793 to +794
realEstateEstimationPrePaid: {
id: 'ir.application:realEstateEstimationPrePaid',
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The new message definition for real estate estimation in prepaid inheritance scenarios (ir.application:realEstateEstimationPrePaid) is defined but not used anywhere in the codebase.

  • Location of definition: libs/application/templates/inheritance-report/src/lib/messages.ts
Analysis chain

New message definition for real estate estimation in prepaid inheritance scenarios. Confirm that this message is used correctly in the valuation sections.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of new real estate estimation messages.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'ir.application:realEstateEstimationPrePaid'

Length of output: 86



Script:

#!/bin/bash
# Description: Verify the correct usage of new real estate estimation messages.

# Test: Search for the usage of new message IDs in the project.
rg 'ir.application:realEstateEstimationPrePaid' --type ts
rg 'ir.application:realEstateEstimationPrePaid' --type tsx

Length of output: 264



Script:

#!/bin/bash
# Description: Verify the correct usage of new real estate estimation messages.

# Test: Search for the usage of new message IDs in the project.
rg 'ir.application:realEstateEstimationPrePaid'

Length of output: 167

Comment on lines +1682 to +1697
marketValue: {
id: 'ir.application:marketValuation',
defaultMessage: 'Markaðsverðmæti',
description: '',
},
includeSpousePrePaid: {
id: 'id.application:includeSpouse',
defaultMessage: 'Ráðstafa úr sameign hjúskaps',
description: '',
},
includeSpousePrePaidDescription: {
id: 'id.application:includeSpouseDescription',
defaultMessage:
'Ef arfláti er í gift/ur og ráðstafa á úr sameign, þarf maki að vera með sem arfláti',
description: '',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The new message IDs id.application:includeSpouse and id.application:includeSpouseDescription are defined but not used anywhere else in the codebase. Please ensure these messages are integrated into the appropriate sections of the UI.

Analysis chain

New message definitions for including a spouse in prepaid inheritance scenarios. It's important to ensure that these messages are used in the appropriate sections of the UI.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of new include spouse messages.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'id.application:includeSpouse'

Length of output: 72



Script:

#!/bin/bash
# Description: Verify the correct usage of new include spouse messages.

# Test: Search for the usage of new message IDs in the project.
rg --type ts 'id.application:includeSpouse'
rg --type tsx 'id.application:includeSpouse'

Length of output: 339



Script:

#!/bin/bash
# Description: Verify the correct usage of new include spouse messages.

# Test: Search for the usage of new message IDs in the project without specifying file type.
rg 'id.application:includeSpouse'

Length of output: 256

Comment on lines +565 to +569
bankAccountCapitalPrePaid: {
id: 'ir.application:bankAccountCapitalPrePaid',
defaultMessage: 'Upphæð',
description: '',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The new message ID ir.application:bankAccountCapitalPrePaid is defined but not used anywhere else in the codebase. Please ensure that this message is integrated into the relevant financial sections of the application.

  • Location of definition: libs/application/templates/inheritance-report/src/lib/messages.ts
Analysis chain

New message definition for bank account capital in prepaid inheritance scenarios. Ensure this message is used in the correct context within the financial sections of the application.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of new bank account capital messages.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'ir.application:bankAccountCapitalPrePaid'

Length of output: 84



Script:

#!/bin/bash
# Description: Verify the correct usage of new bank account capital messages.

# Test: Search for the usage of new message IDs in the project.
rg --type ts 'ir.application:bankAccountCapitalPrePaid'
rg --type js 'ir.application:bankAccountCapitalPrePaid'

Length of output: 229



Script:

#!/bin/bash
# Description: Verify the correct usage of new bank account capital messages.

# Test: Search for the usage of new message IDs in the project.
rg --type tsx 'ir.application:bankAccountCapitalPrePaid'
rg --type jsx 'ir.application:bankAccountCapitalPrePaid'

Length of output: 169



Script:

#!/bin/bash
# Description: Verify the correct usage of new bank account capital messages.

# Test: Search for the usage of new message IDs in the project.
rg 'ir.application:bankAccountCapitalPrePaid'

Length of output: 163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants