[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

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', () => {