From 95d3ff6569ed7f3e596f22b604a43da973e8946f Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 16:37:23 +0200 Subject: [PATCH] ESLint: fix prefer-const violations --- .../supervision-order-group-selector.component.ts | 2 +- .../browse-by-date-page.component.ts | 2 +- .../community-list-page/community-list-service.ts | 11 +++-------- src/app/core/auth/auth.service.ts | 3 +-- src/app/core/data/base/find-all-data.ts | 3 +-- src/app/core/data/base/search-data.ts | 3 +-- src/app/core/data/dso-redirect.service.ts | 2 +- src/app/core/data/relationship-data.service.ts | 2 +- .../item-authorizations.component.ts | 8 ++++---- .../edit-relationship-list.component.ts | 2 +- .../item-status/item-status.component.ts | 6 +++--- .../metadata-values/metadata-values.component.ts | 2 +- .../media-viewer-video.component.ts | 2 +- .../register-email-form.component.ts | 2 +- .../bulk-access-control.service.ts | 2 +- src/app/shared/cookies/browser-klaro.service.ts | 2 +- .../dso-selector/dso-selector.component.ts | 2 +- .../models/ds-dynamic-concat.model.ts | 7 +++++-- .../form/builder/parsers/concat-field-parser.ts | 8 ++------ .../form/builder/parsers/textarea-field-parser.ts | 5 +---- src/app/shared/form/chips/models/chips.model.ts | 6 ++---- .../shared/notifications/notifications.service.ts | 3 +-- .../browse-link-metadata-list-element.component.ts | 2 +- .../plain-text-metadata-list-element.component.ts | 2 +- src/app/shared/pagination/pagination.component.ts | 3 +-- src/app/shared/search/search.component.ts | 2 +- .../subscription-modal.component.ts | 14 +++++++------- 27 files changed, 46 insertions(+), 62 deletions(-) diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts index 2eec0cfd0c..8cfdcdc523 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts @@ -76,7 +76,7 @@ export class SupervisionOrderGroupSelectorComponent { save() { this.isSubmitted = true; if (this.selectedOrderType && this.selectedGroup) { - let supervisionDataObject = new SupervisionOrder(); + const supervisionDataObject = new SupervisionOrder(); supervisionDataObject.ordertype = this.selectedOrderType; this.supervisionOrderDataService.create(supervisionDataObject, this.itemUUID, this.selectedGroup.uuid, this.selectedOrderType).pipe( getFirstCompletedRemoteData(), diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts index 7074190e1e..c1d6a072b3 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts @@ -90,7 +90,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent { this.subs.push( observableCombineLatest([firstItemRD, lastItemRD]).subscribe(([firstItem, lastItem]) => { let lowerLimit = this.getLimit(firstItem, metadataKeys, this.appConfig.browseBy.defaultLowerLimit); - let upperLimit = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear()); + const upperLimit = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear()); const options = []; const oneYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5; const fiveYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10; diff --git a/src/app/community-list-page/community-list-service.ts b/src/app/community-list-page/community-list-service.ts index 99e9dbeb0d..9a8841f6da 100644 --- a/src/app/community-list-page/community-list-service.ts +++ b/src/app/community-list-page/community-list-service.ts @@ -280,9 +280,7 @@ export class CommunityListService { * @param community Community being checked whether it is expandable (if it has subcommunities or collections) */ public getIsExpandable(community: Community): Observable { - let hasSubcoms$: Observable; - let hasColls$: Observable; - hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage) + const hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage) .pipe( map((rd: RemoteData>) => { if (hasValue(rd) && hasValue(rd.payload)) { @@ -293,7 +291,7 @@ export class CommunityListService { }), ); - hasColls$ = this.collectionDataService.findByParent(community.uuid, this.configOnePage) + const hasColls$ = this.collectionDataService.findByParent(community.uuid, this.configOnePage) .pipe( map((rd: RemoteData>) => { if (hasValue(rd) && hasValue(rd.payload)) { @@ -304,12 +302,9 @@ export class CommunityListService { }), ); - let hasChildren$: Observable; - hasChildren$ = observableCombineLatest(hasSubcoms$, hasColls$).pipe( + return observableCombineLatest(hasSubcoms$, hasColls$).pipe( map(([hasSubcoms, hasColls]: [boolean, boolean]) => hasSubcoms || hasColls) ); - - return hasChildren$; } } diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index 6604936cde..c1537792f5 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -260,9 +260,8 @@ export class AuthService { select(getAuthenticationToken), take(1), map((authTokenInfo: AuthTokenInfo) => { - let token: AuthTokenInfo; // Retrieve authentication token info and check if is valid - token = isNotEmpty(authTokenInfo) ? authTokenInfo : this.storage.get(TOKENITEM); + const token = isNotEmpty(authTokenInfo) ? authTokenInfo : this.storage.get(TOKENITEM); if (isNotEmpty(token) && token.hasOwnProperty('accessToken') && isNotEmpty(token.accessToken) && !this.isTokenExpired(token)) { return token; } else { diff --git a/src/app/core/data/base/find-all-data.ts b/src/app/core/data/base/find-all-data.ts index 57884e537e..7c17fa75d0 100644 --- a/src/app/core/data/base/find-all-data.ts +++ b/src/app/core/data/base/find-all-data.ts @@ -87,10 +87,9 @@ export class FindAllDataImpl extends BaseDataService< * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved */ getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: FollowLinkConfig[]): Observable { - let endpoint$: Observable; const args = []; - endpoint$ = this.getBrowseEndpoint(options).pipe( + const endpoint$ = this.getBrowseEndpoint(options).pipe( filter((href: string) => isNotEmpty(href)), map((href: string) => isNotEmpty(linkPath) ? `${href}/${linkPath}` : href), distinctUntilChanged(), diff --git a/src/app/core/data/base/search-data.ts b/src/app/core/data/base/search-data.ts index 536d6d6e25..e9dfc92d65 100644 --- a/src/app/core/data/base/search-data.ts +++ b/src/app/core/data/base/search-data.ts @@ -112,10 +112,9 @@ export class SearchDataImpl extends BaseDataService[]): Observable { - let result$: Observable; const args = []; - result$ = this.getSearchEndpoint(searchMethod); + const result$ = this.getSearchEndpoint(searchMethod); return result$.pipe(map((result: string) => this.buildHrefFromFindOptions(result, options, args, ...linksToFollow))); } diff --git a/src/app/core/data/dso-redirect.service.ts b/src/app/core/data/dso-redirect.service.ts index a27d1fb11f..35aecac2bd 100644 --- a/src/app/core/data/dso-redirect.service.ts +++ b/src/app/core/data/dso-redirect.service.ts @@ -95,7 +95,7 @@ export class DsoRedirectService { if (response.hasSucceeded) { const dso = response.payload; if (hasValue(dso.uuid)) { - let newRoute = getDSORoute(dso); + const newRoute = getDSORoute(dso); if (hasValue(newRoute)) { // Use a "301 Moved Permanently" redirect for SEO purposes this.hardRedirectService.redirect(newRoute, 301); diff --git a/src/app/core/data/relationship-data.service.ts b/src/app/core/data/relationship-data.service.ts index 46a51a2d01..29198c4878 100644 --- a/src/app/core/data/relationship-data.service.ts +++ b/src/app/core/data/relationship-data.service.ts @@ -264,7 +264,7 @@ export class RelationshipDataService extends IdentifiableDataService>> { - let linksToFollow: FollowLinkConfig[] = itemLinksToFollow(options.fetchThumbnail); + const linksToFollow: FollowLinkConfig[] = itemLinksToFollow(options.fetchThumbnail); linksToFollow.push(followLink('relationshipType')); return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid)); diff --git a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts index 635cf455b5..08a58de382 100644 --- a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts +++ b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts @@ -184,7 +184,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy { mergeMap((list: PaginatedList) => list.page), map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) })) ).subscribe((entry: BundleBitstreamsMapEntry) => { - let bitstreamMapValues: BitstreamMapValue = { + const bitstreamMapValues: BitstreamMapValue = { isCollapsed: true, allBitstreamsLoaded: false, bitstreams: null @@ -239,14 +239,14 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy { */ onBitstreamsLoad(bundle: Bundle) { return this.getBundleBitstreams(bundle).subscribe((res: PaginatedList) => { - let nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize); - let bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe( + const nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize); + const bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe( map((existingBits: Bitstream[])=> { return [... existingBits, ...nextBitstreams]; }) ); this.bitstreamPageSize = this.bitstreamPageSize + this.bitstreamSize; - let bitstreamMapValues: BitstreamMapValue = { + const bitstreamMapValues: BitstreamMapValue = { bitstreams: bitstreamsToShow , isCollapsed: this.bundleBitstreamsMap.get(bundle.id).isCollapsed, allBitstreamsLoaded: res?.page.length <= this.bitstreamPageSize diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts index b8542f5806..4f7ece790f 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts @@ -493,7 +493,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy { ); // this adds thumbnail images when required by configuration - let linksToFollow: FollowLinkConfig[] = itemLinksToFollow(this.fetchThumbnail); + const linksToFollow: FollowLinkConfig[] = itemLinksToFollow(this.fetchThumbnail); this.subs.push( observableCombineLatest([ diff --git a/src/app/item-page/edit-item-page/item-status/item-status.component.ts b/src/app/item-page/edit-item-page/item-status/item-status.component.ts index 828f8d7439..be7e6bc907 100644 --- a/src/app/item-page/edit-item-page/item-status/item-status.component.ts +++ b/src/app/item-page/edit-item-page/item-status/item-status.component.ts @@ -103,7 +103,7 @@ export class ItemStatusComponent implements OnInit { ); // Observable for configuration determining whether the Register DOI feature is enabled - let registerConfigEnabled$: Observable = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe( + const registerConfigEnabled$: Observable = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe( getFirstCompletedRemoteData(), map((rd: RemoteData) => { // If the config property is exposed via rest and has a value set, return it @@ -147,7 +147,7 @@ export class ItemStatusComponent implements OnInit { getFirstSucceededRemoteData(), getRemoteDataPayload(), mergeMap((data: IdentifierData) => { - let identifiers = data.identifiers; + const identifiers = data.identifiers; let no_doi = true; let pending = false; if (identifiers !== undefined && identifiers !== null) { @@ -174,7 +174,7 @@ export class ItemStatusComponent implements OnInit { }), // Switch map pushes the register DOI operation onto a copy of the base array then returns to the pipe switchMap((showDoi: boolean) => { - let ops = [...operations]; + const ops = [...operations]; if (showDoi) { ops.push(new ItemOperation('register-doi', this.getCurrentUrl(item) + '/register-doi', FeatureID.CanRegisterDOI, true)); } diff --git a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts index cbbae9006d..d06facfe47 100644 --- a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts +++ b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts @@ -84,7 +84,7 @@ export class MetadataValuesComponent implements OnChanges { * @param value the specific metadata value being linked */ getQueryParams(value) { - let queryParams = {startsWith: value}; + const queryParams = {startsWith: value}; if (this.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: value}; } diff --git a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts index 52cd3cac34..ff2f1f4f61 100644 --- a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts +++ b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts @@ -48,7 +48,7 @@ export class MediaViewerVideoComponent { .filter((media: Bitstream) => media.name.substring(0, (media.name.length - 7)).toLowerCase() === name.toLowerCase()); for (const media of filteredCapMedias) { - let srclang: string = media.name.slice(-6, -4).toLowerCase(); + const srclang: string = media.name.slice(-6, -4).toLowerCase(); capInfos.push(new CaptionInfo( media._links.content.href, srclang, diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index ddb77b669c..37cae4cf9f 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -183,7 +183,7 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit { * Registration of an email address */ registration(captchaToken = null) { - let registerEmail$ = captchaToken ? + const registerEmail$ = captchaToken ? this.epersonRegistrationService.registerEmail(this.email.value, captchaToken, this.typeRequest) : this.epersonRegistrationService.registerEmail(this.email.value, null, this.typeRequest); this.subscriptions.push(registerEmail$.subscribe((response: RemoteData) => { diff --git a/src/app/shared/access-control-form-container/bulk-access-control.service.ts b/src/app/shared/access-control-form-container/bulk-access-control.service.ts index 6fb6b62532..b040952933 100644 --- a/src/app/shared/access-control-form-container/bulk-access-control.service.ts +++ b/src/app/shared/access-control-form-container/bulk-access-control.service.ts @@ -96,7 +96,7 @@ export class BulkAccessControlService { * @param payload */ export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => { - let finalPayload: BulkAccessControlFileModel = {}; + const finalPayload: BulkAccessControlFileModel = {}; const itemEnabled = payload.state.item.toggleStatus; const bitstreamEnabled = payload.state.bitstream.toggleStatus; diff --git a/src/app/shared/cookies/browser-klaro.service.ts b/src/app/shared/cookies/browser-klaro.service.ts index 2b09c0bf15..445b86863b 100644 --- a/src/app/shared/cookies/browser-klaro.service.ts +++ b/src/app/shared/cookies/browser-klaro.service.ts @@ -108,7 +108,7 @@ export class BrowserKlaroService extends KlaroService { const servicesToHide$: Observable = observableCombineLatest([hideGoogleAnalytics$, hideRegistrationVerification$]).pipe( map(([hideGoogleAnalytics, hideRegistrationVerification]) => { - let servicesToHideArray: string[] = []; + const servicesToHideArray: string[] = []; if (hideGoogleAnalytics) { servicesToHideArray.push(this.GOOGLE_ANALYTICS_SERVICE_NAME); } diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts index 503e4c4412..decf68354f 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts @@ -228,7 +228,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy { */ search(query: string, page: number, useCache: boolean = true): Observable>>> { // default sort is only used when there is not query - let efectiveSort = query ? null : this.sort; + const efectiveSort = query ? null : this.sort; return this.searchService.search( new PaginatedSearchOptions({ query: query, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts index dc7c796648..98a53bc657 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts @@ -86,7 +86,6 @@ export class DynamicConcatModel extends DynamicFormGroupModel { } set value(value: string | FormFieldMetadataValueObject) { - let values; let tempValue: string; if (typeof value === 'string') { @@ -97,15 +96,19 @@ export class DynamicConcatModel extends DynamicFormGroupModel { if (hasNoValue(tempValue)) { tempValue = ''; } - values = [...tempValue.split(this.separator), null].map((v) => + + // todo: this used to be valid, but results in a type error now -- REMEMBER TO INVESTIGATE! + const values = [...tempValue.split(this.separator), null].map((v) => Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v })); if (values[0].value) { + // @ts-ignore (this.get(0) as DsDynamicInputModel).value = values[0]; } else { (this.get(0) as DsDynamicInputModel).value = undefined; } if (values[1].value) { + // @ts-ignore (this.get(1) as DsDynamicInputModel).value = values[1]; } else { (this.get(1) as DsDynamicInputModel).value = undefined; diff --git a/src/app/shared/form/builder/parsers/concat-field-parser.ts b/src/app/shared/form/builder/parsers/concat-field-parser.ts index e86de70c81..07b63352c4 100644 --- a/src/app/shared/form/builder/parsers/concat-field-parser.ts +++ b/src/app/shared/form/builder/parsers/concat-field-parser.ts @@ -1,7 +1,6 @@ import {Inject} from '@angular/core'; import { FormFieldModel } from '../models/form-field.model'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; -import { DynamicFormControlLayout, } from '@ng-dynamic-forms/core'; import { CONCAT_FIRST_INPUT_SUFFIX, CONCAT_GROUP_SUFFIX, @@ -38,12 +37,9 @@ export class ConcatFieldParser extends FieldParser { } public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { - - let clsGroup: DynamicFormControlLayout; - let clsInput: DynamicFormControlLayout; const id: string = this.configData.selectableMetadata[0].metadata; - clsInput = { + const clsInput = { grid: { host: 'col-sm-6' } @@ -105,7 +101,7 @@ export class ConcatFieldParser extends FieldParser { concatGroup.group.push(model1); concatGroup.group.push(model2); - clsGroup = { + const clsGroup = { element: { control: 'form-row', } diff --git a/src/app/shared/form/builder/parsers/textarea-field-parser.ts b/src/app/shared/form/builder/parsers/textarea-field-parser.ts index 548ce567c3..691d47289f 100644 --- a/src/app/shared/form/builder/parsers/textarea-field-parser.ts +++ b/src/app/shared/form/builder/parsers/textarea-field-parser.ts @@ -1,5 +1,4 @@ import { FieldParser } from './field-parser'; -import { DynamicFormControlLayout } from '@ng-dynamic-forms/core'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; import { DsDynamicTextAreaModel, @@ -12,9 +11,7 @@ export class TextareaFieldParser extends FieldParser { public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { const textAreaModelConfig: DsDynamicTextAreaModelConfig = this.initModel(null, label); - let layout: DynamicFormControlLayout; - - layout = { + const layout = { element: { label: 'col-form-label' } diff --git a/src/app/shared/form/chips/models/chips.model.ts b/src/app/shared/form/chips/models/chips.model.ts index daeb363d82..1148d40e71 100644 --- a/src/app/shared/form/chips/models/chips.model.ts +++ b/src/app/shared/form/chips/models/chips.model.ts @@ -2,7 +2,7 @@ import findIndex from 'lodash/findIndex'; import isEqual from 'lodash/isEqual'; import isObject from 'lodash/isObject'; import { BehaviorSubject } from 'rxjs'; -import { ChipsItem, ChipsItemIcon } from './chips-item.model'; +import { ChipsItem } from './chips-item.model'; import { hasValue, isNotEmpty } from '../../../empty.util'; import { MetadataIconConfig } from '../../../../../config/submission-config.interface'; import { FormFieldMetadataValueObject } from '../../builder/models/form-field-metadata-value.model'; @@ -123,12 +123,10 @@ export class Chips { config = (configIndex !== -1) ? this.iconsConfig[configIndex] : defaultConfig; if (hasValue(value) && isNotEmpty(config) && !this.hasPlaceholder(value)) { - - let icon: ChipsItemIcon; const visibleWhenAuthorityEmpty = this.displayObj !== metadata; // Set icon - icon = { + const icon = { metadata, visibleWhenAuthorityEmpty, style: config.style diff --git a/src/app/shared/notifications/notifications.service.ts b/src/app/shared/notifications/notifications.service.ts index d37d6a349b..cbdad55203 100644 --- a/src/app/shared/notifications/notifications.service.ts +++ b/src/app/shared/notifications/notifications.service.ts @@ -21,8 +21,7 @@ export class NotificationsService { } private add(notification: Notification) { - let notificationAction; - notificationAction = new NewNotificationAction(notification); + const notificationAction = new NewNotificationAction(notification); this.store.dispatch(notificationAction); } diff --git a/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts index 8015583767..b31e0b847b 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts @@ -21,7 +21,7 @@ export class BrowseLinkMetadataListElementComponent extends MetadataRepresentati * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) */ getQueryParams() { - let queryParams = {startsWith: this.mdRepresentation.getValue()}; + const queryParams = {startsWith: this.mdRepresentation.getValue()}; if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: this.mdRepresentation.getValue()}; } diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts index 8a3e1d51a6..7ee0ca4214 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts @@ -21,7 +21,7 @@ export class PlainTextMetadataListElementComponent extends MetadataRepresentatio * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) */ getQueryParams() { - let queryParams = {startsWith: this.mdRepresentation.getValue()}; + const queryParams = {startsWith: this.mdRepresentation.getValue()}; if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: this.mdRepresentation.getValue()}; } diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 6da813cbc7..aa6f727c50 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -333,11 +333,10 @@ export class PaginationComponent implements OnDestroy, OnInit { if (collectionSize) { showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe( map((currentPaginationOptions) => { - let firstItem; let lastItem; const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage; - firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; + const firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; if (collectionSize > pageMax) { lastItem = pageMax; } else { diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index 61f3a119c8..2ec702bafb 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -432,7 +432,7 @@ export class SearchComponent implements OnInit { private retrieveSearchResults(searchOptions: PaginatedSearchOptions) { this.resultsRD$.next(null); this.lastSearchOptions = searchOptions; - let followLinks = [ + const followLinks = [ followLink('thumbnail', { isOptional: true }), followLink('item', { isOptional: true }, followLink('thumbnail', { isOptional: true })) as any, followLink('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }), diff --git a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts index 2413aad36e..9b28f49ee0 100644 --- a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts +++ b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts @@ -115,7 +115,7 @@ export class SubscriptionModalComponent implements OnInit { this.subscriptionForm.valueChanges.subscribe((newValue) => { let anyFrequencySelected = false; - for (let f of this.frequencyDefaultValues) { + for (const f of this.frequencyDefaultValues) { anyFrequencySelected = anyFrequencySelected || newValue.content.frequencies[f]; } this.isValid = anyFrequencySelected; @@ -124,11 +124,11 @@ export class SubscriptionModalComponent implements OnInit { initFormByAllSubscriptions(): void { this.subscriptionForm = new UntypedFormGroup({}); - for (let t of this.subscriptionDefaultTypes) { + for (const t of this.subscriptionDefaultTypes) { const formGroup = new UntypedFormGroup({}); formGroup.addControl('subscriptionId', this.formBuilder.control('')); formGroup.addControl('frequencies', this.formBuilder.group({})); - for (let f of this.frequencyDefaultValues) { + for (const f of this.frequencyDefaultValues) { (formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(false)); } this.subscriptionForm.addControl(t, formGroup); @@ -145,7 +145,7 @@ export class SubscriptionModalComponent implements OnInit { formGroup.addControl('subscriptionId', this.formBuilder.control(this.subscription.id)); formGroup.addControl('frequencies', this.formBuilder.group({})); (formGroup.get('frequencies') as UntypedFormGroup).addValidators(Validators.required); - for (let f of this.frequencyDefaultValues) { + for (const f of this.frequencyDefaultValues) { const value = findIndex(this.subscription.subscriptionParameterList, ['value', f]) !== -1; (formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(value)); } @@ -167,12 +167,12 @@ export class SubscriptionModalComponent implements OnInit { next: (res: PaginatedList) => { if (res.pageInfo.totalElements > 0) { this.showDeleteInfo$.next(true); - for (let subscription of res.page) { + for (const subscription of res.page) { const type = subscription.subscriptionType; const subscriptionGroup: UntypedFormGroup = this.subscriptionForm.get(type) as UntypedFormGroup; if (isNotEmpty(subscriptionGroup)) { subscriptionGroup.controls.subscriptionId.setValue(subscription.id); - for (let parameter of subscription.subscriptionParameterList.filter((p) => p.name === 'frequency')) { + for (const parameter of subscription.subscriptionParameterList.filter((p) => p.name === 'frequency')) { (subscriptionGroup.controls.frequencies as UntypedFormGroup).controls[parameter.value]?.setValue(true); } } @@ -266,7 +266,7 @@ export class SubscriptionModalComponent implements OnInit { subscriptionParameterList: [] }; - for (let frequency of this.frequencyDefaultValues) { + for (const frequency of this.frequencyDefaultValues) { if (frequencies.value[frequency]) { body.subscriptionParameterList.push( {