120243: Fix lint issues after upgrade

This commit is contained in:
Andreas Awouters
2024-11-19 11:24:30 +01:00
committed by Yury Bondarenko
parent ae32581d20
commit d87b375a35
28 changed files with 293 additions and 130 deletions

View File

@@ -1,3 +1,7 @@
import {
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing'; import { provideHttpClientTesting } from '@angular/common/http/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { import {
@@ -20,7 +24,6 @@ import { RawRestResponse } from 'src/app/core/dspace-rest/raw-rest-response.mode
import { TranslateLoaderMock } from 'src/app/shared/mocks/translate-loader.mock'; import { TranslateLoaderMock } from 'src/app/shared/mocks/translate-loader.mock';
import { FilteredCollectionsComponent } from './filtered-collections.component'; import { FilteredCollectionsComponent } from './filtered-collections.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('FiltersComponent', () => { describe('FiltersComponent', () => {
let component: FilteredCollectionsComponent; let component: FilteredCollectionsComponent;
@@ -54,7 +57,7 @@ describe('FiltersComponent', () => {
DspaceRestService, DspaceRestService,
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
})); }));

View File

@@ -1,5 +1,12 @@
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HTTP_INTERCEPTORS,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -38,7 +45,7 @@ describe(`AuthInterceptor`, () => {
{ provide: Store, useValue: store }, { provide: Store, useValue: store },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
service = TestBed.inject(DspaceRestService); service = TestBed.inject(DspaceRestService);

View File

@@ -1,4 +1,13 @@
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpHeaders, HttpInterceptor, HttpRequest, HttpResponse, HttpResponseBase } from '@angular/common/http'; import {
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpHeaders,
HttpInterceptor,
HttpRequest,
HttpResponse,
HttpResponseBase,
} from '@angular/common/http';
import { import {
Injectable, Injectable,
Injector, Injector,

View File

@@ -1,4 +1,8 @@
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
HttpResponse,
} from '@angular/common/http';
import { import {
Observable, Observable,
of as observableOf, of as observableOf,

View File

@@ -1,4 +1,8 @@
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
HttpResponse,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';

View File

@@ -1,4 +1,7 @@
import { HttpHeaders, HttpParams } from '@angular/common/http'; import {
HttpHeaders,
HttpParams,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {

View File

@@ -1,4 +1,8 @@
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
HttpParams,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';

View File

@@ -1,5 +1,13 @@
import { HttpErrorResponse, HttpHeaders, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HttpErrorResponse,
HttpHeaders,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { import {
inject, inject,
TestBed, TestBed,
@@ -28,7 +36,11 @@ describe('DspaceRestService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [], imports: [],
providers: [DspaceRestService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] providers: [
DspaceRestService,
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(),
],
}); });
dspaceRestService = TestBed.inject(DspaceRestService); dspaceRestService = TestBed.inject(DspaceRestService);

View File

@@ -1,4 +1,10 @@
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; import {
HttpClient,
HttpErrorResponse,
HttpHeaders,
HttpParams,
HttpResponse,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import {
Observable, Observable,

View File

@@ -1,5 +1,12 @@
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HTTP_INTERCEPTORS,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { REQUEST } from '../../../express.tokens'; import { REQUEST } from '../../../express.tokens';
@@ -29,7 +36,7 @@ describe('ForwardClientIpInterceptor', () => {
{ provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } } }, { provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } } },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
service = TestBed.inject(DspaceRestService); service = TestBed.inject(DspaceRestService);

View File

@@ -1,4 +1,9 @@
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import {
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
} from '@angular/common/http';
import { import {
Inject, Inject,
Injectable, Injectable,

View File

@@ -1,5 +1,12 @@
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HTTP_INTERCEPTORS,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { of } from 'rxjs'; import { of } from 'rxjs';
@@ -33,7 +40,7 @@ describe(`LocaleInterceptor`, () => {
{ provide: LocaleService, useValue: mockLocaleService }, { provide: LocaleService, useValue: mockLocaleService },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
service = TestBed.inject(DspaceRestService); service = TestBed.inject(DspaceRestService);

View File

@@ -1,4 +1,9 @@
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import {
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {

View File

@@ -1,5 +1,12 @@
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HTTP_INTERCEPTORS,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
@@ -51,7 +58,7 @@ describe('LogInterceptor', () => {
{ provide: UUIDService, useClass: UUIDService }, { provide: UUIDService, useClass: UUIDService },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
service = TestBed.inject(DspaceRestService); service = TestBed.inject(DspaceRestService);

View File

@@ -1,4 +1,9 @@
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import {
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';

View File

@@ -1,4 +1,7 @@
import { HttpHeaders, HttpParams } from '@angular/common/http'; import {
HttpHeaders,
HttpParams,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ReplaceOperation } from 'fast-json-patch'; import { ReplaceOperation } from 'fast-json-patch';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';

View File

@@ -1,4 +1,7 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
} from '@angular/common/http';
import { ReplaceOperation } from 'fast-json-patch'; import { ReplaceOperation } from 'fast-json-patch';
import { import {
cold, cold,

View File

@@ -1,4 +1,7 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
} from '@angular/common/http';
import { waitForAsync } from '@angular/core/testing'; import { waitForAsync } from '@angular/core/testing';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { import {

View File

@@ -1,4 +1,7 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';

View File

@@ -1,5 +1,12 @@
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HttpClient,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner'; import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
@@ -15,7 +22,11 @@ describe(`BrowserXSRFService`, () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [], imports: [],
providers: [BrowserXSRFService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] providers: [
BrowserXSRFService,
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(),
],
}); });
httpClient = TestBed.inject(HttpClient); httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController); httpTestingController = TestBed.inject(HttpTestingController);

View File

@@ -1,5 +1,14 @@
import { HTTP_INTERCEPTORS, HttpHeaders, HttpXsrfTokenExtractor, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; HTTP_INTERCEPTORS,
HttpHeaders,
HttpXsrfTokenExtractor,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock'; import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
@@ -40,7 +49,7 @@ describe(`XsrfInterceptor`, () => {
{ provide: CookieService, useValue: new CookieServiceMock() }, { provide: CookieService, useValue: new CookieServiceMock() },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}); });
service = TestBed.get(DspaceRestService); service = TestBed.get(DspaceRestService);

View File

@@ -1,4 +1,12 @@
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse, HttpXsrfTokenExtractor } from '@angular/common/http'; import {
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
HttpResponse,
HttpXsrfTokenExtractor,
} from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import {
Observable, Observable,

View File

@@ -1,4 +1,11 @@
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import {
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import {
HttpTestingController,
provideHttpClientTesting,
} from '@angular/common/http/testing';
import { import {
DebugElement, DebugElement,
NO_ERRORS_SCHEMA, NO_ERRORS_SCHEMA,
@@ -22,7 +29,6 @@ import {
import { LangConfig } from '../../../config/lang-config.interface'; import { LangConfig } from '../../../config/lang-config.interface';
import { LocaleService } from '../../core/locale/locale.service'; import { LocaleService } from '../../core/locale/locale.service';
import { LangSwitchComponent } from './lang-switch.component'; import { LangSwitchComponent } from './lang-switch.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
// This test is completely independent from any message catalogs or keys in the codebase // This test is completely independent from any message catalogs or keys in the codebase
// The translation module is instantiated with these bogus messages that we aren't using anyway. // The translation module is instantiated with these bogus messages that we aren't using anyway.
@@ -90,7 +96,7 @@ describe('LangSwitchComponent', () => {
{ provide: LocaleService, useValue: getMockLocaleService() }, { provide: LocaleService, useValue: getMockLocaleService() },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}).compileComponents() }).compileComponents()
.then(() => { .then(() => {
translate = TestBed.inject(TranslateService); translate = TestBed.inject(TranslateService);
@@ -175,7 +181,7 @@ describe('LangSwitchComponent', () => {
{ provide: LocaleService, useValue: getMockLocaleService() }, { provide: LocaleService, useValue: getMockLocaleService() },
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(), provideHttpClientTesting(),
] ],
}).compileComponents(); }).compileComponents();
translate = TestBed.inject(TranslateService); translate = TestBed.inject(TranslateService);
translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code)); translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code));

View File

@@ -1,4 +1,7 @@
import { HttpHeaders, HttpResponse } from '@angular/common/http'; import {
HttpHeaders,
HttpResponse,
} from '@angular/common/http';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { RestRequestMethod } from '../../../core/data/rest-request-method'; import { RestRequestMethod } from '../../../core/data/rest-request-method';

View File

@@ -1,4 +1,7 @@
import { HttpClient, HttpHeaders } from '@angular/common/http'; import {
HttpClient,
HttpHeaders,
} from '@angular/common/http';
import { import {
Inject, Inject,
Injectable, Injectable,

View File

@@ -1,4 +1,8 @@
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
HttpClient,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import { import {
APP_ID, APP_ID,
APP_INITIALIZER, APP_INITIALIZER,

View File

@@ -1,6 +1,9 @@
import { DragDropModule } from '@angular/cdk/drag-drop'; import { DragDropModule } from '@angular/cdk/drag-drop';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
@@ -203,7 +206,8 @@ const DECLARATIONS = [
SearchResultsSkeletonComponent, SearchResultsSkeletonComponent,
]; ];
@NgModule({ imports: [RootModule, @NgModule({
imports: [RootModule,
CommonModule, CommonModule,
DragDropModule, DragDropModule,
FormsModule, FormsModule,
@@ -215,7 +219,11 @@ const DECLARATIONS = [
TranslateModule, TranslateModule,
FormsModule, FormsModule,
NgxGalleryModule, NgxGalleryModule,
...DECLARATIONS], providers: [provideHttpClient(withInterceptorsFromDi())] }) ...DECLARATIONS],
providers: [
provideHttpClient(withInterceptorsFromDi()),
],
})
/** /**
* This module serves as an index for all the components in this theme. * This module serves as an index for all the components in this theme.

View File

@@ -1,6 +1,9 @@
import { DragDropModule } from '@angular/cdk/drag-drop'; import { DragDropModule } from '@angular/cdk/drag-drop';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
@@ -15,7 +18,10 @@ import { RootModule } from '../../app/root.module';
const DECLARATIONS = [ const DECLARATIONS = [
]; ];
@NgModule({ declarations: DECLARATIONS, imports: [RootModule, @NgModule({
declarations: DECLARATIONS,
imports: [
RootModule,
CommonModule, CommonModule,
DragDropModule, DragDropModule,
FormsModule, FormsModule,
@@ -25,7 +31,12 @@ const DECLARATIONS = [
StoreModule, StoreModule,
StoreRouterConnectingModule, StoreRouterConnectingModule,
TranslateModule, TranslateModule,
FormsModule], providers: [provideHttpClient(withInterceptorsFromDi())] }) FormsModule,
],
providers: [
provideHttpClient(withInterceptorsFromDi()),
],
})
/** /**
* This module serves as an index for all the components in this theme. * This module serves as an index for all the components in this theme.