[AAE-7100] migrate ADF projects to eslint (#7483)

* migrate content services to eslint

* migrate insights to eslint

* migrate extensions to eslint

* migrate testing lib to eslint

* migrate CLI to eslint

* migrate process-services to eslint

* migrate process-services-cloud to eslint

* remove cli analytics [ci:force]
This commit is contained in:
Denys Vuika
2022-02-03 11:01:54 +00:00
committed by GitHub
parent b8bb234410
commit 8dc736e8f0
233 changed files with 1496 additions and 725 deletions

View File

@@ -65,7 +65,7 @@ export class AuditService {
);
}
updateAuditApp(auditApplicationId: string, auditAppBodyUpdate: boolean, opts?: any): Observable<AuditApp | {}> {
updateAuditApp(auditApplicationId: string, auditAppBodyUpdate: boolean, opts?: any): Observable<AuditApp | any> {
const defaultOptions = {};
const queryOptions = Object.assign({}, defaultOptions, opts);
return from(this.auditApi.updateAuditApp(auditApplicationId, new AuditBodyUpdate({ isEnabled: auditAppBodyUpdate }), queryOptions))

View File

@@ -22,7 +22,7 @@ export interface PropertyGroup {
title: string;
description?: string;
properties: {
[key: string]: Property
[key: string]: Property;
};
}

View File

@@ -27,12 +27,11 @@ export class BasicPropertiesService {
}
getProperties(node: Node) {
const sizeInBytes = node.content ? node.content.sizeInBytes : '',
mimeTypeName = node.content ? node.content.mimeTypeName : '',
author = node.properties ? node.properties['cm:author'] : '',
description = node.properties ? node.properties['cm:description'] : '',
title = node.properties ? node.properties['cm:title'] : '';
const sizeInBytes = node.content ? node.content.sizeInBytes : '';
const mimeTypeName = node.content ? node.content.mimeTypeName : '';
const author = node.properties ? node.properties['cm:author'] : '';
const description = node.properties ? node.properties['cm:description'] : '';
const title = node.properties ? node.properties['cm:title'] : '';
return [
new CardViewTextItemModel({

View File

@@ -34,10 +34,10 @@ describe('AspectOrientedConfigService', () => {
expectations: OrganisedPropertyGroup[];
}
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
@@ -177,11 +177,10 @@ describe('AspectOrientedConfigService', () => {
});
describe('appendAllPreset', () => {
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },

View File

@@ -31,8 +31,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
}
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
const aspects = this.config,
aspectNames = Object.keys(aspects);
const aspects = this.config;
const aspectNames = Object.keys(aspects);
return aspectNames
.reduce((groupAccumulator, aspectName) => {
@@ -45,8 +45,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
const groups = Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
if (this.isAspectReadOnly(groupName)) {
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));

View File

@@ -28,8 +28,8 @@ export class IndifferentConfigService implements ContentMetadataConfig {
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
return Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
return Object.assign({}, propertyGroup, {
properties: Object.keys(properties).map((propertyName) => properties[propertyName])

View File

@@ -102,12 +102,12 @@ describe('LayoutOrientedConfigService', () => {
expectations: OrganisedPropertyGroup[];
}
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' },
property5 = <Property> { name: 'property5' },
property6 = <Property> { name: 'property6' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const property5 = <Property> { name: 'property5' };
const property6 = <Property> { name: 'property6' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },

View File

@@ -39,15 +39,17 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
const layoutBlocks = this.config.filter((itemsGroup) => itemsGroup.items);
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
const flattenedItems = this.flattenItems(layoutBlock.items),
properties = flattenedItems.reduce((props, explodedItem) => {
const isProperty = typeof explodedItem.property === 'object';
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
if (isProperty) { property = this.setPropertyTitle(property, explodedItem.property); }
property = this.setEditableProperty(property, explodedItem);
return props.concat(property);
}, []);
const flattenedItems = this.flattenItems(layoutBlock.items);
const properties = flattenedItems.reduce((props, explodedItem) => {
const isProperty = typeof explodedItem.property === 'object';
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
if (isProperty) {
property = this.setPropertyTitle(property, explodedItem.property);
}
property = this.setEditableProperty(property, explodedItem);
return props.concat(property);
}, []);
return {
title: layoutBlock.title,
@@ -61,8 +63,8 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
return Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
return Object.assign({}, propertyGroup, {
properties: Object.keys(properties).map((propertyName) => properties[propertyName])

View File

@@ -31,7 +31,7 @@ import { ContentTypePropertiesService } from './content-type-property.service';
})
export class ContentMetadataService {
error = new Subject<{ statusCode: number, message: string }>();
error = new Subject<{ statusCode: number; message: string }>();
constructor(private basicPropertiesService: BasicPropertiesService,
private contentMetadataConfigFactory: ContentMetadataConfigFactory,

View File

@@ -31,7 +31,7 @@ import { switchMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class ContentNodeDialogService {
static nonDocumentSiteContent = [
'blog',

View File

@@ -197,7 +197,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
@Input()
set showFilesInResult(value: boolean) {
if (value !== undefined && value !== null) {
const showFilesQuery = `TYPE:'cm:folder'${value ? " OR TYPE:'cm:content'" : ''}`;
const showFilesQuery = `TYPE:'cm:folder'${value ? ` OR TYPE:'cm:content'` : ''}`;
this.queryBuilderService.addFilterQuery(showFilesQuery);
}
}

View File

@@ -34,7 +34,7 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
isShared: boolean = false;
/** Node to share. */
// tslint:disable-next-line:no-input-rename
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-share')
node: NodeEntry;

View File

@@ -130,7 +130,9 @@ describe('FolderDialogComponent', () => {
spyOn(nodesApi, 'updateNode').and.returnValue(of(folder));
component.success.subscribe((node) => { expectedNode = node; });
component.success.subscribe((node) => {
expectedNode = node;
});
component.submit();
fixture.detectChanges();

View File

@@ -142,7 +142,9 @@ export class FolderDialogComponent implements OnInit {
submit() {
const { form, dialog, editing } = this;
if (!form.valid) { return; }
if (!form.valid) {
return;
}
(editing ? this.edit() : this.create())
.subscribe(

View File

@@ -7,7 +7,6 @@
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
required
matInput
autofocus
formControlName="title"
autocomplete="off"
/>

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core';
import { Node } from '@alfresco/js-api';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component } from '@angular/core';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, EventEmitter, Input, OnInit, Output, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
@@ -46,7 +46,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
/** Visibility state (see examples). */
@Input()
visible: boolean | Function = true;
visible: boolean | ((...args) => boolean) = true;
/** System actions. Can be "delete", "download", "copy" or "move". */
@Input()
@@ -66,7 +66,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
/** Is the menu item disabled? */
@Input()
disabled: boolean | Function = false;
disabled: boolean | ((...args) => boolean) = false;
/** Emitted when the user selects the action from the menu. */
@Output()

View File

@@ -241,7 +241,9 @@ describe('DocumentList', () => {
previousValue: undefined,
currentValue: mockPreselectedNodes,
firstChange: true,
isFirstChange(): boolean { return this.firstChange; }
isFirstChange(): boolean {
return this.firstChange;
}
}
};
documentList.ngOnChanges(changes);
@@ -258,7 +260,9 @@ describe('DocumentList', () => {
previousValue: undefined,
currentValue: ['mockChangeValue'],
firstChange: true,
isFirstChange(): boolean { return this.firstChange; }
isFirstChange(): boolean {
return this.firstChange;
}
}
};
documentList.ngOnChanges(changes);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:rxjs-no-subject-value */
/* eslint-disable rxjs/no-subject-value */
import {
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
@@ -208,7 +208,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
* docs for more details and usage examples.
*/
@Input()
rowStyle: { [key: string]: any; };
rowStyle: { [key: string]: any };
/** The CSS class to apply to every row */
@Input()
@@ -816,7 +816,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
}
onNodeSelect(event: { row: ShareDataRow, selection: Array<ShareDataRow> }) {
onNodeSelect(event: { row: ShareDataRow; selection: Array<ShareDataRow> }) {
this.selection = event.selection.map((entry) => entry.node);
const domEvent = new CustomEvent('node-select', {
detail: {
@@ -829,7 +829,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this.elementRef.nativeElement.dispatchEvent(domEvent);
}
onNodeUnselect(event: { row: ShareDataRow, selection: Array<ShareDataRow> }) {
onNodeUnselect(event: { row: ShareDataRow; selection: Array<ShareDataRow> }) {
this.selection = event.selection.map((entry) => entry.node);
const domEvent = new CustomEvent('node-unselect', {
detail: {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Inject, OnInit, OnChanges, SimpleChanges, Input, Output, EventEmitter } from '@angular/core';
import { Component, Inject, OnInit, OnChanges, SimpleChanges, Input, Output, EventEmitter, OnDestroy } from '@angular/core';
import { PaginationModel, DataSorting } from '@alfresco/adf-core';
import { DocumentListComponent } from '../document-list.component';
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../../search/search-query-service.token';
@@ -30,7 +30,7 @@ import { NodePaging, MinimalNode } from '@alfresco/js-api';
templateUrl: './filter-header.component.html',
providers: [{ provide: SEARCH_QUERY_SERVICE_TOKEN, useClass: SearchHeaderQueryBuilderService}]
})
export class FilterHeaderComponent implements OnInit, OnChanges {
export class FilterHeaderComponent implements OnInit, OnChanges, OnDestroy {
/** (optional) Initial filter value to sort . */
@Input()

View File

@@ -19,12 +19,12 @@ export class ContentActionModel {
icon: string;
title: string;
handler: ContentActionHandler;
execute: Function;
execute: (...args) => void;
target: string;
permission: string;
disableWithNoPermission: boolean = false;
disabled: boolean | Function = false;
visible: boolean | Function = true;
disabled: boolean | ((...args) => boolean) = false;
visible: boolean | ((...args) => boolean) = true;
constructor(obj?: any) {
if (obj) {

View File

@@ -34,7 +34,7 @@ export class DocumentActionsService {
error: Subject<Error> = new Subject<Error>();
success: Subject<string> = new Subject<string>();
private handlers: { [id: string]: ContentActionHandler; } = {};
private handlers: { [id: string]: ContentActionHandler } = {};
constructor(private nodeActionsService: NodeActionsService,
private contentNodeDialogService: ContentNodeDialogService,

View File

@@ -33,7 +33,7 @@ export class FolderActionsService {
error: Subject<Error> = new Subject<Error>();
success: Subject<string> = new Subject<string>();
private handlers: { [id: string]: ContentActionHandler; } = {};
private handlers: { [id: string]: ContentActionHandler } = {};
constructor(private nodeActionsService: NodeActionsService,
private documentListService: DocumentListService,

View File

@@ -28,7 +28,7 @@ import { NodeAction } from '../models/node-action.enum';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class NodeActionsService {
@Output()

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';

View File

@@ -42,8 +42,8 @@ export const disabledCategories = [
'field': null,
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -62,8 +62,8 @@ export const expandedCategories = [
'field': null,
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -94,8 +94,8 @@ export const simpleCategories: SearchCategory[] = [
'field': 'check-list',
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -132,7 +132,7 @@ export const searchFilter = {
'resetButton': true,
'filterQueries': [
{
'query': "TYPE:'cm:folder' OR TYPE:'cm:content'"
'query': `TYPE:'cm:folder' OR TYPE:'cm:content'`
},
{
'query': 'NOT cm:creator:System'
@@ -321,7 +321,7 @@ export const searchFilter = {
'component': {
'selector': 'text',
'settings': {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
}

View File

@@ -44,7 +44,7 @@ export class SearchPermissionConfigurationService implements SearchConfiguration
skipCount: skipCount
},
filterQueries: [
/*tslint:disable-next-line */
/* eslint-disable-next-line */
{ query: "TYPE:'cm:authority'" }]
};

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, Input, Output, EventEmitter } from '@angular/core';
import { NodesApiService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';

View File

@@ -48,7 +48,7 @@ export class PermissionContainerComponent implements OnChanges {
/** Emitted when the permission is updated. */
@Output()
update = new EventEmitter<{role: string, permission: PermissionDisplayModel}>();
update = new EventEmitter<{role: string; permission: PermissionDisplayModel}>();
@Output()
updateAll = new EventEmitter<string>();

View File

@@ -17,7 +17,7 @@
import { ObjectDataRow } from '@alfresco/adf-core';
import { PermissionElement } from '@alfresco/js-api';
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { PermissionDisplayModel } from '../../models/permission.model';
import { PermissionListService } from './permission-list.service';
@@ -27,7 +27,7 @@ import { PermissionListService } from './permission-list.service';
styleUrls: ['./permission-list.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class PermissionListComponent {
export class PermissionListComponent implements OnInit {
/** ID of the node whose permissions you want to show. */
@Input()
nodeId: string;

View File

@@ -71,8 +71,9 @@ describe('PermissionListService', () => {
describe('toggle permission', () => {
it('should show error if user doesn\'t have permission to update node', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
it('should show error if user does not have permission to update node', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
const event = { source: { checked: false } };
node.allowableOperations = [];
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
spyOn(nodesApiService, 'updateNode').and.stub();
@@ -83,7 +84,8 @@ describe('PermissionListService', () => {
});
it('should include the local permission before toggle', (done) => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
const event = { source: { checked: false } };
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
spyOn(nodePermissionService, 'updatePermissions').and.returnValue(of(null));
spyOn(nodesApiService, 'updateNode').and.returnValue(of(JSON.parse(JSON.stringify(fakeNodeLocalSiteManager))));
@@ -104,7 +106,8 @@ describe('PermissionListService', () => {
});
it('should not update local permission before toggle', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
const event = { source: { checked: false } };
const updateNode = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
node.permissions.locallySet = [{
'authorityId': 'GROUP_site_testsite_SiteManager',
@@ -124,7 +127,8 @@ describe('PermissionListService', () => {
});
it('should show message for errored toggle', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
const event = { source: { checked: false } };
node.permissions.isInheritanceEnabled = true;
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError('Failed to update'));
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));

View File

@@ -36,7 +36,7 @@ export class PermissionListService {
loading$: BehaviorSubject<boolean> = new BehaviorSubject(true);
error$: Subject<boolean> = new Subject();
nodeWithRoles$: Subject<{ node: Node, roles: RoleModel[] }> = new Subject();
nodeWithRoles$: Subject<{ node: Node; roles: RoleModel[] }> = new Subject();
data$: Observable<NodePermissionsModel> = this.nodeWithRoles$.pipe(
map(({ node, roles}) => {
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
@@ -220,7 +220,8 @@ export class PermissionListService {
getManagerAuthority(node: Node): string {
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
let hasLocalManagerPermission = false, authorityId: string;
let hasLocalManagerPermission = false;
let authorityId: string;
if (sitePath) {
authorityId = `GROUP_site_${sitePath.name}_${this.SITE_MANAGER_ROLE}`;
hasLocalManagerPermission = !!node.permissions.locallySet?.find((permission) => permission.authorityId === authorityId && permission.name === this.SITE_MANAGER_ROLE);

View File

@@ -31,7 +31,7 @@ export class PopOverDirective implements OnInit, OnDestroy, AfterViewInit {
return this._open;
}
@Input('adf-pop-over') popOver!: TemplateRef<object>;
@Input('adf-pop-over') popOver!: TemplateRef<any>;
@Input() target!: HTMLElement;
@Input() panelClass = 'adf-permission-pop-over';

View File

@@ -189,7 +189,9 @@ describe('NodePermissionService', () => {
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority)
.subscribe(
() => { fail('should throw exception'); },
() => {
fail('should throw exception');
},
(errorMessage) => {
expect(errorMessage).not.toBeNull();
expect(errorMessage).toBeDefined();

View File

@@ -224,7 +224,7 @@ export class NodePermissionService {
'filterQueries': [
{
'query':
"TYPE:'st:site'"
`TYPE:'st:site'`
}
]
};
@@ -307,8 +307,9 @@ export class NodePermissionService {
);
}
transformNodeToUserPerson(node: Node): { person: EcmUserModel, group: Group } {
let person = null, group = null;
transformNodeToUserPerson(node: Node): { person: EcmUserModel; group: Group } {
let person = null;
let group = null;
if (node.nodeType === 'cm:person') {
const firstName = node.properties['cm:firstName'];
const lastName = node.properties['cm:lastName'];

View File

@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
it('should setup options from settings', () => {
const options: any = [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
];
component.settings = <any> { options: options };
component.ngOnInit();
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
it('should handle enter key as click on checkboxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.ngOnInit();
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
it('should update query builder on checkbox change', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.id = 'checklist';
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
it('should reset selected boxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
component.ngOnInit();
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();

View File

@@ -141,7 +141,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
this.onDestroy$.complete();
}
apply(model: { from: string, to: string }, isValid: boolean) {
apply(model: { from: string; to: string }, isValid: boolean) {
if (isValid && this.id && this.context && this.settings && this.settings.field) {
this.isActive = true;

View File

@@ -129,7 +129,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
this.onDestroy$.complete();
}
apply(model: { from: string, to: string }, isValid: boolean) {
apply(model: { from: string; to: string }, isValid: boolean) {
if (isValid && this.id && this.context && this.settings && this.settings.field) {
this.isActive = true;

View File

@@ -20,7 +20,6 @@ import { TranslateModule } from '@ngx-translate/core';
import { SearchService, setupTestBed } from '@alfresco/adf-core';
import { SearchHeaderQueryBuilderService } from '../../services/search-header-query-builder.service';
import { ContentTestingModule } from '../../../testing/content.testing.module';
// import { fakeNodePaging } from './../../../mock/document-list.component.mock';
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
import { By } from '@angular/platform-browser';
import { SearchFilterContainerComponent } from './search-filter-container.component';
@@ -36,7 +35,7 @@ const mockCategory: SearchCategory = {
'component': {
'selector': 'text',
'settings': {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
}

View File

@@ -86,7 +86,7 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
return parseInt(formGroup.get('from').value, 10) < parseInt(formGroup.get('to').value, 10) ? null : {'mismatch': true};
}
apply(model: { from: string, to: string }, isValid: boolean) {
apply(model: { from: string; to: string }, isValid: boolean) {
if (isValid && this.id && this.context && this.field) {
this.updateDisplayValue();
this.isActive = true;

View File

@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
it('should setup options from settings', () => {
const options: any = [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
];
component.settings = <any> { options: options };
component.ngOnInit();
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
it('should handle enter key as click on checkboxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.ngOnInit();
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
it('should update query builder on checkbox change', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.id = 'checklist';
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
it('should reset selected boxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
component.ngOnInit();
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();

View File

@@ -37,7 +37,7 @@ describe('SearchTextComponent', () => {
component = fixture.componentInstance;
component.id = 'text';
component.settings = {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
};
@@ -49,7 +49,7 @@ describe('SearchTextComponent', () => {
});
it('should parse value from the context at startup', () => {
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
fixture.detectChanges();
expect(component.value).toEqual('secret.pdf');
@@ -57,7 +57,7 @@ describe('SearchTextComponent', () => {
it('should not parse value when pattern not defined', () => {
component.settings.pattern = null;
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
fixture.detectChanges();
expect(component.value).toEqual('');
@@ -73,7 +73,7 @@ describe('SearchTextComponent', () => {
});
expect(component.value).toBe('top-secret.doc');
expect(component.context.queryFragments[component.id]).toBe("cm:name:'top-secret.doc'");
expect(component.context.queryFragments[component.id]).toBe(`cm:name:'top-secret.doc'`);
expect(component.context.update).toHaveBeenCalled();
});
@@ -85,7 +85,7 @@ describe('SearchTextComponent', () => {
});
expect(component.value).toBe('top-secret.doc');
expect(component.context.queryFragments[component.id]).toBe("cm:name:'top-secret.doc'");
expect(component.context.queryFragments[component.id]).toBe(`cm:name:'top-secret.doc'`);
component.onChangedHandler({
target: {
@@ -98,7 +98,7 @@ describe('SearchTextComponent', () => {
});
it('should show the custom/default name', async () => {
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
fixture.detectChanges();
await fixture.whenStable();
expect(component.value).toEqual('secret.pdf');
@@ -107,7 +107,7 @@ describe('SearchTextComponent', () => {
});
it('should be able to reset by clicking clear button', async () => {
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
fixture.detectChanges();
await fixture.whenStable();
const clearElement = fixture.debugElement.nativeElement.querySelector('button');

View File

@@ -107,7 +107,7 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChan
this.componentRef.instance.submitValues();
}
setValue(currentValue: string | Object) {
setValue(currentValue: string | any) {
this.componentRef.instance.isActive = true;
this.componentRef.instance.setValue(currentValue);
}

View File

@@ -24,7 +24,8 @@ import { TranslateModule } from '@ngx-translate/core';
describe('SearchComponent', () => {
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
let fixture: ComponentFixture<SimpleSearchTestComponent>;
let element: HTMLElement;
let component: SimpleSearchTestComponent;
let searchService: SearchService;

View File

@@ -72,6 +72,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 && classList.length) {

View File

@@ -35,7 +35,7 @@ describe('Search term validator', () => {
expect(control.valid).toBe(false);
});
/* tslint:disable:max-line-length */
/* 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 FormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
expect(control.valid).toBe(false);

View File

@@ -32,7 +32,7 @@ export class SearchFilterService {
/**
* Contains string-to-type mappings for registered widgets.
*/
widgets: { [id: string]: Type<{}> } = {
widgets: { [id: string]: Type<any> } = {
'text': SearchTextComponent,
'radio': SearchRadioComponent,
'slider': SearchSliderComponent,

View File

@@ -26,7 +26,7 @@ import { RatingServiceInterface } from '../services/rating.service.interface';
})
export class RatingServiceMock implements RatingServiceInterface {
getRating(nodeId: string, _ratingType: any): Observable<RatingEntry | {}> {
getRating(nodeId: string, _ratingType: any): Observable<RatingEntry | any> {
if (nodeId === 'fake-like-node-id') {
return of(ratingOneMock);
}
@@ -34,7 +34,7 @@ export class RatingServiceMock implements RatingServiceInterface {
return of(ratingThreeMock);
}
postRating(nodeId: string, _ratingType: string, _vote: any): Observable<RatingEntry | {}> {
postRating(nodeId: string, _ratingType: string, _vote: any): Observable<RatingEntry | any> {
if (nodeId === 'ratingOneMock') {
ratingOneMock.entry.aggregate.numberOfRatings = 1;
ratingOneMock.entry.aggregate.average = 1.0;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, ViewEncapsulation } from '@angular/core';
import { RatingService } from './services/rating.service';
import { RatingEntry } from '@alfresco/js-api';
import { takeUntil } from 'rxjs/operators';
@@ -27,7 +27,7 @@ import { Subject } from 'rxjs';
templateUrl: './rating.component.html',
encapsulation: ViewEncapsulation.None
})
export class RatingComponent implements OnChanges {
export class RatingComponent implements OnChanges, OnDestroy {
/** Identifier of the node to apply the rating to. */
@Input()

View File

@@ -20,7 +20,7 @@ import { Observable } from 'rxjs';
export interface RatingServiceInterface {
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | {}>;
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | {}>;
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | any>;
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | any>;
deleteRating(nodeId: string, ratingType: any): Observable<any>;
}

View File

@@ -42,7 +42,7 @@ export class RatingService implements RatingServiceInterface {
* @param ratingType Type of rating (can be "likes" or "fiveStar")
* @returns The rating value
*/
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | {}> {
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | any> {
return from(this.ratingsApi.getRating(nodeId, ratingType))
.pipe(
catchError(this.handleError)
@@ -56,7 +56,7 @@ export class RatingService implements RatingServiceInterface {
* @param vote Rating value (boolean for "likes", numeric 0..5 for "fiveStar")
* @returns Details about the rating, including the new value
*/
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | {}> {
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | any> {
const ratingBody: RatingBody = new RatingBody({
'id': ratingType,
'myRating': vote

View File

@@ -24,7 +24,7 @@ import { TagBody, TagPaging, TagEntry, TagsApi } from '@alfresco/js-api';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class TagService {
_tagsApi: TagsApi;

View File

@@ -22,7 +22,7 @@ import { UploadFilesEvent } from '../upload-files.event';
import { takeUntil } from 'rxjs/operators';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class UploadBase implements OnInit, OnDestroy {
/** Sets a limit on the maximum size (in bytes) of a file to be uploaded.

View File

@@ -72,11 +72,10 @@ export class UploadDragAreaComponent extends UploadBase implements NodeAllowable
* @param latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
*/
showUndoNotificationBar(latestFilesAdded: FileModel[]) {
let messageTranslate: any, actionTranslate: any;
messageTranslate = this.translationService.get('FILE_UPLOAD.MESSAGES.PROGRESS');
actionTranslate = this.translationService.get('FILE_UPLOAD.ACTION.UNDO');
const messageTranslate = this.translationService.instant('FILE_UPLOAD.MESSAGES.PROGRESS');
const actionTranslate = this.translationService.instant('FILE_UPLOAD.ACTION.UNDO');
this.notificationService.openSnackMessageAction(messageTranslate.value, actionTranslate.value, 3000).onAction().subscribe(() => {
this.notificationService.openSnackMessageAction(messageTranslate, actionTranslate, 3000).onAction().subscribe(() => {
this.uploadService.cancelUpload(...latestFilesAdded);
});
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { FileUtils } from '@alfresco/adf-core';
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output } from '@angular/core';