Skip to content

Unused standalone component imports trigger NG8113 warnings during Angular build #5866

Description

@artisgrit

Describe the bug

Building DSpace Angular generates Angular compiler warning NG8113 for imports that are declared in standalone component imports but are not actually used in their templates.

The warnings observed are:

Warning: src/app/shared/orcid-badge-and-tooltip/orcid-badge-and-tooltip.component.ts:31:5 - warning NG8113: NgClass is not used within the template of OrcidBadgeAndTooltipComponent

Warning: src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts:20:5 - warning NG8113: ThemedFileDownloadLinkComponent is not used within the template of SubmissionSectionUploadFileComponent

Version:

  • DSpace Angular 10.0
    Browser:

  • Not applicable (build-time issue)

To Reproduce

  1. Check out DSpace Angular 10.0.

  2. Build the Angular frontend:

    yarn build

    or

    npm run build
  3. Review the build output.

  4. Observe the NG8113 warnings for:

    • NgClass in OrcidBadgeAndTooltipComponent
    • ThemedFileDownloadLinkComponent in SubmissionSectionUploadFileComponent

Expected behavior

Components should not import standalone dependencies that are not used in their templates.
The build should complete without NG8113 warnings.

Actual behavior

The Angular compiler reports NG8113 warnings because:

  • NgClass is imported but not used in OrcidBadgeAndTooltipComponent.
  • ThemedFileDownloadLinkComponent is imported but not used in SubmissionSectionUploadFileComponent.

Related work

Potential fix:

  • Remove the unused NgClass import from OrcidBadgeAndTooltipComponent.
  • Remove the unused ThemedFileDownloadLinkComponent import from SubmissionSectionUploadFileComponent, or use it in the template if intended.

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

Status
🏗 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions