AAE-48934 Eslint v9 migration (#12110)

* update

* update

* update

* working

* cr

* cr

* update

* use nx boundaries

* fixes

* fixes

* fixes

* cr

* cr

* update

* update

* update

* cr

* fix null

* cr

* cr

* cr

* cr

* cr

* update

* update

* update

* update

* update

* remove some duplications

* fix units
This commit is contained in:
Bartosz Sekula
2026-08-03 12:12:48 +02:00
committed by GitHub
parent 4123a89814
commit 3f232e75bc
325 changed files with 2327 additions and 1767 deletions
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import { TestBed } from '@angular/core/testing';
import { PropertyGroupTranslatorService, RECOGNISED_ECM_TYPES } from './property-groups-translator.service';
import { Property, OrganisedPropertyGroup } from '../interfaces/content-metadata.interfaces';
@@ -34,7 +34,6 @@ import { SitesService } from '../common/services/sites.service';
@Injectable({
providedIn: 'root'
})
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class ContentNodeDialogService {
private readonly dialog = inject(MatDialog);
private readonly contentService = inject(ContentService);
@@ -28,9 +28,8 @@ import { NodeEntryEvent, ShareDataRow } from '../../document-list';
import { SearchQueryBuilderService } from '../../search';
import { SitesService } from '../../common/services/sites.service';
import { NodesApiService } from '../../common/services/nodes-api.service';
import { UnitTestingUtils } from '../../../../../core/src/lib/testing/unit-testing-utils';
import { provideRouter } from '@angular/router';
import { NoopAuthModule } from '@alfresco/adf-core';
import { NoopAuthModule, UnitTestingUtils } from '@alfresco/adf-core';
const fakeResultSetPaging: ResultSetPaging = {
list: {
@@ -70,6 +69,12 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.detectChanges();
};
const searchAndTriggerDebounce = (searchTerm = 'string-to-search'): void => {
typeToSearchBox(searchTerm);
tick(debounceSearch);
fixture.detectChanges();
};
const getSearchIcon = (type: string): DebugElement => testingUtils.getByCSS(`[data-automation-id="content-node-selector-search-${type}"]`);
const triggerSearchResults = (searchResults: ResultSetPaging): void => {
@@ -160,10 +165,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
});
it('should the user query get updated when the user types in the search input', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchSpy).toHaveBeenCalled();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
@@ -171,39 +173,27 @@ describe('ContentNodeSelectorPanelComponent', () => {
}));
it('should set the query builder search mode to formula when the user types in the search input', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchQueryBuilderService.searchMode).toEqual('formula');
}));
it('should add the wildcard suffix to the user query when wildcards are enabled', fakeAsync(() => {
spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(true);
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
}));
it('should NOT add the wildcard suffix to the user query when wildcards are disabled', fakeAsync(() => {
spyOnProperty(searchQueryBuilderService, 'wildcardsEnabled', 'get').and.returnValue(false);
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchQueryBuilderService.userQuery).toEqual('(search-term)');
}));
it('should perform a search when the search request gets updated and it is defined', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchSpy).toHaveBeenCalledWith(false);
}));
@@ -211,10 +201,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should NOT perform a search and clear the results when the search input is empty', fakeAsync(() => {
spyOn(component, 'clearSearch');
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('');
expect(searchSpy).not.toHaveBeenCalled();
expect(component.clearSearch).toHaveBeenCalled();
@@ -237,10 +224,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
});
it('should load the results by calling the search api on search change', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('search-term');
expect(searchSpy).toHaveBeenCalledWith(false);
}));
@@ -248,23 +232,17 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should the query include the show files filterQuery', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
component.showFilesInResult = true;
typeToSearchBox('search-term');
searchAndTriggerDebounce('search-term');
const expectedRequest = `TYPE:'cm:folder' OR TYPE:'cm:content'`;
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(false);
expect(searchQueryBuilderService.addFilterQuery).toHaveBeenCalledWith(expectedRequest);
}));
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
component.chosenNode = [entry];
typeToSearchBox('kakarot');
tick(debounceSearch);
fixture.detectChanges();
searchAndTriggerDebounce('kakarot');
expect(component.chosenNode).toBeNull();
}));
@@ -279,9 +257,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should perform a search when selecting a site with the correct query', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
typeToSearchBox('search-term');
tick(debounceSearch);
searchAndTriggerDebounce('search-term');
expect(searchSpy.calls.count()).toBe(1);
@@ -297,8 +273,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should remove the previous site filter query when changing the selected site', fakeAsync(() => {
spyOn(searchQueryBuilderService, 'addFilterQuery').and.callThrough();
spyOn(searchQueryBuilderService, 'removeFilterQuery').and.callThrough();
typeToSearchBox('search-term');
tick(debounceSearch);
searchAndTriggerDebounce('search-term');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
component.siteChanged({ entry: { guid: 'vegeta' } } as SiteEntry);
@@ -326,9 +301,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
fixture.detectChanges();
typeToSearchBox('search-term');
tick(debounceSearch);
searchAndTriggerDebounce('search-term');
expect(searchSpy.calls.count()).toBe(1);
@@ -345,9 +318,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
typeToSearchBox('vegeta');
tick(debounceSearch);
searchAndTriggerDebounce('vegeta');
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
@@ -360,9 +331,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
searchAndTriggerDebounce('vegeta');
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
@@ -375,8 +344,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
const nodeIds$ = new Subject<string[]>();
getCorrespondingNodeIdsSpy.and.returnValue(nodeIds$.asObservable());
typeToSearchBox('vegeta');
tick(debounceSearch);
searchAndTriggerDebounce('vegeta');
searchSpy.calls.reset();
@@ -396,9 +364,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
searchAndTriggerDebounce('vegeta');
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0);
}));
@@ -99,7 +99,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
private readonly sitesService = inject(SitesService);
private readonly contentNodeSelectorPanelService = inject(ContentNodeSelectorPanelService);
// eslint-disable-next-line @typescript-eslint/naming-convention
DEFAULT_PAGINATION: Pagination = new Pagination({
maxItems: 25,
skipCount: 0
@@ -25,9 +25,6 @@ import { SitesService } from '../../common/services/sites.service';
import { CommonModule } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field';
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export const Relations = {
Members: 'members',
Containers: 'containers'
@@ -196,7 +196,6 @@ export class ShareDialogComponent implements OnInit {
this.isDisabled = false;
this.isFileShared = true;
// eslint-disable-next-line
this.renditionService.getNodeRendition(this.data.node.entry.id);
this.updateForm();
@@ -37,7 +37,7 @@ export class NodeSharedDirective implements OnChanges {
isShared: boolean = false;
/** Node to share. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-share')
node: NodeEntry;
@@ -20,7 +20,6 @@ import { UntypedFormControl } from '@angular/forms';
const I18N_ERRORS_PATH = 'CORE.FOLDER_DIALOG.FOLDER_NAME.ERRORS';
export const forbidSpecialCharacters = ({ value }: UntypedFormControl) => {
// eslint-disable-next-line no-useless-escape
const specialCharacters: RegExp = /([\*\"\<\>\\\/\?\:\|])/;
const isValid: boolean = !specialCharacters.test(value);
@@ -34,7 +34,7 @@ export class LibraryFavoriteDirective implements OnChanges {
library: LibraryEntity = null;
@Output() toggle = new EventEmitter<any>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() error = new EventEmitter<any>();
private targetLibrary = null;
@@ -52,7 +52,6 @@ export class LibraryMembershipDirective implements OnChanges {
@Output()
toggle = new EventEmitter<LibraryMembershipToggleEvent>();
// eslint-disable-next-line @angular-eslint/no-output-native
@Output()
error = new EventEmitter<LibraryMembershipErrorEvent>();
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, inject } from '@angular/core';
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi, LazyApi } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs';
@@ -176,7 +174,7 @@ export class NodeDeleteDirective implements OnChanges {
if (status.allFailed && !status.oneFailed) {
return this.translation.instant(
'CORE.DELETE_NODE.ERROR_PLURAL',
// eslint-disable-next-line id-blacklist
{ number: status.failed.length }
);
}
@@ -184,7 +182,7 @@ export class NodeDeleteDirective implements OnChanges {
if (status.allSucceeded && !status.oneSucceeded) {
return this.translation.instant(
'CORE.DELETE_NODE.PLURAL',
// eslint-disable-next-line id-blacklist
{ number: status.success.length }
);
}
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi, LazyApi } from '@alfresco/js-api';
import { Observable, from, forkJoin, of } from 'rxjs';
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit, inject } from '@angular/core';
import { Node } from '@alfresco/js-api';
import { ContentService } from '../common/services/content.service';
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, Output, inject } from '@angular/core';
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, LazyApi } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs';
@@ -184,7 +182,6 @@ export class NodeRestoreDirective {
if (status.someFailed && !status.oneFailed) {
return this.translation.instant('CORE.RESTORE_NODE.PARTIAL_PLURAL', {
// eslint-disable-next-line id-blacklist
number: status.fail.length
});
}
@@ -15,9 +15,6 @@
* limitations under the License.
*/
/* eslint-disable rxjs/no-subject-value */
/* eslint-disable @typescript-eslint/naming-convention */
import {
AppConfigService,
ColumnsSelectorComponent,
@@ -23,8 +23,8 @@ import { SimpleChange } from '@angular/core';
import { SearchHeaderQueryBuilderService } from './../../../search/services/search-header-query-builder.service';
import { FilterHeaderComponent } from './filter-header.component';
import { provideRouter } from '@angular/router';
import { SearchCategory } from '@alfresco/adf-content-services';
import { NodePaging } from '@alfresco/js-api';
import { SearchCategory } from '../../../search/models/search-category.interface';
describe('FilterHeaderComponent', () => {
let fixture: ComponentFixture<FilterHeaderComponent>;
@@ -56,7 +56,6 @@ export class NameColumnComponent implements OnInit {
private readonly nodesApiService = inject(NodesApiService);
@Input({ required: true })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: any;
@Input()
@@ -29,7 +29,6 @@ import { NodeTooltipUtils } from '../../utils/node-tooltip.utils';
})
export class TrashcanNameColumnComponent implements OnInit {
@Input({ required: true })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: any;
isLibrary = false;
@@ -15,9 +15,6 @@
* limitations under the License.
*/
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export class ContentActionModel {
icon: string;
title: string;
@@ -15,9 +15,6 @@
* limitations under the License.
*/
/* eslint-disable no-shadow */
/* eslint-disable @typescript-eslint/naming-convention */
export const NodeAction = {
ATTACH: 'ATTACH',
CHOOSE: 'CHOOSE',
@@ -30,7 +30,6 @@ import { NodeAction } from '../models/node-action.enum';
@Injectable({
providedIn: 'root'
})
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class NodeActionsService {
private readonly contentDialogService = inject(ContentNodeDialogService);
dialogRef = inject(MatDialog);
@@ -75,7 +75,6 @@ export class NodeTooltipUtils {
return '';
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { properties, description, title } = node.entry as any;
// Check both direct properties and cm: properties for compatibility
@@ -93,7 +92,7 @@ export class NodeTooltipUtils {
* @param allEntries - Array of all entries to check for duplicates
* @returns The display title, with ID/name appended if duplicate exists
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static getLibraryTitle(library: any, allEntries: any[]): string {
if (!library) {
return '';
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter, inject } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api';
@@ -17,10 +17,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NodeCommentsComponent } from './node-comments.component';
import { CommentsComponent } from '../../../../core/src/lib/comments/comments.component';
import { CommentModel } from '../../../../core/src/lib/models';
import { UnitTestingUtils } from '../../../../core/src/lib/testing/unit-testing-utils';
import { provideApiTesting } from '../testing/providers';
import { CommentModel, CommentsComponent, UnitTestingUtils } from '@alfresco/adf-core';
describe('NodeCommentsComponent', () => {
let fixture: ComponentFixture<NodeCommentsComponent>;
@@ -68,7 +68,6 @@ export class AddPermissionPanelComponent {
selectedItems: NodeEntry[] = [];
// eslint-disable-next-line @typescript-eslint/naming-convention
EVERYONE: NodeEntry = new NodeEntry({
entry: new Node({ nodeType: 'cm:authorityContainer', properties: { 'cm:authorityName': 'GROUP_EVERYONE' } })
});
@@ -38,10 +38,7 @@ export class SearchPermissionConfigurationService implements SearchConfiguration
maxItems: maxResults,
skipCount
},
filterQueries: [
/* eslint-disable-next-line */
{ query: "TYPE:'cm:authority'" }
]
filterQueries: [{ query: "TYPE:'cm:authority'" }]
};
}
@@ -15,7 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, Input, Output, EventEmitter, inject } from '@angular/core';
import { Node } from '@alfresco/js-api';
import { ContentService } from '../../common/services/content.service';
@@ -79,7 +79,7 @@ export class SearchComponent implements SearchComponentInterface, AfterContentIn
searchTerm: string = '';
/** CSS class for display. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('class')
set classList(classList: string) {
if (classList?.length) {
@@ -19,7 +19,6 @@ import { UntypedFormControl } from '@angular/forms';
import { SearchTermValidator } from './search-term-validator';
describe('Search term validator', () => {
it('should pass validation for a value with the specified required number of alphanumeric characters', () => {
const control = new UntypedFormControl('ab', SearchTermValidator.minAlphanumericChars(2));
expect(control.valid).toBe(true);
@@ -35,7 +34,6 @@ describe('Search term validator', () => {
expect(control.valid).toBe(false);
});
/* eslint-disable max-len */
it('should fail validation for a value with less than the specified required number of alphanumeric characters but with other non-alphanumeric characters', () => {
const control = new UntypedFormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
expect(control.valid).toBe(false);
@@ -15,7 +15,6 @@
* limitations under the License.
*/
import { TagsCreatorMode, TagService } from '@alfresco/adf-content-services';
import { NotificationService, UnitTestingUtils } from '@alfresco/adf-core';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
@@ -26,6 +25,8 @@ import { MatError } from '@angular/material/form-field';
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
import { EMPTY, of, throwError } from 'rxjs';
import { TagsCreatorComponent } from './tags-creator.component';
import { TagService } from '../services/tag.service';
import { TagsCreatorMode } from './tags-creator-mode';
describe('TagsCreatorComponent', () => {
let fixture: ComponentFixture<TagsCreatorComponent>;
@@ -24,7 +24,6 @@ import { UploadFilesEvent } from '../upload-files.event';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class UploadBase implements OnInit {
protected uploadService = inject(UploadService);
protected translationService: TranslationService = inject(TranslationService);
@@ -87,9 +86,7 @@ export abstract class UploadBase implements OnInit {
private readonly destroyRef = inject(DestroyRef);
ngOnInit() {
this.uploadService.fileUploadError
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(error => this.error.emit(error));
this.uploadService.fileUploadError.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((error) => this.error.emit(error));
}
/**
@@ -99,7 +96,7 @@ export abstract class UploadBase implements OnInit {
*/
uploadFiles(files: File[]): void {
const filteredFiles: FileModel[] = files.map<FileModel>((file: File) =>
this.createFileModel(file, this.rootFolderId, ((file).webkitRelativePath || '').replace(/\/[^/]*$/, ''))
this.createFileModel(file, this.rootFolderId, (file.webkitRelativePath || '').replace(/\/[^/]*$/, ''))
);
this.uploadQueue(filteredFiles);
@@ -15,8 +15,6 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-input-rename */
import { FileUtils } from '@alfresco/adf-core';
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, inject } from '@angular/core';
@@ -68,7 +68,7 @@ class ViewerWithCustomToolbarComponent {}
@Component({
selector: 'adf-viewer-container-toolbar-actions',
imports: [MatIconModule, MatButtonModule, ViewerToolbarActionsComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: `<adf-alfresco-viewer>
<adf-viewer-toolbar-actions>
<button mat-icon-button id="custom-button">
@@ -102,7 +102,7 @@ class DummyDialogComponent {}
@Component({
selector: 'adf-viewer-container-open-with',
imports: [MatIconModule, MatMenuModule, ViewerOpenWithComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: `
<adf-alfresco-viewer>
<adf-viewer-open-with>
@@ -127,7 +127,7 @@ class ViewerWithCustomOpenWithComponent {}
@Component({
selector: 'adf-viewer-container-more-actions',
imports: [MatIconModule, MatMenuModule, ViewerMoreActionsComponent, AlfrescoViewerComponent, IconModule],
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
template: ` <adf-alfresco-viewer>
<adf-viewer-more-actions>
<button mat-menu-item>