[AAE-7100] ESLint support for ADF Core and DemoShell projects (#7481)

* remove tsconfig.base as per eslint schematics

* add schematics

* upgrade demoshell to eslint

* fix eslint issues for demoshell

* integrate eslint for ADF core and fix some issues

* turn into warn

* fix code

* workaround for Chrome clipboard issue

* exclude e2e tests

* exclude e2e
This commit is contained in:
Denys Vuika
2022-02-02 18:01:47 +00:00
committed by GitHub
parent 6ef4838688
commit b8bb234410
192 changed files with 2553 additions and 483 deletions

112
lib/core/.eslintrc.json Normal file
View File

@@ -0,0 +1,112 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"lib/core/tsconfig.lib.json",
"lib/core/tsconfig.spec.json"
],
"createDefaultProgram": true
},
"plugins": [
"eslint-plugin-unicorn",
"eslint-plugin-rxjs"
],
"rules": {
"jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"no-underscore-dangle": "warn",
"no-shadow": "warn",
"quote-props": "warn",
"object-shorthand": "warn",
"prefer-const": "warn",
"arrow-body-style": "warn",
"@angular-eslint/no-output-native": "warn",
"space-before-function-paren": "warn",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": [
"adf",
"app"
],
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": [
"element",
"attribute"
],
"prefix": [
"adf",
"app"
],
"style": "kebab-case"
}
],
"@angular-eslint/no-host-metadata-property": "off",
"@angular-eslint/no-input-prefix": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "error",
"brace-style": [
"error",
"1tbs"
],
"comma-dangle": "error",
"default-case": "error",
"import/order": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-bitwise": "off",
"no-duplicate-imports": "error",
"no-multiple-empty-lines": "error",
"no-redeclare": "error",
"no-return-await": "error",
"rxjs/no-create": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
"rxjs/no-unsafe-takeuntil": "error",
"unicorn/filename-case": "error"
}
},
{
"files": [
"*.html"
],
"rules": {
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/no-negated-async": "warn"
}
}
]
}

View File

@@ -1,10 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"emitDecoratorMetadata": true
},
"exclude": ["../**/*.spec.ts" ],
"include": ["../**/*.ts", "*.js"]
}

View File

@@ -23,7 +23,7 @@ import { Subject } from 'rxjs';
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 BaseCardView<T extends CardViewItem> implements OnDestroy {
@Input()

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, Input, SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
@@ -109,12 +109,12 @@ describe('CardViewItemDispatcherComponent', () => {
});
it('should update the subcomponent\'s input parameters', () => {
const expectedEditable = false,
expectedDisplayEmpty = true,
expectedProperty = <CardViewItem> {},
expectedCustomInput = 1,
expectedDisplayNoneOption = false,
expectedDisplayClearAction = false;
const expectedEditable = false;
const expectedDisplayEmpty = true;
const expectedProperty = <CardViewItem> {};
const expectedCustomInput = 1;
const expectedDisplayNoneOption = false;
const expectedDisplayClearAction = false;
component.ngOnChanges({
editable: new SimpleChange(true, expectedEditable, false),

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, OnChanges, OnDestroy } from '@angular/core';
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { CardViewSelectItemModel } from '../../models/card-view-selectitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs';
@@ -30,7 +30,7 @@ import { takeUntil, map } from 'rxjs/operators';
templateUrl: './card-view-selectitem.component.html',
styleUrls: ['./card-view-selectitem.component.scss']
})
export class CardViewSelectItemComponent extends BaseCardView<CardViewSelectItemModel<string | number>> implements OnChanges, OnDestroy {
export class CardViewSelectItemComponent extends BaseCardView<CardViewSelectItemModel<string | number>> implements OnInit, OnChanges, OnDestroy {
static HIDE_FILTER_LIMIT = 5;
@Input() editable: boolean = false;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, ViewEncapsulation, ViewChild, ElementRef, OnDestroy, Inject, Output, EventEmitter } from '@angular/core';
import { Component, ViewEncapsulation, ViewChild, ElementRef, OnDestroy, Inject, Output, EventEmitter, OnInit } from '@angular/core';
import { ESCAPE, TAB } from '@angular/cdk/keycodes';
import { MatSelect } from '@angular/material/select';
import { Subject } from 'rxjs';
@@ -28,7 +28,7 @@ import { takeUntil } from 'rxjs/operators';
host: { 'class': 'adf-select-filter-input' },
encapsulation: ViewEncapsulation.None
})
export class SelectFilterInputComponent implements OnDestroy {
export class SelectFilterInputComponent implements OnInit, OnDestroy {
@ViewChild('selectFilterInput', { read: ElementRef, static: false }) selectFilterInput: ElementRef;
@Output() change = new EventEmitter<string>();

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ChangeDetectorRef, Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { BaseCardView } from '../base-card-view';
@@ -42,7 +42,7 @@ const templateTypes = {
styleUrls: ['./card-view-textitem.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemModel> implements OnChanges {
export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemModel> implements OnChanges, OnDestroy {
@Input()
editable: boolean = false;
@@ -92,7 +92,11 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
this.setTemplateType();
if (changes.editable) {
this.isEditable ? this.textInput.enable() : this.textInput.disable();
if (this.isEditable) {
this.textInput.enable();
} else {
this.textInput.disable();
}
}
}

View File

@@ -95,7 +95,7 @@ describe('CardViewBaseItemModel', () => {
expect(validator2.isValid).toHaveBeenCalledWith('test-against-this');
});
it("should return the registered validators' common decision (case true)", () => {
it('should return the registered validators common decision (case true)', () => {
const validator1: CardViewItemValidator = { isValid: () => true, message: 'validator 1' };
const validator2: CardViewItemValidator = { isValid: () => true, message: 'validator 2' };
properties.validators = [validator1, validator2];
@@ -107,7 +107,7 @@ describe('CardViewBaseItemModel', () => {
expect(itemModel.getValidationErrors('test-against-this')).toEqual([]);
});
it("should return the registered validators' common decision (case false)", () => {
it('should return the registered validators common decision (case false)', () => {
const validator1: CardViewItemValidator = { isValid: () => false, message: 'validator 1' };
const validator2: CardViewItemValidator = { isValid: () => true, message: 'validator 2' };
const validator3: CardViewItemValidator = { isValid: () => false, message: 'validator 3' };

View File

@@ -30,7 +30,7 @@ import { CardViewArrayItemComponent } from '../components/card-view-arrayitem/ca
})
export class CardItemTypeService extends DynamicComponentMapper {
protected defaultValue: Type<{}> = CardViewTextItemComponent;
protected defaultValue: Type<any> = CardViewTextItemComponent;
protected types: { [key: string]: DynamicComponentResolveFunction } = {
'text': DynamicComponentResolver.fromType(CardViewTextItemComponent),

View File

@@ -29,10 +29,10 @@ export interface ClickNotification {
target: any;
}
export function transformKeyToObject(key: string, value): Object {
export function transformKeyToObject(key: string, value): any {
const objectLevels: string[] = key.split('.').reverse();
return objectLevels.reduce<{}>((previousValue, currentValue) => {
return objectLevels.reduce<any>((previousValue, currentValue) => {
return { [currentValue]: previousValue};
}, value);
}

View File

@@ -24,7 +24,7 @@ import { ClipboardService } from './clipboard.service';
})
export class ClipboardDirective {
/** Translation key or message for the tooltip. */
// tslint:disable-next-line:no-input-rename
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-clipboard')
placeholder: string;
@@ -33,7 +33,7 @@ export class ClipboardDirective {
target: HTMLInputElement | HTMLTextAreaElement;
/** Translation key or message for snackbar notification. */
// tslint:disable-next-line:no-input-rename
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('clipboard-notification') message: string;
constructor(private clipboardService: ClipboardService,

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 } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service';

View File

@@ -15,16 +15,16 @@
* limitations under the License.
*/
/* tslint:disable:component-selector no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Component, ContentChild, TemplateRef } from '@angular/core';
import { AfterContentInit, Component, ContentChild, TemplateRef } from '@angular/core';
import { DataColumnComponent } from './data-column.component';
@Component({
selector: 'adf-data-column-header',
template: ''
})
export class DateColumnHeaderComponent {
export class DateColumnHeaderComponent implements AfterContentInit {
@ContentChild(TemplateRef)
public header: TemplateRef<any>;

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core';
@@ -56,7 +56,7 @@ export class DataColumnComponent implements OnInit {
/** Custom tooltip formatter function. */
@Input()
formatTooltip: Function;
formatTooltip: (...args) => string;
/** Title to be used for screen readers. */
@Input('sr-title')

View File

@@ -1090,7 +1090,7 @@ describe('DataTable', () => {
const column = <DataColumn> {};
const row: any = {
getValue: function () {
getValue: function() {
return 'material-icons://android';
}
};
@@ -1102,7 +1102,7 @@ describe('DataTable', () => {
const column = <DataColumn> {};
const row: any = {
getValue: function () {
getValue: function() {
return 'http://www.google.com';
}
};
@@ -1114,7 +1114,7 @@ describe('DataTable', () => {
const column = <DataColumn> {};
const row: any = {
getValue: function () {
getValue: function() {
return 'material-icons://android';
}
};
@@ -1126,7 +1126,7 @@ describe('DataTable', () => {
const column = <DataColumn> {};
const row: any = {
getValue: function () {
getValue: function() {
return 'http://www.google.com';
}
};
@@ -1229,7 +1229,7 @@ describe('DataTable', () => {
const column = <DataColumn> {};
const row: any = {
getValue: function () {
getValue: function() {
return 'id';
}
};

View File

@@ -15,10 +15,12 @@
* limitations under the License.
*/
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
import {
ViewChildren, QueryList, HostListener,
AfterContentInit, Component, ContentChild, DoCheck, ElementRef, EventEmitter, Input,
IterableDiffers, OnChanges, Output, SimpleChange, SimpleChanges, TemplateRef, ViewEncapsulation, OnDestroy
IterableDiffers, OnChanges, Output, SimpleChange, SimpleChanges, TemplateRef, ViewEncapsulation, OnDestroy, AfterViewInit
} from '@angular/core';
import { FocusKeyManager } from '@angular/cdk/a11y';
import { MatCheckboxChange } from '@angular/material/checkbox';
@@ -57,7 +59,7 @@ export enum ShowHeaderMode {
encapsulation: ViewEncapsulation.None,
host: { class: 'adf-datatable' }
})
export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, OnDestroy {
export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, OnDestroy, AfterViewInit {
@ViewChildren(DataTableRowComponent)
rowsList: QueryList<DataTableRowComponent>;
@@ -122,7 +124,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
* 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()
@@ -203,7 +205,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
private click$: Observable<DataRowEvent>;
private differ: any;
private rowMenuCache: object = {};
private rowMenuCache: any = {};
private subscriptions: Subscription[] = [];
private singleClickStreamSub: Subscription;
@@ -856,7 +858,7 @@ export interface DataTableDropEvent {
target: 'cell' | 'header';
event: Event;
column: DataColumn;
row?: DataRow
row?: DataRow;
};
preventDefault(): void;

View File

@@ -57,7 +57,7 @@ export class JsonCellComponent extends DataTableCellComponent implements OnInit
}
view() {
const rawValue: string | object = this.data.getValue(this.row, this.column, this.resolverFn);
const rawValue: string | any = this.data.getValue(this.row, this.column, this.resolverFn);
const value = typeof rawValue === 'object'
? JSON.stringify(rawValue || {}, null, 2)
: rawValue;

View File

@@ -38,7 +38,7 @@ export interface DataColumn {
srTitle?: string;
cssClass?: string;
template?: TemplateRef<any>;
formatTooltip?: Function;
formatTooltip?: (...args) => string;
copyContent?: boolean;
editable?: boolean;
focus?: boolean;

View File

@@ -22,7 +22,7 @@ import { DataColumn } from './data-column.model';
import { ObjectDataColumn } from './object-datacolumn.model';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class DataTableSchema {
@ContentChild(DataColumnListComponent)

View File

@@ -136,12 +136,16 @@ describe('ObjectDataTableAdapter', () => {
it('should fail getting value with row not defined', () => {
const adapter = new ObjectDataTableAdapter([], []);
expect(() => { adapter.getValue(null, null); }).toThrowError('Row not found');
expect(() => {
adapter.getValue(null, null);
}).toThrowError('Row not found');
});
it('should fail getting value with column not defined', () => {
const adapter = new ObjectDataTableAdapter([], []);
expect(() => { adapter.getValue(<DataRow> {}, null); }).toThrowError('Column not found');
expect(() => {
adapter.getValue(<DataRow> {}, null);
}).toThrowError('Column not found');
});
it('should get value from row with column key', () => {
@@ -300,7 +304,9 @@ describe('ObjectDataTableAdapter', () => {
describe('ObjectDataRow', () => {
it('should require object source', () => {
expect(() => { return new ObjectDataRow(null); }).toThrowError('Object source not found');
expect(() => {
return new ObjectDataRow(null);
}).toThrowError('Object source not found');
});
it('should get top level property value', () => {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api';

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, Input, Renderer2, AfterViewChecked } from '@angular/core';
import { HighlightTransformService, HighlightTransformResult } from '../services/highlight-transform.service';

View File

@@ -34,7 +34,7 @@ export class LibraryFavoriteDirective implements OnChanges {
library: LibraryEntity = null;
@Output() toggle = new EventEmitter<any>();
// tslint:disable-next-line: no-output-native
// eslint-disable-next-line @angular-eslint/no-output-native
@Output() error = new EventEmitter<any>();
private targetLibrary = null;

View File

@@ -149,7 +149,7 @@ describe('LibraryMembershipDirective', () => {
expect(deleteMembershipSpy).not.toHaveBeenCalled();
}));
it("should add 'workspace' to send appropriate email", fakeAsync(() => {
it(`should add 'workspace' to send appropriate email`, fakeAsync(() => {
mockSupportedVersion = true;
const selection = { entry: { id: 'no-membership-requested' } };
const change = new SimpleChange(null, selection, true);

View File

@@ -65,7 +65,7 @@ export class LibraryMembershipDirective implements OnChanges {
@Output()
toggle = new EventEmitter<LibraryMembershipToggleEvent>();
// tslint:disable-next-line: no-output-native
// eslint-disable-next-line @angular-eslint/no-output-native
@Output()
error = new EventEmitter<LibraryMembershipErrorEvent>();

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, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
import { NodeEntry, Node, DeletedNodeEntity, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
@@ -185,6 +185,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 }
);
}
@@ -192,6 +193,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 }
);
}

View File

@@ -26,7 +26,7 @@ import { DownloadService } from '../services/download.service';
* Directive selectors without adf- prefix will be deprecated on 3.0.0
*/
@Directive({
// tslint:disable-next-line: directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[adfNodeDownload]'
})
export class NodeDownloadDirective {
@@ -110,7 +110,8 @@ export class NodeDownloadDirective {
// nodeId for Shared node
const id = (<any> node.entry).nodeId || node.entry.id;
let url, fileName;
let url;
let fileName;
if (this.version) {
url = this.contentApi.getVersionContentUrl(id, this.version.entry.id, true);
fileName = this.version.entry.name;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
import { FavoriteBody, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api';

View File

@@ -69,7 +69,9 @@ describe('NodeRestoreDirective', () => {
}));
translationService = TestBed.inject(TranslationService);
spyOn(translationService, 'instant').and.callFake((key) => { return key; });
spyOn(translationService, 'instant').and.callFake((key) => {
return key;
});
});
it('should not restore when selection is empty', () => {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, PathInfoEntity } from '@alfresco/js-api';
@@ -194,6 +194,7 @@ export class NodeRestoreDirective {
return this.translation.instant(
'CORE.RESTORE_NODE.PARTIAL_PLURAL',
{
// eslint-disable-next-line id-blacklist
number: status.fail.length
}
);

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, NgZone, OnDestroy, OnInit, Renderer2 } from '@angular/core';
import { FileInfo, FileUtils } from '../utils/file-utils';

View File

@@ -20,7 +20,7 @@ import { EventEmitter, Input, Output, Directive } from '@angular/core';
import { ThemePalette } from '@angular/material/core';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class FormBaseComponent {
static SAVE_OUTCOME_ID: string = '$save';

View File

@@ -35,7 +35,7 @@ import { WidgetVisibilityService } from './../../services/widget-visibility.serv
import { FormFieldModel } from './../widgets/core/form-field.model';
import { WidgetComponent } from './../widgets/widget.component';
declare var adf: any;
declare const adf: any;
@Component({
selector: 'adf-form-field',
@@ -63,7 +63,7 @@ export class FormFieldComponent implements OnInit, OnDestroy {
@Input()
field: FormFieldModel = null;
componentRef: ComponentRef<{}>;
componentRef: ComponentRef<any>;
focus: boolean = false;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, OnInit, ViewEncapsulation, InjectionToken, Inject, Optional } from '@angular/core';
import { FormService } from './../../../services/form.service';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Component, ViewEncapsulation } from '@angular/core';
import { FormService } from './../../../services/form.service';

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export class ContainerColumnModel {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { FormFieldModel } from './form-field.model';
import { FormWidgetModel } from './form-widget.model';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface DisplayableCMProperties {
name?: string;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export class ErrorMessageModel {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface ExternalContentLink {
contentAvailable: boolean;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface ExternalContent {
folder: boolean;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { FormFieldSelectedFolder } from './form-field-selected-folder';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { DisplayableCMProperties } from './displayable-cm-properties.model';
import { FormFieldFileSource } from './form-field-file-source';
@@ -31,10 +31,10 @@ export interface FormFieldMetadata {
};
responseVariable?: boolean;
menuOptions?: {
show?: boolean,
download?: boolean,
retrieveMetadata?: boolean,
remove?: boolean
show?: boolean;
download?: boolean;
retrieveMetadata?: boolean;
remove?: boolean;
};
displayableCMProperties?: DisplayableCMProperties[];
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface FormFieldOption {
id: string;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface FormFieldSelectedFolder {
accountId: string;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface FormFieldTemplates {
[key: string]: string;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export class FormFieldTypes {
static CONTAINER: string = 'container';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import moment from 'moment-es6';
import { FormFieldTypes } from './form-field-types';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import moment from 'moment-es6';
import { WidgetVisibilityModel } from '../../../models/widget-visibility.model';
import { ContainerColumnModel } from './container-column.model';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { FormWidgetModel } from './form-widget.model';
import { WidgetVisibilityModel } from './../../../models/widget-visibility.model';

View File

@@ -15,9 +15,9 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
/* tslint:disable */
/* eslint-disable */
import { FormFieldMetadata } from './form-field-metadata';
export interface FormValues extends FormFieldMetadata {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export abstract class FormWidgetModel {

View File

@@ -43,7 +43,7 @@ export interface FormRepresentationModel {
taskName?: string;
processDefinitionId?: string;
customFieldTemplates?: {
[key: string]: string
[key: string]: string;
};
selectedOutcome?: string;
fields?: any[];

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export * from './form-field-metadata';
export * from './form-values';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { WidgetVisibilityModel } from '../../../models/widget-visibility.model';
import { FormWidgetModel } from './form-widget.model';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/moment-date-adapter';

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { DynamicTableColumn } from './dynamic-table-column.model';
import { DynamicTableRow } from './dynamic-table-row.model';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import moment from 'moment-es6';
import { CellValidator } from './cell-validator.model';

View File

@@ -17,7 +17,7 @@
import { ErrorMessageModel } from '../core/error-message.model';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export class DynamicRowValidationSummary extends ErrorMessageModel {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
// maps to: com.activiti.model.editor.form.OptionRepresentation
export interface DynamicTableColumnOption {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { DynamicTableColumnOption } from './dynamic-table-column-option.model';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
export interface DynamicTableRow {
isNew: boolean;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import moment from 'moment-es6';
import { ValidateDynamicTableRowEvent } from '../../../events/validate-dynamic-table-row.event';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { LogService } from '../../../../services/log.service';
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewEncapsulation } 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, Input, OnInit } from '@angular/core';
import { DynamicTableColumn } from './../../dynamic-table-column.model';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/moment-date-adapter';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { LogService } from '../../../../../../services/log.service';
import { Component, Input, OnInit } 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, Output } from '@angular/core';
import { DynamicRowValidationSummary } from './../dynamic-row-validation-summary.model';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { CellValidator } from './cell-validator.model';
import { DynamicRowValidationSummary } from './dynamic-row-validation-summary.model';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { CellValidator } from './cell-validator.model';
import { DynamicRowValidationSummary } from './dynamic-row-validation-summary.model';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';

View File

@@ -19,7 +19,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
import { FormService } from '../../../services/form.service';
import { WidgetComponent } from './../widget.component';
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'file-viewer-widget',

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { FormService } from './../../../services/form.service';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { PeopleProcessService } from '../../../../services/people-process.service';
import { UserProcessModel } from '../../../../models';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { AfterContentChecked, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { FormFieldModel, TabModel } from './../core/index';
@@ -44,9 +44,7 @@ export class TabsWidgetComponent implements AfterContentChecked {
}
filterVisibleTabs() {
this.visibleTabs = this.tabs.filter((tab) => {
return tab.isVisible;
});
this.visibleTabs = this.tabs.filter((tab) => tab.isVisible);
}
tabChanged(field: FormFieldModel) {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable: component-selector no-use-before-declare no-input-rename */
/* eslint-disable @angular-eslint/component-selector, @typescript-eslint/no-use-before-define, @angular-eslint/no-input-rename */
import {
Directive,
@@ -46,8 +46,8 @@ export class InputMaskDirective implements OnChanges, ControlValueAccessor {
/** Object defining mask and "reversed" status. */
@Input('textMask') inputMask: {
mask: string,
isReversed: boolean
mask: string;
isReversed: boolean;
};
private translationMask = {
@@ -66,10 +66,10 @@ export class InputMaskDirective implements OnChanges, ControlValueAccessor {
}
_onChange = (_: any) => {
}
};
_onTouched = () => {
}
};
@HostListener('input', ['$event'])
@HostListener('keyup', ['$event']) onTextInput(event: KeyboardEvent) {
@@ -158,9 +158,9 @@ export class InputMaskDirective implements OnChanges, ControlValueAccessor {
}
check = this.isToCheck(isReversed, maskIndex, maskLen, valueIndex, valueLength);
while (check) {
const maskDigit = mask.charAt(maskIndex),
valDigit = value.charAt(valueIndex),
translation = this.translationMask[maskDigit];
const maskDigit = mask.charAt(maskIndex);
const valDigit = value.charAt(valueIndex);
const translation = this.translationMask[maskDigit];
if (translation) {
if (valDigit.match(translation.pattern)) {

View File

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

View File

@@ -47,8 +47,12 @@ describe('TypeaheadWidgetComponent', () => {
beforeEach(() => {
alfrescoApiService = TestBed.inject(AlfrescoApiService);
translationService = TestBed.inject(TranslateService);
spyOn(translationService, 'instant').and.callFake((key) => { return key; });
spyOn(translationService, 'get').and.callFake((key) => { return of(key); });
spyOn(translationService, 'instant').and.callFake((key) => {
return key;
});
spyOn(translationService, 'get').and.callFake((key) => {
return of(key);
});
formService = new FormService(null, alfrescoApiService, null);
widget = new TypeaheadWidgetComponent(formService, null);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { LogService } from '../../../../services/log.service';
import { ENTER, ESCAPE } from '@angular/cdk/keycodes';

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { LogService } from '../../../../services/log.service';
import { ThumbnailService } from '../../../../services/thumbnail.service';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { LogService } from '../../../../services/log.service';
import { ThumbnailService } from '../../../../services/thumbnail.service';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { AfterViewInit, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { FormService } from './../../services/form.service';

View File

@@ -24,7 +24,7 @@ import * as widgets from './../components/widgets/index';
})
export class FormRenderingService extends DynamicComponentMapper {
protected defaultValue: Type<{}> = widgets.UnknownWidgetComponent;
protected defaultValue: Type<any> = widgets.UnknownWidgetComponent;
protected types: { [key: string]: DynamicComponentResolveFunction } = {
'text': DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
'string': DynamicComponentResolver.fromType(widgets.TextWidgetComponent),

View File

@@ -157,7 +157,7 @@ export class WidgetVisibilityService {
getFormValue(form: FormModel, fieldId: string): any {
const formField = this.getFormFieldById(form, fieldId);
let value = undefined;
let value;
if (this.isFormFieldValid(formField)) {
value = this.getFieldValue(form.values, fieldId);
@@ -174,7 +174,8 @@ export class WidgetVisibilityService {
}
getFieldValue(valueList: any, fieldId: string): any {
let labelFilterByName, valueFound;
let labelFilterByName;
let valueFound;
if (fieldId && fieldId.indexOf('_LABEL') > 0) {
labelFilterByName = fieldId.substring(0, fieldId.length - 6);
if (valueList[labelFilterByName]) {

Some files were not shown because too many files have changed in this diff Show More